镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Configuration in standalone setup #154

Closed

Description

@gustavo-hms

Hello! How can I configure this server? For example, to set the behaviour of diagnostics? I couldn't find any documentation for it.

I'm on a standalone setup, using it with coc plugin for neovim.

Thanks!

Activity

  1. added
    Non VS CodeThe server is communicating with a client that is not VS Code
    on Apr 3, 2020
  2. sumneko commented on Apr 3, 2020

    @sumneko
    Collaborator

    In the standard of LSP, the server obtains the configuration through Configuration.
    For VSCode, the configuration is declared in package.json.
    However, LSP does not specify how the language client resolves the settings, so neovim needs to refer to the package. JSON file for its own configuration.
    In the future, it may be considered to parse a specific configuration file directly by the language server.

  3. gustavo-hms commented on Apr 7, 2020

    @gustavo-hms
    Author

    Thank you for your response!

    I've found that writing

    "Lua.diagnostics.disable": [
        "lowercase-global"
    ]

    to coc-settings.json does the job in neovim with coc plugin.

    Anyway, is there a place (apart from the package.json you linked above) where we can find the list of options to configure with some description explaining them? I mean, one more or less can guess the meaning of each option and the way to set it by looking at this json file, but it's much easier if there is, for instance, a wiki page for them.

    But I understand it can be a big and tedious work. So it's OK if you don't have the time to write it.

    Thanks again!

  4. sumneko commented on Apr 7, 2020

    @sumneko
    Collaborator

    It's a good idea to explain the configuration options on the wiki, I will do it in these days. Thank you for your advice!

  5. dseeni commented on Apr 29, 2020

    @dseeni

    Would love to hear details about how you set things up? I am on windows and using neovim and coc @gustavo-hms, even if not on windows, please let us know.

  6. gustavo-hms commented on Apr 29, 2020

    @gustavo-hms
    Author

    Sure! Follow these steps:

    For example, mine has the following json:

    {
        ... many unrelated options here ...
        "languageserver": {
            "lua": {
    	    "cwd": "full path of lua-language-server directory", (not sure this one is really necessary)
    	    "command": "full path to lua-language-server executable",
    	    "args": ["-E", "-e", "LANG=en", "[full path of lua-language-server directory]/main.lua"],
    	    "filetypes": ["lua"],
    	    "rootPatterns": [".git/"]
            }
        },
        "Lua.diagnostics.disable" : [
            "lowercase-global"
        ]
    }
    
  7. ckipp01 commented on Apr 29, 2020

    @ckipp01

    @gustavo-hms thanks for the instructions! I just tested this out locally, and when I build locally for macOS, the [full path of the lua-language-server directory] like you have mentioned doesn't have a main.lua in it, so I'm getting an error there that the file or directory doesn't exist. Should there be a main.lua there that I don't have for some reason?

  8. gustavo-hms commented on Apr 29, 2020

    @gustavo-hms
    Author

    Well, the [full path of the lua-language-server directory] is not the path of the executable, but the path of the base directory of the lua-language-server project (as you clone from github). So, the main.lua file refers to this file: https://github.com/sumneko/lua-language-server/blob/master/main.lua

  9. gustavo-hms commented on Apr 29, 2020

    @gustavo-hms
    Author

    By the way, for those interested, I also managed to configure Kakoune with kak-lsp. You have to add the following lines to ~/.config/kak-lsp/kak-lsp.toml:

    [language.lua]
    filetypes = ["lua"]
    roots = [".git/"]
    command = "full path to lua-language-server executable"
    args = ["-E", "[full path of lua-language-server directory]/main.lua"]

    I couldn't set lua-language-server options like the lowercase-global above though. I didn't find how.

  10. ckipp01 commented on Apr 30, 2020

    @ckipp01

    Well, the [full path of the lua-language-server directory] is not the path of the executable, but the path of the base directory of the lua-language-server project (as you clone from github). So, the main.lua file refers to this file: /main.lua@master

    ahhh duh, I interpreted that as the directory that directly contained the executable. I changed it and now it works fine. Thanks a ton!

  11. added a commit that references this issue on May 25, 2020
  12. kkharji commented on Sep 25, 2020

    @kkharji

    Yah I failed to get it working with coc.nvim: here is my config:

        let lua_lsp = glob('~/.local/lua-language-server')
        if len(lua_lsp)
            call coc#config('languageserver', {
                \ 'lua-language-server': {
                \     'cwd': lua_lsp,
                \     'command': lua_lsp . '/bin/Linux/lua-language-server',
                \     'args': ['-E', '-e', 'LANG="LANG=en","', lua_lsp . '/main.lua'],
                \     'filetypes': ['lua'],
                \ }
            \ })
        endif
    
    

    Any suggestions, thanks

  13. gustavo-hms commented on Sep 28, 2020

    @gustavo-hms
    Author

    Hi, @tami5 !

    I'm not on my machine right now to test your configuration, but may be you could try replacing:

           call coc#config('languageserver', {
                \ 'lua-language-server': {
                \     'cwd': lua_lsp,

    with:

           call coc#config('languageserver', {
                \ 'lua': {
                \     'cwd': lua_lsp,

    Tell me if it helps.

  14. kkharji commented on Oct 1, 2020

    @kkharji

    @gustavo-hms thanks so much for taking interest in my issue. same thing, here's the output of the error message

    /home/tami/.local/lua-language-server/bin/Linux/lua-language-server: (command line):1: unfinished string near <eof>
    [Error  - 11:18:17 PM] /home/tamibam/.local/lua-language-server/bin/Linux/lua-language-server exited with code: 1
    
        let lua_lsp = glob('~/.local/lua-language-server')
        if len(lua_lsp)
            call coc#config('languageserver', {
                \ 'lua': {
                \     'cwd': lua_lsp,
                \     'command': lua_lsp . '/bin/Linux/lua-language-server',
                \     'args': ['-E', '-e', 'LANG="LANG=en","', lua_lsp . '/main.lua'],
                \     'filetypes': ['lua'],
                \ }
            \ })
        endif
    
  15. flamendless commented on Oct 28, 2020

    @flamendless

    Hi, in vim, do we still need to do the json-schema part? Here is the output of CocInfo for me (without doing the json-schema) part.

    ## versions
    
    vim version: VIM - Vi IMproved 8.2 8020814
    node version: v14.5.0
    coc.nvim version: 0.0.79-8230b63641
    coc.nvim directory: /home/brbl/.vim/plugged/coc.nvim
    term: dumb
    platform: linux
    
    ## Log of coc.nvim
    
    2020-10-28T20:42:02.071 INFO (pid:3085631) [services] - registered service "languageserver.lua"
    2020-10-28T20:42:02.088 INFO (pid:3085631) [services] - lua state change: stopped => starting
    2020-10-28T20:42:02.095 INFO (pid:3085631) [plugin] - coc.nvim 0.0.79-8230b63641 initialized with node: v14.5.0 after 191ms
    2020-10-28T20:42:02.130 INFO (pid:3085631) [language-client-index] - Language server "languageserver.lua" started with 3085646
    2020-10-28T20:42:02.150 ERROR (pid:3085631) [language-client-client] - connection error: Error: write EPIPE
        at afterWriteDispatched (internal/stream_base_commons.js:156:25)
        at writeGeneric (internal/stream_base_commons.js:147:3)
        at Socket._writeGeneric (net.js:785:11)
        at Socket._write (net.js:797:8)
        at writeOrBuffer (_stream_writable.js:352:12)
        at Socket.Writable.write (_stream_writable.js:303:10)
        at StreamMessageWriter.write (/home/brbl/.vim/plugged/coc.nvim/build/index.js:18391:27)
        at /home/brbl/.vim/plugged/coc.nvim/build/index.js:17539:35
        at new Promise (<anonymous>)
        at Object.sendRequest (/home/brbl/.vim/plugged/coc.nvim/build/index.js:17529:26)
        at Object.initialize (/home/brbl/.vim/plugged/coc.nvim/build/index.js:74405:44)
        at LanguageClient.doInitialize (/home/brbl/.vim/plugged/coc.nvim/build/index.js:76521:27)
        at LanguageClient.initialize (/home/brbl/.vim/plugged/coc.nvim/build/index.js:76508:25)
        at /home/brbl/.vim/plugged/coc.nvim/build/index.js:76439:25 {
      errno: -32,
      code: 'EPIPE',
      syscall: 'write'
    } undefined
    2020-10-28T20:42:02.210 INFO (pid:3085631) [services] - lua state change: starting => stopped
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Non VS CodeThe server is communicating with a client that is not VS Code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions