{"id":18782714,"url":"https://github.com/ycm-core/lsp-examples","last_synced_at":"2025-04-05T16:07:37.835Z","repository":{"id":40349588,"uuid":"196746566","full_name":"ycm-core/lsp-examples","owner":"ycm-core","description":"Use any language server with YouCompleteMe.","archived":false,"fork":false,"pushed_at":"2025-03-04T02:16:43.000Z","size":190,"stargazers_count":83,"open_issues_count":7,"forks_count":28,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-29T15:07:15.339Z","etag":null,"topics":["language-servers","lsp","rust-analyzer","vim","ycmd","youcompleteme"],"latest_commit_sha":null,"homepage":"https://ycm-core.github.io/YouCompleteMe","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ycm-core.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-13T17:05:10.000Z","updated_at":"2025-02-01T18:56:19.000Z","dependencies_parsed_at":"2024-05-29T09:06:43.358Z","dependency_job_id":"fc0e332c-4bf8-4117-a87b-4e3d92330890","html_url":"https://github.com/ycm-core/lsp-examples","commit_stats":{"total_commits":102,"total_committers":18,"mean_commits":5.666666666666667,"dds":0.5882352941176471,"last_synced_commit":"26ba7d166a31a2e0eb63577349d3e1d8fc4a3f49"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycm-core%2Flsp-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycm-core%2Flsp-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycm-core%2Flsp-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycm-core%2Flsp-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ycm-core","download_url":"https://codeload.github.com/ycm-core/lsp-examples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247361687,"owners_count":20926643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["language-servers","lsp","rust-analyzer","vim","ycmd","youcompleteme"],"created_at":"2024-11-07T20:36:52.546Z","updated_at":"2025-04-05T16:07:37.828Z","avatar_url":"https://github.com/ycm-core.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overview\n\nThis repo includes a simple way to install some language servers that might work\nwith YouCompleteMe (strictly ycmd). \n\nThis repo comes with no warranty, and these engines are not officially supported\nby YCM, though they should work for the most part.\n\n\u003c!--ts--\u003e\n   * [Overview](#overview)\n   * [Languages Tested](#languages-tested)\n   * [Quick start](#quick-start)\n   * [Configuration](#configuration)\n   * [Purescript](#purescript)\n   * [Scala](#scala)\n   * [Haskell](#haskell)\n   * [Fortran](#fortran)\n   * [Python (e.g. pyright)](#python-eg-pyright)\n   * [Ruby](#ruby)\n   * [D](#d)\n   * [Godot](#godot)\n   * [Kotlin](#kotlin)\n   * [Julia](#julia)\n   * [Lua](#lua)\n   * [Zig](#zig)\n   * [CSS](#css)\n   * [PHP](#php)\n   * [Crystal](#crystal)\n   * [Astro](#astro)\n   * [Postgres](#postgres)\n   * [Known Issues](#known-issues)\n\n\u003c!-- Added by: ben, at: Tue 21 Feb 2023 09:01:14 GMT --\u003e\n\n\u003c!--te--\u003e\n\n# Languages Tested\n\nWorking:\n\n* Angular\n* Bash\n* CSS\n* Cmake\n* Crystal\n* D\n* Dart\n* Dockerfile\n* Godot (gdscript)\n* Groovy\n* Jai\n* Jsonnet (see jsonnet/README.md)\n* Kotlin\n* PHP\n* Python (pyright)\n* Racket\n* Ruby\n* Vala\n* Vim (vimscript)\n* Vue\n* WASM (WAT)\n* Zig\n\nBroken or partially working:\n\n* JSON\n* Lua\n* YAML\n\nSee also:\n\n* [C-family with ccls](https://github.com/MaskRay/ccls/wiki/YouCompleteMe)\n\n# Quick start\n\nAssuming you installed this repo in `/path/to/this/directory`:\n\n* Decide which languages you want. Each language is a directory in this repo.\n* Run `python3 ./install.py --enable-LANG1 --enable-LANG2 ...`.\n  Replace LANG1/LANG2 etc. with the language dirs. e.g. `./install.py\n  --enable-dart --enable-bash`. You can also use `--all` and `--disable-LANG`.\n* Add the line to your vimrc that it tells you to, this will be similar to:\n\n```viml\nsource /path/to/this/directory/vimrc.generated\n```\n\n* Optionally: edit `vimrc.generated` to customise `g:ycm_language_server`\n\n* **NOTE**: YCM will regard the path of `.ycm_extra_conf.py` as root path of\n  project folder.  So please make sure you put your `.ycm_extra_conf.py` at\n  right place (root of current project)\n\n# Configuration\n\nThe `g:ycm_language_server` option is used to tell YCM (strictly, ycmd) to use\nits 'generic' language server completer. It's a list of dictionaries with the\nfollowing keys:\n\n* 'name' (string): Name of the language server\n* 'filetypes' (list): List of Vim filetypes to use this language server for\n* 'cmdline' (list): List of words forming a command line to execute. Note:\n  *must* be a list, even if it has only one element (such as `[ 'executable' ]`.\n  If not supplied, no server is started and a port must be supplied.\n* 'port' (number): A TCP port on localhost to connect to if stdio is not\n  possible.\n* 'project_root_files' (list, optional): List of filename to search for when\n  trying to determine the 'root' of the project. THis is useful for languages or\n  language servers which don't automatically detect the 'workspace' root.\n\nFor full documentation, please see the YouCompleteMe docs.\n\n# Purescript\n\nYcmd currently doesn't support `showMessageRequest`, so users need to manually\nbuild their projects on the command line before starting the server. To do this\nexecute `pulp build` in the project root.\n\n# Scala\n\nYcmd currently doesn't support `showMessageRequest`, so users need to \"import\nbuild\" manually.  Unlike purescript, for scala, this can be done in the editor\nby executing `:YcmCompleter ExecuteCommand build-import`. For this operation to\nsucceed `sbt` and `bloop` need to be in the `$PATH`. `metals` also requires java\n8.\n\nFor completions to work make sure the version of `metals` has [this bug fix][metals-pr].\n\n# Haskell\n\nhaskell-ide-engine [is not actively being developed anymore][hie-not-developing], in\nfavour of [haskell-language-server][haskell-language-server] ([installation\ninstructions][hls-install]).\n\n\n# Fortran\n\nThe server causes a spurious error:\n\n- `fortls` doesn't support `didChangeConfiguration`.\n\nThis error can be ignored, as they don't interfere with normal work of ycmd/fortls.\n\n# Python (e.g. pyright)\n\nIf configuring a language server for Python, this will completely disable the\nbuilt-in Jedi completer in YCM.\n\n## Pyright\n\nExample extra conf (actually for ycmd itself):\n\n```python\nimport sys.path as p\n\nDIR_OF_THIS_SCRIPT = p.abspath( p.dirname( __file__ ) )\nDIR_OF_THIRD_PARTY = p.join( DIR_OF_THIS_SCRIPT, 'third_party' )\nDIR_OF_WATCHDOG_DEPS = p.join( DIR_OF_THIRD_PARTY, 'watchdog_deps' )\n\ndef Settings( **kwargs ):\n  if language == 'python':\n    return {\n      'ls': {\n        'python': {\n          'analysis': {\n            'extraPaths': [\n              p.join( DIR_OF_THIS_SCRIPT ),\n              p.join( DIR_OF_THIRD_PARTY, 'bottle' ),\n              p.join( DIR_OF_THIRD_PARTY, 'regex-build' ),\n              p.join( DIR_OF_THIRD_PARTY, 'frozendict' ),\n              p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'jedi' ),\n              p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'parso' ),\n              p.join( DIR_OF_WATCHDOG_DEPS, 'watchdog', 'build', 'lib3' ),\n              p.join( DIR_OF_WATCHDOG_DEPS, 'pathtools' ),\n              p.join( DIR_OF_THIRD_PARTY, 'waitress' )\n            ],\n            'useLibraryCodeForTypes': True\n          }\n        }\n      }\n    }\n```\n\n# Racket\n\nYou need to have racket installed so you can use `raco` to install\nthe required packages for the language server.\nYou can install racket through the [racket website](https://download.racket-lang.org/) or your package manager.\n\n# Ruby\n\nYou need to be running a version of ruby that the parser understands:\nhttps://github.com/whitequark/parser#compatibility-with-ruby-mri\n\nRecommend running in [rbenv][] for that:\n\n```\n$ rbenv shell 2.3.8\n$ cd ruby\n$ ./install\n$ vim test/test.rb\n```\n\n# D\n\nThere is a number of external dependencies that you will want to install:\n\n- `libphobos`/`liblphobos` - the D standard library\n- `dmd` - the D compiler\n- `dscanner` - at the very least responsible for diagnostics\n- `dcd` - the D compiler daemon\n- Potentially `dfmt` - `serve-d` seems to be able to format code even without it.\n- `dub` - the D package manager\n\nOn top of that, you will want to configure the server, at least to let `serve-d`\nknow about your modules. The configuration is done through ycmd's extra confs\nand the full list of `serve-d`'s configuration options can be found\n[here][d-conf].\n\nNote that the server executable on Windows is called `serve-d.exe`.\n\n# Godot\n\nGodot must be running and you must go to `Project -\u003e Project Settings -\u003e Global`\nand set `Language Server` to `On`. At least since Godot 3.4, `Language Server`\noptions are under `Editor Settings` and `On` by default.\n\nIf Godot is closed or restarted, you might need to force YCM to reconnect (this\nisn't automatic). Use `:YcmCompleter RestartServer` to reconnect.\n\nYou can check the status of the connection with `:YcmDebugInfo`.\n\nRecommend [vim-godot](https://github.com/habamax/vim-godot) for syntax, etc.\n(don't believe the hype about using _other_ completion systems though, of\ncourse).\n\n# Kotlin\n\nFor whatever reason, the server expects you to have maven in your `PATH` and,\njust like `serve-d`, `kotlin-language-server` has its own [configuration][kt-conf].\n\nThe server executable is actually a shell script and the build process produces\n`server` for Linux and `server.bat` for Windows.\n\nMake sure to put a `.ycm_extra_conf.py` file in the root of your project, otherwise\n[the language server may fail][kt-issue].\n\n# Julia\n\nThe command line for starting the server is:\n\n```viml\nlet g:julia_cmdline = ['julia', '--startup-file=no', '--history-file=no', '-e', '\n\\       using LanguageServer;\n\\       using Pkg;\n\\       import StaticLint;\n\\       import SymbolServer;\n\\       env_path = dirname(Pkg.Types.Context().env.project_file);\n\\       debug = false;\n\\\n\\       server = LanguageServer.LanguageServerInstance(stdin, stdout, debug, env_path, \"\", Dict());\n\\       server.runlinter = true;\n\\       run(server);\n\\   ']\n```\n\nYou can replace the first command line argument (`'julia'`) with an absolute\npath, if `julia` isn't in your `$PATH`.\nWith the above list in your vimrc, you can set `'cmdline'` in\n`g:ycm_language_server` to just `g:julia_cmdline`.\n\nJulia server *does* support configuration via the extra conf, but it doesn't\nseem to be documented anywhere.\n\n# Lua\n\nUses [lua-language-server][].\n\nQuick testing suggests that:\n\n- It returns snippets even though YCM explicitly opted out, meaning completions\n  don't work unless you use [Ben's Fork][puremourning-fork]\n- It violates a number of other items of the protocol other than that such as\n  missing mandatory fields.\n- Signature help doesn't seem to work.\n\nHowever, it looks like diagnostics and GoTo work.\n\nThe command line requeired depends on your OS:\n\n* Windows: `/path/to/lua-language-server/bin/Windows/lua-language-server.exe`\n* Linux: `/path/to/lua-language-server/bin/Linux/lua-language-server`\n* macOS: `/path/to/lua-language-server/bin/macOS/lua-language-server`\n\nThere is one command line argument. It needs to be the absolute path to\n`/path/to/lua-language-server/main.lua`.\n\nThe `install.py` for Lua downloads the pre-built visual studio code extension,\nbut you can build `lua-language-server` yourself easily if you have `ninja`\ninstalled:\n\n```\ngit clone https://github.com/sumneko/lua-language-server\ncd lua-language-server\ncd 3rd/luamake\nninja ninja/\u003cyour os\u003e.ninja\ncd ../../\n./3rd/luamake/luamake rebuild\n```\n\nThis will put the binaries in `bin/\u003cyour os\u003e`.\n\n# Zig\n\nUses [zls](https://github.com/zigtools/zls)\n\nFor this to work sometimes, one needs to run the zls executable to create a user/global config json file\nby running the executable in /zig/zls/zig-out/bin/zls after running the install.py.\n[NOTE] if your workspace directory has a zls.json file, it should would also work.\n\n# CSS\n\nUses [css](https://github.com/hrsh7th/vscode-langservers-extracted)\n\n# PHP\n\nUses [phpactor](https://phpactor.readthedocs.io/en/master/index.html).\n\n# Crystal\n\nUses [Crystalline](https://github.com/elbywan/crystalline) as an LSP server and\n[vim-crystal](https://github.com/vim-crystal/vim-crystal.git) to determine file\ntype.\n\nKeep in mind, that Crystalline version **must** match crystal version (see\ndetails on crystalline page).\n\nThe configuration is pretty straightforward. Add this to your .vimrc:\n```viml\nlet g:ycm_language_server =\n  \\ [\n  \\   {\n  \\     'name': 'crystal',\n  \\     'cmdline': [ 'crystalline'],\n  \\     'project_root_files' : [ 'shard.yml' ],\n  \\     'filetypes': [ 'crystal' ]\n  \\   }\n  \\ ]\n```\nPlace crystalline in the path (i.e. /usr/local/bin) or use absolute path\nin the example above..\n\n# Astro\n\nIn addition to defining `g:ycm_language_server` block as shown in\n[`astro/snippet.vim`](astro/snippet.vim) this LSP requires `.ycm_extra_conf.py`\nto pass Language Server `initializationOptions` pointing to a directory\ncontaining either `typescript.js` or `tsserverlibrary.js` file, such as\n`node_modules/typescript/lib`, via `typescript.tsdk` key/value address, eg.\n\n```python\nimport os\n\ndef Settings( **kwargs ):\n    current_directory = os.path.abspath(os.path.curdir)\n    if kwargs[ 'language' ] == 'astro':\n        configs = {\n            'ls': {\n                'typescript': {\n                    'tsdk':  f\"{current_directory}/node_modules/typescript/lib\"\n                },\n            },\n        }\n\n        return configs\n```\n\n...  Authors of Astro Language Server recommend installing `prettier` plugins\ntoo, so adding the following to your `npm init` rituals may be a good idea;\n\n```bash\nnpm install --save-dev typescript prettier prettier-plugin-astro @astrojs/ts-plugin\n```\n\nFinally, hopefully for now, adding the `@astrojs/ts-plugin` to your project's\n`tsconfig.json` may be necessary to enable all features of Astro LS\n\n```json\n{\n  \"compilerOptions\": {\n    \"plugins\": [\n      {\n        \"name\": \"@astrojs/ts-plugin\"\n      }\n    ]\n  }\n}\n```\n\n# Postgres\n\nWithin the root of a project running `postgrestools init` is recommend by\n[Configuration](https://pgtools.dev/#configuration) documentation to create a\n`postgrestools.jsonc` file, then editing that file for your database setup\nseems required to make full use of this Language Server's tooling.\n\n# Jai\n\nThis is using [Jails](https://github.comSogoCZE/Jails), which is very much\n\"work in progress\", so many things aren't fully working yet, but it's easy\nenough to set up.\n\nYou may need to create a `jails.json` in your project root to tell Jails where\nto find modules.\n\nExample `jails.json`:\n\n```json\n{\n    \"workspaces\": [\n        {\n            \"entry\": \"/foo/main.jai\",\n            \"local_modules\": \"/modules\"\n        }\n    ]\n}\n```\n\n# Vala\n\nInstalling [vala-language-server](https://github.com/vala-lang/vala-language-server) from\nsource automatically takes a long time\nand would be difficult to get right generically.\n\nPlease install `vala-language-server` through your system package manager\nbefore enabling vala support through YCM.\n\nFor formatting support you will need `uncrustify` as well.\n\n# Known Issues\n\n- `yaml` completer completions don't work because the server [bugs][yaml-bug]\n  always returns snippets, even though ycmd claims not to support them.\n  Validation works though.\n- `json` completer completions don't work because the server [bugs][json-bug]\n  always returns snippets, even though ycmd claims not to support them.\n  Validation works though.\n- `lua` - yet another completer that returns snippets even if client doesn't\n  support them.\n\nThere is highly experimental (essentially unsupported) support for snippet\ncompletions in [Ben's Fork][puremourning-fork] of YCM. For example, the \nfollowing makes json work with that fork:\n\n```viml\n    \\   {\n    \\     'name': 'json',\n    \\     'cmdline': [ 'node', s:lsp_dir . '/json/node_modules/.bin/vscode-json-languageserver', '--stdio' ],\n    \\     'filetypes': [ 'json' ],\n    \\     'capabilities': #{ textDocument: #{ completion: #{ completionItem: #{ snippetSupport: v:true } } } },\n    \\   },\n```\n\n\n[yaml-bug]: https://github.com/redhat-developer/yaml-language-server/issues/161\n[json-bug]: https://github.com/vscode-langservers/vscode-json-languageserver-bin/issues/2\n[rbenv]: https://github.com/rbenv/rbenv\n[d-conf]: https://github.com/Pure-D/serve-d/blob/master/source/served/types.d#L64\n[kt-conf]: https://github.com/fwcd/KotlinLanguageServer/blob/master/server/src/main/kotlin/org/javacs/kt/KotlinWorkspaceService.kt#L81\n[kt-issue]: https://github.com/ycm-core/lsp-examples/issues/5\n[hie-pr]: https://github.com/haskell/haskell-ide-engine/pull/1424\n[hie-install]: https://github.com/haskell/haskell-ide-engine#installation\n[metals-pr]: https://github.com/scalameta/metals/issues/1057\n[lua-language-server]: https://marketplace.visualstudio.com/items?itemName=sumneko.lua\n[puremourning-fork]: https://github.com/puremourning/YouCompleteMe\n[hie-not-developing]: https://stackoverflow.com/questions/64087188/what-is-the-current-situation-for-using-vim-as-ide-for-haskell-on-archlinux/\n[haskell-language-server]: https://github.com/haskell/haskell-language-server\n[hls-install]: https://github.com/haskell/haskell-language-server#installation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fycm-core%2Flsp-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fycm-core%2Flsp-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fycm-core%2Flsp-examples/lists"}