Last active
September 1, 2021 15:39
-
-
Save tsukkee/578dee8508baa1667aa87227f7c2c434 to your computer and use it in GitHub Desktop.
Volarをvim-lspで動かしたい
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let g:vim_lsp_settings_volar_options = #{ | |
\ typescript: #{ | |
\ serverPath: "/path/to/node_modules/typescript/lib/tsserverlibrary.js", | |
\ }, | |
\ languageFeatures: #{ | |
\ references: #{ enabledInTsScript: v:true }, | |
\ definition: v:true, | |
\ typeDefinition: v:true, | |
\ callHierarchy: v:true, | |
\ hover: v:true, | |
\ rename: v:true, | |
\ renameFileRefactoring: v:true, | |
\ signatureHelp: v:true, | |
\ completion: #{ | |
\ defaultTagNameCase: 'both', | |
\ defaultAttrNameCase: 'kebabCase', | |
\ getDocumentNameCasesRequest: v:false, | |
\ getDocumentSelectionRequest: v:false, | |
\ }, | |
\ documentHighlight: v:true, | |
\ documentLink: v:true, | |
\ codeLens: #{ | |
\ showReferencesNotification: v:false, | |
\ }, | |
\ semanticTokens: v:true, | |
\ codeAction: v:true, | |
\ diagnostics: v:true, | |
\ schemaRequestService: v:true, | |
\ }, | |
\ documentFeatures: #{ | |
\ selectionRange: v:true, | |
\ foldingRange: v:true, | |
\ linkedEditingRange: v:true, | |
\ documentSymbol: v:true, | |
\ documentColor: v:true, | |
\ documentFormatting: #{ | |
\ defaultPrintWidth: 100, | |
\ getDocumentPrintWidthRequest: v:false, | |
\ }, | |
\ } | |
\} | |
let g:vim_lsp_settings_volar_config = #{ | |
\ volar-api: #{ | |
\ trace: #{ server: "off" }, | |
\ }, | |
\ volar-document: #{ | |
\ trace: #{ server: "off" }, | |
\ }, | |
\ volar-html: #{ | |
\ trace: #{ server: "off" }, | |
\ }, | |
\ volar: #{ | |
\ codeLens: #{ | |
\ references: v:false, | |
\ pugTools: v:false, | |
\ scriptSetupTools: v:false, | |
\ }, | |
\ formatting: #{ | |
\ printWidth: 100, | |
\ }, | |
\ icon: #{ | |
\ splitEditors: v:true, | |
\ preview: v:false, | |
\ finder: v:false, | |
\ }, | |
\ lowPowerMode: v:false, | |
\ autoCompleteRefs: v:true, | |
\ tsPluginStatus: v:false, | |
\ checkVueTscVersion: v:false, | |
\ preferredTagNameCase: "auto", | |
\ preferredAttrNameCase: "auto", | |
\ preview: #{ | |
\ port: 3333, | |
\ backgroundColor: "#fff", | |
\ transparentGrid: v:false, | |
\ } | |
\ } | |
\} | |
call lsp#register_server({ | |
\ 'name': 'volar', | |
\ 'cmd': { server_info->['node', '/path/to/volar-server/node_modules/@volar/server/out/index.js', '--stdio'] }, | |
\ 'config': { 'refresh_pattern': '\([a-zA-Z0-9_-]\+\|/\|\k\+\)$' }, | |
\ 'root_uri':{server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'package.json'))}, | |
\ 'initialization_options': g:vim_lsp_settings_volar_options, | |
\ 'workspace_config': g:vim_lsp_settings_volar_config, | |
\ 'allowlist': ['vue'] | |
\ }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
2021/9/1現在、↓でインストールした
@volar/server
を使う必要あり。