Kate Failed to find server binary

Hello! i have setup Kate editor but when i open dart file the lsp fail giving out an error:
" LSP Client Warning] Failed to find server binary: dart

Please check your PATH for the binary

See also sdk/pkg/analysis_server/tool at master · dart-lang/sdk · GitHub for installation or details"

here is the lsp configuration file:

"{
“servers”: {
“dart”: {
“command”: [“dart”, “/path/to/development/flutter/bin/cache/dart-sdk/bin/snapshots/analysis_server.dart.snapshot”, “–lsp”]
}
}
}
"

and this is my .bashrc(PATH) file:

export PATH=“$PATH:/path/to/development/flutter/bin”
export PATH=“$PATH:/path/to/development/flutter/bin/cache/dart-sdk/bin”

Bashrc does not apply for graphical applications (unless of course, you start Kate from bash). How to set the environment variables correctly depends on your system (Wayland vs X, specifically) see Environment variables - ArchWiki.

Another option is just to put the full path to the dart LSP in the command, although I’m not familiar with the language so maybe you actually do need it in your path.

Not sure what you meant i have already set the full path to the dart LSP in the command:

"{
“servers”: {
“dart”: {
“command”: [“dart”, “/path/to/development/flutter/bin/cache/dart-sdk/bin/snapshots/analysis_server.dart.snapshot”, “–lsp”]
}
}
}
"

you can also check this out: Dart / Flutter support in Kate - Kate

i followed that article but it is not working for me.
also i don’t know how to start Kate from bash as i installed it from Snap.

and here is the Default server settings for dart:

“dart”: {
“command”: [“dart”, “analysis_server.dart.snapshot”, “–lsp”],
“url”: “sdk/pkg/analysis_server/tool at master · dart-lang/sdk · GitHub”,
“highlightingModeRegex”: “^Dart$”,
“initializationOptions”: {
“onlyAnalyzeProjectsWithOpenFiles”: true
}
},

Did you post the wrong snippet? You said you used the full path to dart, but it still says "dart" (meaning it picks up the first thing named dart in your $PATH).

The Kate post also says this:

What the above does is merge this setting with “Default Server Settings”. Of couse dart executable needs to be in your $PATH.

Dart executable is already in my path but i don’t think it can read it so i had to put the path to Dart binary in the “command” myself and it now works.
Thanks For your help!

3 Likes