All Projects → ycm-core → Lsp Examples

ycm-core / Lsp Examples

Licence: apache-2.0
Use any language server with YouCompleteMe.

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Lsp Examples

Solid
Книга о принципах объектно-ориентированного дизайна SOLID
Stars: ✭ 280 (+536.36%)
Mutual labels:  lsp
Lsp Java
lsp-mode ❤️ java
Stars: ✭ 446 (+913.64%)
Mutual labels:  lsp
Jupyterlab Lsp
Coding assistance for JupyterLab (code navigation + hover suggestions + linters + autocompletion + rename) using Language Server Protocol
Stars: ✭ 796 (+1709.09%)
Mutual labels:  lsp
Kak Lsp
Kakoune Language Server Protocol Client
Stars: ✭ 363 (+725%)
Mutual labels:  lsp
Lspsaga.nvim
neovim lsp plugin
Stars: ✭ 379 (+761.36%)
Mutual labels:  lsp
Terraform Lsp
Language Server Protocol for Terraform
Stars: ✭ 469 (+965.91%)
Mutual labels:  lsp
Coc Flutter
flutter support for (Neo)vim
Stars: ✭ 259 (+488.64%)
Mutual labels:  lsp
Lsp
Client implementation of the Language Server Protocol for Sublime Text
Stars: ✭ 1,018 (+2213.64%)
Mutual labels:  lsp
Monaco Languageclient
NPM module to connect Monaco editor with language servers
Stars: ✭ 419 (+852.27%)
Mutual labels:  lsp
Lsp Ui
UI integrations for lsp-mode
Stars: ✭ 756 (+1618.18%)
Mutual labels:  lsp
Erlang ls
The Erlang Language Server
Stars: ✭ 363 (+725%)
Mutual labels:  lsp
Terraform Ls
Terraform Language Server
Stars: ✭ 389 (+784.09%)
Mutual labels:  lsp
Clojure Lsp
Language Server (LSP) for Clojure
Stars: ✭ 547 (+1143.18%)
Mutual labels:  lsp
Elm Language Server
Language server implementation for Elm
Stars: ✭ 298 (+577.27%)
Mutual labels:  lsp
Dap Mode
Emacs ❤️ Debug Adapter Protocol
Stars: ✭ 809 (+1738.64%)
Mutual labels:  lsp
Vim Language Server
VImScript language server, LSP for vim script
Stars: ✭ 264 (+500%)
Mutual labels:  lsp
Typescript Language Server
TypeScript & JavaScript Language Server
Stars: ✭ 462 (+950%)
Mutual labels:  lsp
Protocol Buffers Language Server
[WIP] Protocol Buffers Language Server
Stars: ✭ 44 (+0%)
Mutual labels:  lsp
Thinkvim
Vim configuration in the 21st century
Stars: ✭ 832 (+1790.91%)
Mutual labels:  lsp
Kotlin Language Server
Intelligent Kotlin support for any editor/IDE using the Language Server Protocol
Stars: ✭ 650 (+1377.27%)
Mutual labels:  lsp

Overview

This repo includes a simple way to install some language servers that might work with YouCompleteMe (strictly ycmd).

This repo comes with no warranty, and these engines are not officially supported by YCM, though they should work for the most part.

Languages Tested

Working:

  • Angular
  • Bash
  • D
  • Dart
  • Dockerfile
  • Godot (gdscript)
  • Groovy
  • Kotlin
  • PHP
  • Ruby
  • Vim (vimscript)
  • Vue

Broken or partially working:

  • JSON
  • YAML
  • Lua

See also:

Quick start

Assuming you installed this repo in /path/to/this/directory:

  • Decide which languages you want. Each language is a directory in this repo.
  • Run python3 ./install.py --enable-LANG1 --enable-LANG2 .... Replace LANG1/LANG2 etc. with the language dirs. e.g. ./install.py --enable-dart --enable-bash. You can also use --all and --disable-LANG.
  • Add the line to your vimrc that it tells you to, this will be similar to:
source /path/to/this/directory/vimrc.generated
  • Optionally: edit vimrc.generated to customise g:ycm_language_server

  • NOTE: YCM will regard the path of .ycm_extra_conf.py as root path of project folder. So please make sure you put your .ycm_extra_conf.py at right place (root of current project)

Configuration

