Git Product home page Git Product logo

coc-lua's Introduction

coc-lua

test


Lua language server extension using LuaLS/lua-language-server for coc.nvim.

Install

In your vim/neovim, run command:

:CocInstall coc-lua

Features

See

Commands

Key Description
lua.version Print extension version
lua.update Update language server

Settings

Key Description Default
lua.enable set to false to disable lua language server. true

Trigger completion in coc-settings.json to get complete list.

LuaLS/lua-language-server

Key Description Default
Lua.addonManager.enable Set the on/off state for the addon manager. true
Lua.codeLens.enable Enable code lens.
Lua.completion.autoRequire When the input looks like a file name, automatically require this file. true
Lua.completion.callSnippet Shows function call snippets. "Disable"
Lua.completion.displayContext Previewing the relevant code snippet of the suggestion may help you understand the usage of the suggestion. The number set indicates the number of intercepted lines in the code fragment. If it is set to 0, this feature can be disabled.
Lua.completion.enable Enable completion. true
Lua.completion.keywordSnippet Shows keyword syntax snippets. "Replace"
Lua.completion.postfix The symbol used to trigger the postfix suggestion. "@"
Lua.completion.requireSeparator The separator used when require. "."
Lua.completion.showParams Display parameters in completion list. When the function has multiple definitions, they will be displayed separately. true
Lua.completion.showWord Show contextual words in suggestions. "Fallback"
Lua.completion.workspaceWord Whether the displayed context word contains the content of other files in the workspace. true
Lua.diagnostics.disable Disabled diagnostic (Use code in hover brackets). []
Lua.diagnostics.disableScheme Do not diagnose Lua files that use the following scheme. ["git"]
Lua.diagnostics.enable Enable diagnostics. true
Lua.diagnostics.globals Defined global variables. []
Lua.diagnostics.ignoredFiles How to diagnose ignored files. "Opened"
Lua.diagnostics.libraryFiles How to diagnose files loaded via Lua.workspace.library. "Opened"
Lua.diagnostics.unusedLocalExclude Do not diagnose unused-local when the variable name matches the following pattern. []
Lua.diagnostics.workspaceDelay Latency (milliseconds) for workspace diagnostics. 3000
Lua.diagnostics.workspaceEvent Set the time to trigger workspace diagnostics. "OnSave"
Lua.diagnostics.workspaceRate Workspace diagnostics run rate (%). Decreasing this value reduces CPU usage, but also reduces the speed of workspace diagnostics. The diagnosis of the file you are currently editing is always done at full speed and is not affected by this setting. 100
Lua.doc.packageName Treat specific field names as package, e.g. m_* means XXX.m_id and XXX.m_type are package, witch can only be accessed in the file where the definition is located. []
Lua.doc.privateName Treat specific field names as private, e.g. m_* means XXX.m_id and XXX.m_type are private, witch can only be accessed in the class where the definition is located. []
Lua.doc.protectedName Treat specific field names as protected, e.g. m_* means XXX.m_id and XXX.m_type are protected, witch can only be accessed in the class where the definition is located and its subclasses. []
Lua.format.defaultConfig The default format configuration. Has a lower priority than .editorconfig file in the workspace.
Read formatter docs to learn usage.
{}
Lua.format.enable Enable code formatter. true
Lua.hint.arrayIndex Show hints of array index when constructing a table. "Auto"
Lua.hint.await If the called function is marked ---@async, prompt await at the call. true
Lua.hint.enable Enable inlay hint.
Lua.hint.paramName Show hints of parameter name at the function call. "All"
Lua.hint.paramType Show type hints at the parameter of the function. true
Lua.hint.semicolon If there is no semicolon at the end of the statement, display a virtual semicolon. "SameLine"
Lua.hint.setType Show hints of type at assignment operation.
Lua.hover.enable Enable hover. true
Lua.hover.enumsLimit When the value corresponds to multiple types, limit the number of types displaying. 5
Lua.hover.expandAlias Whether to expand the alias. For example, expands `---@alias myType boolean numberappears asboolean
Lua.hover.previewFields When hovering to view a table, limits the maximum number of previews for fields. 50
Lua.hover.viewNumber Hover to view numeric content (only if literal is not decimal). true
Lua.hover.viewString Hover to view the contents of a string (only if the literal contains an escape character). true
Lua.hover.viewStringMax The maximum length of a hover to view the contents of a string. 1000
Lua.misc.executablePath Specify the executable path in VSCode.
Lua.misc.parameters Command line parameters when starting the language server in VSCode. []
Lua.runtime.fileEncoding File encoding. The ansi option is only available under the Windows platform. "utf8"
Lua.runtime.meta Format of the directory name of the meta files. "${version} ${language} ${encoding}"
Lua.runtime.nonstandardSymbol Supports non-standard symbols. Make sure that your runtime environment supports these symbols. []
Lua.runtime.path When using require, how to find the file based on the input name.
Setting this config to ?/init.lua means that when you enter require 'myfile', ${workspace}/myfile/init.lua will be searched from the loaded files.
if runtime.pathStrict is false, ${workspace}/**/myfile/init.lua will also be searched.
If you want to load files outside the workspace, you need to set Lua.workspace.library first.
["?.lua","?/init.lua"]
Lua.runtime.pathStrict When enabled, runtime.path will only search the first level of directories, see the description of runtime.path.
Lua.runtime.plugin Plugin path. Please read wiki to learn more.
Lua.runtime.pluginArgs Additional arguments for the plugin. []
Lua.runtime.special The custom global variables are regarded as some special built-in variables, and the language server will provide special support
The following example shows that 'include' is treated as' require '.
json<br>"Lua.runtime.special" : {<br> "include" : "require"<br>}<br>
{}
Lua.runtime.unicodeName Allows Unicode characters in name.
Lua.runtime.version Lua runtime version. "Lua 5.4"
Lua.semantic.annotation Semantic coloring of type annotations. true
Lua.semantic.enable Enable semantic color. You may need to set editor.semanticHighlighting.enabled to true to take effect. true
Lua.semantic.keyword Semantic coloring of keywords/literals/operators. You only need to enable this feature if your editor cannot do syntax coloring.
Lua.semantic.variable Semantic coloring of variables/fields/parameters. true
Lua.signatureHelp.enable Enable signature help. true
Lua.spell.dict Custom words for spell checking. []
Lua.type.castNumberToInteger Allowed to assign the number type to the integer type. true
Lua.type.weakNilCheck When checking the type of union type, ignore the nil in it.

When this setting is false, the `number
niltype cannot be assigned to thenumbertype. It can be withtrue`.
Lua.type.weakUnionCheck Once one subtype of a union type meets the condition, the union type also meets the condition.

When this setting is false, the `number
booleantype cannot be assigned to thenumbertype. It can be withtrue`.
Lua.window.progressBar Show progress bar in status bar. true
Lua.window.statusBar Show extension status in status bar. true
Lua.workspace.checkThirdParty Automatic detection and adaptation of third-party libraries, currently supported libraries are:

* OpenResty
* Cocos4.0
* LÖVE
* LÖVR
* skynet
* Jass
true
Lua.workspace.ignoreDir Ignored files and directories (Use .gitignore grammar). [".vscode"]
Lua.workspace.ignoreSubmodules Ignore submodules. true
Lua.workspace.library In addition to the current workspace, which directories will load files from. The files in these directories will be treated as externally provided code libraries, and some features (such as renaming fields) will not modify these files. []
Lua.workspace.maxPreload Max preloaded files. 5000
Lua.workspace.preloadFileSize Skip files larger than this value (KB) when preloading. 500
Lua.workspace.useGitIgnore Ignore files list in .gitignore . true
Lua.workspace.userThirdParty Add private third-party library configuration file paths here, please refer to the built-in configuration file path []

Development

  1. Run npm run build or npm run build:watch
  2. Link extension: npm run link / npm run unlink

Credit

License

MIT © Josa Gesell

coc-lua's People

Contributors

bratekarate avatar dependabot-support avatar github-actions[bot] avatar josa42 avatar wsw0108 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

coc-lua's Issues

sumneko installation fail

I'm trying to use the sumneko experimental option.

I installed coc and coc-lua.

In my .coc-config

{
    "lua.useSumnekoLs": true
}

When I open vim, It says "Installing.."
image

And 30 seconds later, It fails
image
[coc.nvim] Server lua failed to start: Launching server "lua" using command /home/aganm/.config/coc/extensins/coc-lua-dat/atools/sumneko_lua/bin/macOS/lua-language-server failed.

It says macOS, could this be the problem?

I'm using arch linux, vim 8.2.

config to bypass and auto-update language server

Most other COC plugins have an option to configure their dependent language server update checking (ex: coc-rust-analyzer). It would be great for those of us that want it to bypass the prompt and just auto update the language server when an update is detected.

Problem using coc-lua on Windows

Hi, I just installed your plugin on Windows 10 using :CocInstall coc-lua, everything seems fine but whenever I open a Lua file I get the following error:
[coc.nvim] Error on active extension coc-lua: Error: ENOENT: no such file or directory, mkdir 'C:\Users\thomas.versteeg\AppData\Local\coc\extensions\coc-lua-data\tools\bin'

How can I fix this? This is the NeoVim version I'm using:

NVIM v0.3.8
Build type: RelWithDebInfo
LuaJIT 2.0.5
Compilation: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe /DWIN32 /D_WINDOWS /W3 /MD /Zi /O2 /Ob1 /DNDEBUG -DMIN_LOG_LEVEL=3 /W3 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -DWIN32 -D_WIN32_WINNT=0x0600 -DINCLUDE_GENERATED_DECLARATIONS -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -IC:/projects/neovim/build/config -IC:/projects/neovim/src -IC:/projects/neovim/.deps/usr/include -IC:/projects/neovim/build/src/nvim/auto -IC:/projects/neovim/build/include
Compiled by appveyor@APPVYR-WIN

Features: -acl +iconv -jemalloc +tui

Server fail to start

The server apparently can't start, I get this error:

Error: No results matching query were found for Lua 5.4. To check if it is available for other Lua versions, use --check-lua-versions.
[coc.nvim] Server lua failed to start: Launching server "lua" using command /home/marco/.config/coc/extensions/coc-lua-data/tools/bin/lua-lsp failed.

I tried to check the folder but my bin folder is empty, I don't have anything named lua-lsp inside of it.

Add predefined globals?

I would like to use this server for roblox lua programming, which is mostly lua but with some differences, namely a set of global variables.

Is it possible to make the language server ignore a list of predefined variables?

Function can not auto add brackets

whether coc-lua can auto complete function brackets like coc-pyright, or i set coc-setting.json wrong :(
my mini setting:

{
"Lua.diagnostics.globals": ["vim"]
}

coc-lua just doesn't work

After installing I wasn't able to get autocompletion.

Here is what CocInfo says

vim version: NVIM v0.4.4                                                                                                
node version: v15.1.0                                                                                                   
coc.nvim version: 0.0.79-5c0a63e29a                                                                                     
coc.nvim directory: /home/horseinthesky/.local/share/nvim/plugged/coc.nvim                                              
term: xterm-256color                                                                                                    
platform: linux                                                                                                         
                                                                                                                        
## Log of coc.nvim                                                                                                      
                                                                                                                        
2020-11-23T23:30:41.908 ERROR (pid:314496) [extensions] - Error on createExtension coc-lua from /home/horseinthesky/.config/coc/extensions/node_modules/coc-lua/lib/extension.js Error: Cannot find module 'unzipper'
Require stack:                                                                                                          
- /home/horseinthesky/.config/coc/extensions/node_modules/coc-lua/lib/utils/installer.js                                
- /home/horseinthesky/.config/coc/extensions/node_modules/coc-lua/lib/utils/tools.js                                    
- /home/horseinthesky/.config/coc/extensions/node_modules/coc-lua/lib/extension.js                                      
- /home/horseinthesky/.config/coc/extensions/node_modules/coc-lua/lib/extension.js                                      
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:900:15)                                       
    at Function.Module._load (node:internal/modules/cjs/loader:745:27)                                                  
    at Module.require (node:internal/modules/cjs/loader:972:19)                                                         
    at req (/home/horseinthesky/.local/share/nvim/plugged/coc.nvim/build/index.js:71184:21)                             
    at Object.<anonymous> (/home/horseinthesky/.config/coc/extensions/node_modules/coc-lua/lib/utils/installer.js:12:44)
    at Module._compile (/home/horseinthesky/.local/share/nvim/plugged/coc.nvim/build/index.js:71205:32)                 
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)                                         
    at Module.load (node:internal/modules/cjs/loader:948:32)                                                            
    at Function.Module._load (node:internal/modules/cjs/loader:789:14)                                                  
    at Module.require (node:internal/modules/cjs/loader:972:19)                                                         
    at req (/home/horseinthesky/.local/share/nvim/plugged/coc.nvim/build/index.js:71184:21)                             
    at Object.<anonymous> (/home/horseinthesky/.config/coc/extensions/node_modules/coc-lua/lib/utils/tools.js:10:21)    
    at Module._compile (/home/horseinthesky/.local/share/nvim/plugged/coc.nvim/build/index.js:71205:32)                 
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)                                         
    at Module.load (node:internal/modules/cjs/loader:948:32)                                                            
    at Function.Module._load (node:internal/modules/cjs/loader:789:14) {                                                
  code: 'MODULE_NOT_FOUND',                                                                                             
  requireStack: [                                                                                                       
    '/home/horseinthesky/.config/coc/extensions/node_modules/coc-lua/lib/utils/installer.js',                           
    '/home/horseinthesky/.config/coc/extensions/node_modules/coc-lua/lib/utils/tools.js',                               
    '/home/horseinthesky/.config/coc/extensions/node_modules/coc-lua/lib/extension.js',                                 
    '/home/horseinthesky/.config/coc/extensions/node_modules/coc-lua/lib/extension.js'                                  
  ]                                                                                                                       
}                                                                                                                       
2020-11-23T23:30:42.171 INFO (pid:314496) [plugin] - coc.nvim 0.0.79-5c0a63e29a initialized with node: v15.1.0 after 613ms

How to use `Lua.format.defaultConfig`?

I have read the documentation for it here, but it doesn't seem to do anything. On top of that, coc gives me lots of diagnostics about wrong types, wanting anything that isn't a string to be a string.

If I make everything a string it still doesn't work.

Here is my config. When I call coc's format action, the indents don't change to 2 wide, for instance and instead go to the default of 4.

{
    "Lua.format.enable": true,
    "Lua.format.defaultConfig": {
        "indent_style":"space",
        "indent_size":2,
        "quote_style":"double",
        "call_arg_parentheses":"keep",
        "continuation_indent":8,
        "max_line_length":120,
        "end_of_line":"unset",
        "trailing_table_separator":"always",
        "detect_end_of_line":true,
        "insert_final_newline":true,
        "space_around_table_field_list":false,
        "space_before_attribute":true,
        "space_before_function_open_parenthesis":false,
        "space_before_function_call_open_parenthesis":false,
        "space_before_closure_open_parenthesis":false,
        "space_before_function_call_single_arg": true,
        "space_before_open_square_bracket": false,
        "space_inside_function_call_parentheses":false,
        "space_inside_function_param_list_parentheses":false,
        "space_inside_square_brackets":false,
        "space_around_table_append_operator":true,
        "ignore_spaces_inside_function_call":true,
        "space_before_inline_comment": true,
        "space_around_math_operator": true,
        "space_after_comma":true,
        "space_after_comma_in_for_statement": true,
        "space_around_concat_operator":true,
        "align_call_args":true,
        "align_function_params":true,
        "align_continuous_assign_statement":true,
        "align_continuous_rect_table_field":true,
        "align_if_branch":false,
        "align_array_table":true,
        "never_indent_before_if_condition":false,
        "never_indent_comment_on_if_branch":false,
        "line_space_after_if_statement":"fixed(0)",
        "line_space_after_do_statement":"fixed(0)",
        "line_space_after_while_statement":"fixed(0)",
        "line_space_after_repeat_statement":"fixed(0)",
        "line_space_after_for_statement":"fixed(0)",
        "line_space_after_local_or_assign_statement":"max(2)",
        "line_space_after_function_statement":"min(2)",
        "line_space_after_expression_statement":"max(2)",
        "line_space_after_comment":"keep",
        "break_all_list_when_line_exceed":true,
        "auto_collapse_lines":false,
        "ignore_space_after_colon":false,
        "remove_call_expression_list_finish_comma":true,
        "end_statement_with_semicolon": "same_line"
    },
}

feature-request: ability to auto-require modules

I'm working on a project where there are test files using the busted luarock. The platform that's running the test files doesn't require that the busted functions are declared beforehand, so neovim thinks that the functions are not defined.

For example, a test file may look like:

describe("initialization", function()
  lazy_setup(function()
    -- do some lazy setup
  end)

  before_each(function()
    -- some initialization code
  end)

  it("works as expected", function()
    assert.equal(1, 1)
  end)
end)

at no point in the file is local busted = require("busted") or any definitions of the describe, before_each or lazy_setup functions assigned.

Is there a way to enable this in coc-lua that I'm missing? and if not, could this be an option? maybe as a built-in third-party configuration?

How can I disable workspace diagnostics

Hello whenever I edit a lua file in my home directory the workspace diagnostic feature is killing my cpu (my bad I have an old machine not a problem with performance) don't know what this feature does and don't care completion working fine please what option to disable it?
I tried setting "Lua.diagnostics.workspaceDelay" to -1 as the README said that a negative value would disable the feature but it didn't any help?

Failed to start server lua

I'm trying to install coc-lua on neovim in termux, when I open the lua file I get a response like in the picture, and this my config

" init.vim
let g:coc_global_extensions=['coc-lua']
// coc-setting.json
{
    lua.enable: true,
    lua.trace.server: messages
}

Screenshot_20220626-182851_Termux

Update is not working, scrapping coc-lua-data is necessary

The plugin is automatically offering updating the language server, but it's actually not updating it. It's easy to replicate, cd to ~/.config/coc/extensions/coc-lua-data and rm -rf sumneko-lua-ls, download and extract an old release (e.g. 1.21.1) from https://github.com/josa42/coc-lua-binaries/releases into sumneko-lua-ls, change the timestamp in ~/.config/coc/extensions/coc-lua-data/db.json to a random very old value. Start nvim foo.lua, an update offer for 1.21.2 will happen. Execute :CocCommand lua.update. It will show download progress (but never finishing, though it does restart analyses after a while). Close and start nvim foo.lua again, no update offer anymore, but server in ~/.config/coc/extensions/coc-lua-data/sumneko-lua-ls/version.json is still on 1.21.1 (it would be nicer to have a command to show the server version, as output for :CocCommand lua.version only display the version for coc-lua).

Besides this, the update warnings seem to be happening more often than necessary. An update offer is triggered on every change to coc-lua-binaries repository, due to the server in coc-lua-data never being updated, but I suppose that this should have been happening on every coc-lua-binaries new release only (excluding the pre-releases), not on every repo change.

FWIW, coc-rust-analyzer is one plugin that implements server updates quite nicely, and could be used as reference. Instead of asking the user to execute a command, it displays a prompt. It also downloads versions correctly.

Context: LuaLS/lua-language-server#496 (comment)

Server keeps crashing.

Whenever I open a lua file I get this error: [coc.nvim] The "lua" server crashed 5 times in the last 3 minutes. The server will not be restarted.

Coc-lua break with new language server

When prompted for updating new version of lua language server, I processed and get the following errors:

[coc.nvim] [14:13:56.486][error][#0:script/library.lua:233]: script/library.lua:197: attempt to call a nil value (field 'get')
[coc.nvim] Server lua failed to start: Error: [14:13:56.486][error][#0:script/library.lua:233]: script/library.lua:197: attempt to call a nil value (field 'get')

cos-lua: 1.0.1
neovim: 0.5 stable

Thank you and best regards!

Keeps on trying to get access to contacts, reminders, photos

When I start nvim from home directory, and open a lua file in another directory (in my case ~/Desktop/somefolder/file.lua), I keep on getting popup messages that some subprocess of my terminal is trying to access contacts, reminders, and photos. Is there a way to disable filesystem search? I have following settings, but it still doesn't stop:

{
    "Lua.telemetry.enable": false,
    "Lua.workspace.maxPreload": 0,
    "Lua.workspace.library": {},
    "Lua.diagnostics.enable": false
}

Is it possible to hardcode directory paths that should be ignored? While in home directory, a reverse option would work better: allow only certain sub-directories.

Lua lsp starts successfully but nothing works

## versions

vim version: NVIM v0.4.4
node version: v15.5.1
coc.nvim version: 0.0.80-a112e6621b
coc.nvim directory: /Users/yunsen/.vim/bundle/coc.nvim
term: iTerm.app
platform: darwin

## Log of coc.nvim

2021-01-12T22:38:10.155 INFO (pid:9523) [services] - registered service "lua"
2021-01-12T22:38:10.159 INFO (pid:9523) [services] - lua state change: stopped => starting
2021-01-12T22:38:10.162 INFO (pid:9523) [plugin] - coc.nvim 0.0.80-a112e6621b initialized with node: v15.5.1 after 156ms
2021-01-12T22:38:10.167 INFO (pid:9523) [language-client-index] - Language server "lua" started with 9524
2021-01-12T22:38:10.317 INFO (pid:9523) [services] - lua state change: starting => running
2021-01-12T22:38:10.325 INFO (pid:9523) [services] - service lua started
2021-01-12T22:38:12.931 INFO (pid:9523) [attach] - receive notification: showInfo []

OS: MacOS 11.1

Here is the message showed up after trigger coc hover.
截屏2021-01-12 下午10 43 12
截屏2021-01-12 下午10 44 04

lua server crashes.

Hi. I installed coc-lua using vim plug and whenever I start editing a lua file I get following error.
[coc.nvim] The "lua" server crashed 5 times in the last 3 minutes. The server will not be restarted.
Before installing via vim-plug I tried installing via coc-install but that always gave me error- return 1 for yarn and error 243 for npm

Add formatter support

Currently, coc-lua doesn't seem to be able to format the current buffer.
Running :call CocCommand('format') in a lua file prints an error message saying the language server doesn't support formatting.
Would it be possible to add such functionality to coc-lua?

[coc.nvim]: UnhandledRejection: write EPIPE

After installing coc-lua (same issue with coc-sumenko-lua), neovim will show these errors when opening .lua files:

[coc.nvim]: UnhandledRejection: write EPIPE
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:798:11)
    at Socket._write (net.js:810:8)
    at writeOrBuffer (internal/streams/writable.js:358:12)
    at Socket.Writable.write (internal/streams/writable.js:303:10)
    at /home/username/.local/share/nvim/plugged/coc.nvim/build/index.js:34:3107
    at new Promise (<anonymous>)
    at WF.write (/home/username/.local/share/nvim/plugged/coc.nvim/build/index.js:34:3028)
    at fC.doWrite (/home/username/.local/share/nvim/plugged/coc.nvim/build/index.js:35:1698)


[coc.nvim]: UnhandledRejection: Cannot call write after a stream was destroyed
Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
    at new NodeError (internal/errors.js:322:7)
    at Socket.Writable.write (internal/streams/writable.js:294:11)
    at /home/username/.local/share/nvim/plugged/coc.nvim/build/index.js:34:3107
    at new Promise (<anonymous>)
    at WF.write (/home/username/.local/share/nvim/plugged/coc.nvim/build/index.js:34:3028)
    at fC.doWrite (/home/username/.local/share/nvim/plugged/coc.nvim/build/index.js:35:1698)
    at /home/username/.local/share/nvim/plugged/coc.nvim/build/index.js:35:1597

OS: pop_os 21.10
Neovim: NVIM v0.7.0-dev

Support stylua

I have stylua installed, but attempting to format a Lua file returns:

Error detected while processing function CocAction[4]..coc#rpc#request[4]..<SNR>9_request[34]..function CocAction[4]..coc#rpc#request[4]..<SNR>
9_request:
line   31:
E605: Exception not caught: Error on request: Vim(return):Error invoking 'format' on channel 4 (coc):^@Format provider not found for buffer: 22

How to configure this for editing neovim's configuration files?

I wish to use this mainly to edit the config files for neovim. However with my current configuration, whenever I save the file, it does "Diagnose Workspace x/817", which takes ages.

I don't understand which files it is trying to diagnose and why. The lua files I'm editing are in ~/.vim

My current config file is this

    "Lua.addonManager.enable": true,
    "Lua.codeLens.enable": true,
    "Lua.completion.enable": true,
    "Lua.completion.keywordSnippet": "Both",
    "Lua.completion.displayContext": 10,
    "Lua.format.enable": true,
    "Lua.workspace.library": [
        "/usr/share/nvim/runtime/lua",
        "/usr/share/nvim/runtime/lua/vim",
        "/usr/share/nvim/runtime/lua/vim/lsp",
        "~/.vim/plugged/**/lua/"
    ],
    "Lua.workspace.ignoreDir": [
        ".vscode",
        "plugged",
        ".git"
    ],
    "Lua.diagnostics.globals": [
        "vim"
    ],
    "Lua.diagnostics.workspaceRate": 100,
    "Lua.doc.privateName": [
        "m_*"
    ],
    "Lua.hint.enable": true,

Using Dictionary as string

Triggering auto-complete after foo( results in one of two errors:

[coc.nvim]: UnhandledRejection: c.content.trim is not a function
TypeError: c.content.trim is not a function
    at /home/xandaros/dotfiles/config/nvim/bundle/coc.nvim/build/index.js:223:21299
    at Array.filter (<anonymous>)
    at qC.show (/home/xandaros/dotfiles/config/nvim/bundle/coc.nvim/build/index.js:223:21279)
    at b9.onPumChange (/home/xandaros/dotfiles/config/nvim/bundle/coc.nvim/build/index.js:223:31866)
Error detected while processing function coc#_complete:
line    3:
E731: using Dictionary as a String

The definition of foo:

---@param x number
---@param y fun()?
function foo(x, y)
end

The first parameter has to exist, and the second has to be an optional function. As far as I can tell, those are the conditions for this to fail.

How to append `vim.api.nvim_get_runtime_file('', true)` to Lua.workspace.library?

I don't want to manually adjust my workspace library whenever I install or remove a plugin. Luckily vim.api.nvim_get_runtime_file('', true) produces all the paths that nvim's lua interpreter looks for libraries for.
Unfortunately the settings in the coc-configurations are done with a json file and there is no syntax to do a function call there to populate any options, as far as I could gather.
Is there some way to put all those paths into Lua.workspace.library in a different way? Maybe some special string?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.