{"id":13898211,"url":"https://github.com/creativenull/vim-lspclient","last_synced_at":"2025-05-06T21:41:15.632Z","repository":{"id":50633522,"uuid":"518997815","full_name":"creativenull/vim-lspclient","owner":"creativenull","description":"A highly experimental lsp client for vim. Written in vim9script.","archived":false,"fork":false,"pushed_at":"2022-09-01T15:53:36.000Z","size":160,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T03:11:35.414Z","etag":null,"topics":["vim","vim-plugin","vim9","vim9-script"],"latest_commit_sha":null,"homepage":"","language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/creativenull.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}},"created_at":"2022-07-28T21:22:59.000Z","updated_at":"2024-10-28T15:27:15.000Z","dependencies_parsed_at":"2022-08-12T21:50:55.362Z","dependency_job_id":null,"html_url":"https://github.com/creativenull/vim-lspclient","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creativenull%2Fvim-lspclient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creativenull%2Fvim-lspclient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creativenull%2Fvim-lspclient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creativenull%2Fvim-lspclient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/creativenull","download_url":"https://codeload.github.com/creativenull/vim-lspclient/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252775629,"owners_count":21802453,"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":["vim","vim-plugin","vim9","vim9-script"],"created_at":"2024-08-06T18:04:09.842Z","updated_at":"2025-05-06T21:41:15.610Z","avatar_url":"https://github.com/creativenull.png","language":"Vim Script","funding_links":[],"categories":["Vim Script","Language Server Protocol"],"sub_categories":[],"readme":"# vim-lspclient (WIP)\n\nA highly experimental LSP client for VIM using the builtin [LSP channel mode](https://vimhelp.org/channel.txt.html#language-server-protocol).\nWritten in `vim9script`.\n\n## Motivation\n\nI just wanted to try out the new `vim9script` language, at the same time, wanted to challenge myself on building something\ndifferent/unique besides just building web applications.\n\nAt this moment, this plugin is just a toy project for me to play around with LSP and what features I could possibly\nimplement/contribute to different plugins that already do something similar.\n\nThe aim for this LSP client is to be:\n\n+ Portable: use as much of built-in VIM features as possible, write any custom wrappers in case a feature is needed.\n+ Efficient: find ways to display important info and make it easy for the users to access this info.\n+ Aesthetics: make displaying info as aesthetically pleasing as possible but still out of the way of distractions if needed.\n+ Performance: not really a high aim for now, but eventually will get there in small increments.\n\n## What works\n\nRef: [LSP Specification v3.17](https://microsoft.github.io/language-server-protocol/specifications/specification-current)\n\n+ Server Initialization (`initialize` and `initialized`)\n+ Server Shutdown (`shutdown` and `exit`)\n+ Dynamic Registration Capability\n    + `workspace/didChangeConfiguration`\n+ Document updates\n    + `textDocument/didOpen`\n    + `textDocument/didChange`\n    + `textDocument/didClose`\n    + `textDocument/willSave`\n    + `textDocument/didSave`\n+ Language features\n    + `textDocument/publishDiagnostics`\n    + `textDocument/declaration`\n    + `textDocument/definition`\n    + `textDocument/typeDefinition`\n    + `textDocument/implementation`\n    + `textDocument/references`\n    + `textDocument/documentHighlight`\n    + `textDocument/hover`\n    + `textDocument/codeLens` (WIP)\n    + `codeLens/resolve` (WIP)\n+  Workspace features \n    + `workspace/configuration`\n    + `workspace/didChangeConfiguration`\n    + `workspace/workspaceFolders` (WIP)\n+ Window features\n    + `window/showMessageRequest` (WIP)\n    + `window/showMessage`\n    + `window/logMessage`\n    + `window/workDoneProgress/create` (WIP)\n    + `window/workDoneProgress/cancel` (WIP)\n\n## Installation\n\n### Requirements\n\nThe following version and features are required, these can also be checked with `:LSPClientCheckHealth`:\n\n+ [VIM v8.2.4758](https://github.com/vim/vim/tree/v8.2.4758) and up or [VIM 9](https://github.com/vim/vim/tree/v9.0.0000) and up is required.\n+ `+channel`\n+ `+job`\n+ `+timers`\n+ `+popupwin`\n\n### Install via plugin manager\n\n```vim\nPlug 'creativenull/vim-lspclient'\n```\n\n### Install without plugin manager\n\n```\ngit clone https://github.com/creativenull/vim-lspclient.git ~/.vim/pack/creativenull/start/vim-lspclient\n```\n\n## Setup\n\n### Keymaps\n\n```vim\n\" Example keymaps\nnmap \u003cLeader\u003elgd \u003cPlug\u003e(lspclient_definition)\nnmap \u003cLeader\u003elge \u003cPlug\u003e(lspclient_declaration)\nnmap \u003cLeader\u003elgt \u003cPlug\u003e(lspclient_type_definition)\nnmap \u003cLeader\u003elgi \u003cPlug\u003e(lspclient_implementation)\nnmap \u003cLeader\u003elr \u003cPlug\u003e(lspclient_references)\nnmap \u003cLeader\u003elro \u003cPlug\u003e(lspclient_reference_next)\nnmap \u003cLeader\u003elri \u003cPlug\u003e(lspclient_reference_prev)\nnmap \u003cLeader\u003eli \u003cPlug\u003e(lspclient_document_highlight)\nnmap \u003cLeader\u003eld \u003cPlug\u003e(lspclient_diagnostics)\nnmap \u003cLeader\u003eldo \u003cPlug\u003e(lspclient_diagnostic_next)\nnmap \u003cLeader\u003eldi \u003cPlug\u003e(lspclient_diagnostic_prev)\nnmap \u003cLeader\u003elw \u003cPlug\u003e(lspclient_diagnostic_hover)\nnmap \u003cLeader\u003elh \u003cPlug\u003e(lspclient_hover)\n```\n\n### Enable Debug Logs\n\nCheck logs with `:LSPClientLog` or `vim +LSPClientLog` (in terminal)\n\n```vim\nlet g:lspclient_debug = 1\n```\n\n### LSP Servers Setup Examples\n\n#### tsserver (js/ts)\n\nMust have `typescript-language-server` installed globally with `npm i -g typescript-language-server`.\n\n```vim\nlet s:tsserver = {}\nlet s:tsserver.name = 'tsserver'\nlet s:tsserver.cmd = ['typescript-language-server', '--stdio']\nlet s:tsserver.filetypes = ['typescript', 'typescriptreact', 'javascript', 'javascriptreact']\nlet s:tsserver.initOptions = { 'hostInfo': 'VIM 9' }\nlet s:tsserver.markers = ['tsconfig.json', 'jsconfig.json', 'package.json']\n\ncall lspclient#Create(s:tsserver)\n```\n\n#### volar (vue \u003e= 3)\n\nMust have `vue-language-server` installed globally with `npm i -g @volar/vue-language-server`\n\n```vim\nlet s:volar = {}\nlet s:volar.name = 'volar'\nlet s:volar.cmd = ['vue-language-server', '--stdio']\nlet s:volar.filetypes = ['vue']\nlet s:volar.markers = ['package.json', 'vite.config.js', 'vite.config.ts']\n\n\" https://github.com/johnsoncodehk/volar/blob/d27d989355adc2aa3f9c6260226bd3167e3fac97/packages/shared/src/types.ts\nlet s:volar.initOptions = {\n\\   'typescript': {\n\\     'serverPath': lspclient#fs#GetProjectRoot('node_modules/typescript/lib/tsserverlibrary.js'),\n\\   },\n\\   'documentFeatures': {\n\\     'allowedLanguageIds': ['html', 'css', 'vue', 'typescript'],\n\\     'selectionRange': v:true,\n\\     'foldingRange': v:true,\n\\     'linkedEditingRange': v:true,\n\\     'documentSymbol': v:true,\n\\     'documentColor': v:true,\n\\     'documentFormatting': v:true,\n\\   },\n\\   'languageFeatures': {\n\\     'references': v:true,\n\\     'implementation': v:true,\n\\     'definition': v:true,\n\\     'typeDefinition': v:true,\n\\     'callHierarchy': v:true,\n\\     'hover': v:true,\n\\     'rename': v:true,\n\\     'renameFileRefactoring': v:true,\n\\     'signatrueHelp': v:true,\n\\     'completion': {\n\\     \t'defaultTagNameCase': 'both',\n\\     \t'defaultAttrNameCase': 'kebabCase',\n\\     \t'getDocumentNameCasesRequest': v:true,\n\\     \t'getDocumentSelectionRequest': v:true,\n\\     },\n\\     'documentHighlight': v:true,\n\\     'documentLink': v:true,\n\\     'workspaceSymbol': v:true,\n\\     'codeLens': v:true,\n\\     'semanticTokens': v:true,\n\\     'codeAction': v:true,\n\\     'inlayHints': v:false,\n\\     'diagnostics': v:true,\n\\     'schemaRequestService': v:true,\n\\   },\n\\ }\n\ncall lspclient#Create(s:volar)\n```\n\n#### deno (js/ts)\n\nMust have `deno` installed globally.\n\n```vim\nlet s:denols = {}\nlet s:denols.name = 'denols'\nlet s:denols.cmd = ['deno', 'lsp']\nlet s:denols.filetypes = ['typescript', 'typescriptreact', 'javascript', 'javascriptreact']\nlet s:denols.settings = { 'enable': v:true, 'unstable': v:true }\nlet s:denols.markers = ['deno.json', 'deno.jsonc']\n\ncall lspclient#Create(s:denols)\n```\n\n#### Rust\n\nMust have `rust-analyzer` installed globally.\n\n```vim\nlet s:rust_analyzer = {}\nlet s:rust_analyzer.name = 'rust_analyzer'\nlet s:rust_analyzer.cmd = ['rust-analyzer']\nlet s:rust_analyzer.filetypes = ['rust']\nlet s:rust_analyzer.markers = ['Cargo.toml']\n\ncall lspclient#Create(s:rust_analyzer)\n```\n\n#### Go\n\nMust have `gopls` installed globally.\n\n```vim\nlet s:gopls = {}\nlet s:gopls.name = 'gopls'\nlet s:gopls.cmd = ['gopls']\nlet s:gopls.filetypes = ['go', 'gomod']\nlet s:gopls.markers = ['go.mod']\n\ncall lspclient#Create(s:gopls)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreativenull%2Fvim-lspclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcreativenull%2Fvim-lspclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreativenull%2Fvim-lspclient/lists"}