The g:ycm_language_server option is used to tell YCM (strictly, ycmd) to use its 'generic' language server completer. It's a list of dictionaries with the following keys:

  • 'name' (string): Name of the language server
  • 'filetypes' (list): List of Vim filetypes to use this language server for
  • 'cmdline' (list): List of words forming a command line to execute. Note: must be a list, even if it has only one element (such as [ 'executable' ]. If not supplied, no server is started and a port must be supplied.
  • 'port' (number): A TCP port on localhost to connect to if stdio is not possible.
  • 'project_root_files' (list, optional): List of filename to search for when trying to determine the 'root' of the project. THis is useful for languages or language servers which don't automatically detect the 'workspace' root.

For full documentation, please see the YouCompleteMe docs.

Purescript

Ycmd currently doesn't support showMessageRequest, so users need to manually build their projects on the command line before starting the server. To do this execute pulp build in the project root.

Scala

Ycmd currently doesn't support showMessageRequest, so users need to "import build" manually. Unlike purescript, for scala, this can be done in the editor by executing :YcmCompleter ExecuteCommand build-import. For this operation to succeed sbt and bloop need to be in the $PATH. metals also requires java 8.

For completions to work make sure the version of metals has this bug fix.

Haskell

haskell-ide-engine is not actively being developed anymore, in favour of haskell-language-server (installation instructions).

Fortran

The server causes a spurious error:

  • fortls doesn't support didChangeConfiguration.

This error can be ignored, as they don't interfere with normal work of ycmd/fortls.

Ruby

You need to be running a version of ruby that the parser understands: https://github.com/whitequark/parser#compatibility-with-ruby-mri

Recommend running in rbenv for that:

$ rbenv shell 2.3.8
$ cd ruby
$ ./install
$ vim test/test.rb

D

There is a number of external dependencies that you will want to install:

  • libphobos/liblphobos - the D standard library
  • dmd - the D compiler
  • dscanner - at the very least responsible for diagnostics
  • dcd - the D compiler daemon
  • Potentially dfmt - serve-d seems to be able to format code even without it.
  • dub - the D package manager

On top of that, you will want to configure the server, at least to let serve-d know about your modules. The configuration is done through ycmd's extra confs and the full list of serve-d's configuration options can be found here.

Note that the server executable on Windows is called serve-d.exe.

Godot

Godot must be running and you must go to Project -> Project Settings -> Global and set Language Server to On.

If Godot is closed or restarted, you might need to force YCM to reconnect (this isn't automatic). Use :YcmCompleter RestartServer to reconnect.

You can check the status of the connection with :YcmDebugInfo.

Recommend vim-godot for syntax, etc. (don't believe the hype about using other completion systems though, of course).

Kotlin

For whatever reason, the server expects you to have maven in your PATH and, just like serve-d, kotlin-language-server has its own configuration.

The server executable is actually a shell script and the build process produces server for Linux and server.bat for Windows.

Make sure to put a .ycm_extra_conf.py file in the root of your project, otherwise the language server may fail.

Julia

The command line for starting the server is:

let g:julia_cmdline = ['julia', '--startup-file=no', '--history-file=no', '-e', '
\       using LanguageServer;
\       using Pkg;
\       import StaticLint;
\       import SymbolServer;
\       env_path = dirname(Pkg.Types.Context().env.project_file);
\       debug = false;
\
\       server = LanguageServer.LanguageServerInstance(stdin, stdout, debug, env_path, "", Dict());
\       server.runlinter = true;
\       run(server);
\   ']

You can replace the first command line argument ('julia') with an absolute path, if julia isn't in your $PATH. With the above list in your vimrc, you can set 'cmdline' in g:ycm_language_server to just g:julia_cmdline.

Julia server does support configuration via the extra conf, but it doesn't seem to be documented anywhere.

Lua

Uses lua-language-server.

Quick testing suggests that:

  • It returns snippets even though YCM explicitly opted out, meaning completions don't work unless you use Ben's Fork
  • It violates a number of other items of the protocol other than that such as missing mandatory fields.
  • Signature help doesn't seem to work.

However, it looks like diagnostics and GoTo work.

The command line requeired depends on your OS:

  • Windows: /path/to/lua-language-server/bin/Windows/lua-language-server.exe
  • Linux: /path/to/lua-language-server/bin/Linux/lua-language-server
  • macOS: /path/to/lua-language-server/bin/macOS/lua-language-server

There is one command line argument. It needs to be the absolute path to /path/to/lua-language-server/main.lua.

The install.py for Lua downloads the pre-built visual studio code extension, but you can build lua-language-server yourself easily if you have ninja installed:

git clone https://github.com/sumneko/lua-language-server
cd lua-language-server
cd 3rd/luamake
ninja ninja/<your os>.ninja
cd ../../
./3rd/luamake/luamake rebuild

This will put the binaries in bin/<your os>.

PHP

Uses Serenata.

Requires some configuration to work. Here's the minimal .ycm_extra_conf.py:

import os
ROOT = os.path.dirname( os.path.abspath( __file__ ) )

def Settings( **kwargs ):
  return {
    'ls': {
      'configuration': {
        "uris": [
          f"file://{ ROOT }"
        ],
        "indexDatabaseUri": f"file://{ ROOT }/.serenata/index.sqlite",
        "phpVersion": 7.2,
        "fileExtensions": [
          "php"
        ]
      }
    }
  }

Known Issues

  • yaml completer completions don't work because the server bugs always returns snippets, even though ycmd claims not to support them. Validation works though.
  • json completer completions don't work because the server bugs always returns snippets, even though ycmd claims not to support them. Validation works though.
  • lua - yet another completer that returns snippets even if client doesn't support them.

There is highly experimental (essentially unsupported) support for snippet completions in Ben's Fork of YCM. For example, the following makes json work with that fork:

    \   {
    \     'name': 'json',
    \     'cmdline': [ 'node', s:lsp_dir . '/json/node_modules/.bin/vscode-json-languageserver', '--stdio' ],
    \     'filetypes': [ 'json' ],
    \     'capabilities': #{ textDocument: #{ completion: #{ completionItem: #{ snippetSupport: v:true } } } },
    \   },
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].