Closed kyoz closed 5 years ago
You should enable vim-lsp logging https://github.com/prabirshrestha/vim-lsp#debugging to prove that lsp server is not generating duplicate results.
Btw. Is ncm2-vim-lsp support auto import ? It'd be great if we have that.
Yes, as shown in https://github.com/ncm2/ncm2/issues/36#issuecomment-408623275
But I cannot get it to work with typescript-language-server. Maybe some configuration is missing for typescript-language-server, the completionItem returned by it does not contain auto import. I don't have time to debug typescript-language-server. (EDIT: be aware that some language server has bad default behavior, as mentioned in https://github.com/ncm2/ncm2/issues/114#issuecomment-450481800)
Thank you @roxma, i'v tried to see the log file but it look normally (Sorry i'm not familiar with language server)
There is it, please help me take a look in to it when you have free time, thanks...
Thu 21 Feb 2019 09:42:39 AM +07:["s:on_text_document_did_change()", 1]
Thu 21 Feb 2019 09:42:39 AM +07:["s:send_didchange_queue() will be triggered"]
Thu 21 Feb 2019 09:42:40 AM +07:["s:send_event_queue()"]
Thu 21 Feb 2019 09:42:40 AM +07:[{"response": {"data": {"__data__": "vim-lsp", "server_name": "lsp-ts"}, "message": "server already started"}}]
Thu 21 Feb 2019 09:42:40 AM +07:[{"response": {"data": {"__data__": "vim-lsp", "init_result": {"id": 1, "jsonrpc": "2.0", "result": {"capabilities": {"executeCommandProvider": {"commands": ["_typescript.applyWorkspaceEdit", "_typescript.applyCodeAction", "_typescript.applyRefactoring", "_typescript.organizeImports", "_typescript.applyRenameFile"]}, "documentHighlightProvider": true, "hoverProvider": true, "typeDefinitionProvider": true, "definitionProvider": true, "referencesProvider": true, "signatureHelpProvider": {"triggerCharacters": ["(", ",", "<"]}, "foldingRangeProvider": true, "codeActionProvider": true, "textDocumentSync": 2, "callsProvider": true, "implementationProvider": true, "workspaceSymbolProvider": true, "documentFormattingProvider": true, "documentSymbolProvider": true, "renameProvider": true, "completionProvider": {"resolveProvider": true, "triggerCharacters": [".", "\"", "'", "/", "@", "<"]}}}}, "server_name": "lsp-ts"}, "message": "lsp server already initialized"}}]
Thu 21 Feb 2019 09:42:40 AM +07:[{"response": {"data": {"__data__": "vim-lsp", "server_name": "lsp-ts"}, "message": "configuration sent"}}]
Thu 21 Feb 2019 09:42:40 AM +07:[{"response": {"data": {"path": "file:///home/kyoz/Documents/Projects/ux/src/lib/charts/box-plot-chart/box-plot-chart.component.ts", "__data__": "vim-lsp", "server_name": "lsp-ts"}, "message": "already opened"}}]
Thu 21 Feb 2019 09:42:40 AM +07:["s:update_file_content()", 1]
Thu 21 Feb 2019 09:42:40 AM +07:["--->", 7, "lsp-ts", {"method": "textDocument/didChange", "params": {"contentChanges": [{"range": {"end": {"character": 43, "line": 50}, "start": {"character": 43, "line": 50}}, "text": "e", "rangeLength": 0}], "textDocument": {"uri": "file:///home/kyoz/Documents/Projects/ux/src/lib/charts/box-plot-chart/box-plot-chart.component.ts", "version": 14}}}]
Thu 21 Feb 2019 09:42:40 AM +07:[{"response": {"data": {"path": "file:///home/kyoz/Documents/Projects/ux/src/lib/charts/box-plot-chart/box-plot-chart.component.ts", "__data__": "vim-lsp", "server_name": "lsp-ts"}, "message": "textDocument/didChange sent"}}]
Thu 21 Feb 2019 09:42:40 AM +07:["<---", 7, "lsp-ts", {"response": {"method": "textDocument/publishDiagnostics", "jsonrpc": "2.0", "params": {"uri": "file:///home/kyoz/Documents/Projects/ux/src/lib/charts/box-plot-chart/box-plot-chart.component.ts", "diagnostics": [{"source": "typescript", "range": {"end": {"character": 44, "line": 50}, "start": {"character": 30, "line": 50}}, "code": 2304, "message": "Cannot find name 'DataApiService'.", "severity": 1}]}}}]
Thu 21 Feb 2019 09:42:40 AM +07:["add signs"]
Another example for this issue:
I don't see any completion request in the log.
You should post the log after reproducing the issue.
I'v added
let g:lsp_log_verbose = 1
let g:lsp_log_file = expand('~/vim-lsp.log')
Clean the log. reproducing the issue.
And this is the full log i got in vim-lsp.log
vim-lsp.log
line 87:
{"label": "MatDialog", "commitCharacters": [".", ",", "("], "data": {"file": "/home/kyoz/Documents/Projects/ux/src/lib/charts/box-plot-chart/box-plot-chart.component.ts", "entryNames": [{"name": "MatDialog", "source": "/home/kyoz/Documents/Projects/ux/node_modules/@angular/material/material"}], "offset": 35, "line": 51}, "sortText": "\uFFFF0", "kind": 7}, {"label": "MatDialog", "commitCharacters": [".", ",", "("], "data": {"file": "/home/kyoz/Documents/Projects/ux/src/lib/charts/box-plot-chart/box-plot-chart.component.ts", "entryNames": [{"name": "MatDialog", "source": "/home/kyoz/Documents/Projects/ux/node_modules/@angular/material/material"}], "offset": 35, "line": 51}, "sortText": "\uFFFF0", "kind": 7}, {"label": "MatDialog", "commitCharacters": [".", ",", "("], "data": {"file": "/home/kyoz/Documents/Projects/ux/src/lib/charts/box-plot-chart/box-plot-chart.component.ts", "entryNames": [{"name": "MatDialog", "source": "/home/kyoz/Documents/Projects/ux/node_modules/@angular/material/material"}], "offset": 35, "line": 51}, "sortText": "\uFFFF0", "kind": 7}, {"label": "MatDialog", "commitCharacters": [".", ",", "("], "data": {"file": "/home/kyoz/Documents/Projects/ux/src/lib/charts/box-plot-chart/box-plot-chart.component.ts", "entryNames": [{"name": "MatDialog", "source": "/home/kyoz/Documents/Projects/ux/node_modules/@angular/material/material"}], "offset": 35, "line": 51}, "sortText": "\uFFFF0", "kind": 7}, {"label": "MatDialog", "commitCharacters": [".", ",", "("], "data": {"file": "/home/kyoz/Documents/Projects/ux/src/lib/charts/box-plot-chart/box-plot-chart.component.ts", "entryNames": [{"name": "MatDialog", "source": "/home/kyoz/Documents/Projects/ux/node_modules/@angular/material/material"}], "offset": 35, "line": 51}, "sortText": "\uFFFF0", "kind": 7}, {"label": "MatDialog", "commitCharacters": [".", ",", "("], "data": {"file": "/home/kyoz/Documents/Projects/ux/src/lib/charts/box-plot-chart/box-plot-chart.component.ts", "entryNames": [{"name": "MatDialog", "source": "/home/kyoz/Documents/Projects/ux/node_modules/@angular/material/material"}], "offset": 35, "line": 51}, "sortText": "\uFFFF0", "kind": 7}, {"label": "MatDialog", "commitCharacters": [".", ",", "("], "data": {"file": "/home/kyoz/Documents/Projects/ux/src/lib/charts/box-plot-chart/box-plot-chart.component.ts", "entryNames": [{"name": "MatDialog", "source": "/home/kyoz/Documents/Projects/ux/node_modules/@angular/material/material"}], "offset": 35, "line": 51}, "sortText": "\uFFFF0", "kind": 7}, {"label": "MatDialog", "commitCharacters": [".", ",", "("], "data": {"file": "/home/kyoz/Documents/Projects/ux/src/lib/charts/box-plot-chart/box-plot-chart.component.ts", "entryNames": [{"name": "MatDialog", "source": "/home/kyoz/Documents/Projects/ux/node_modules/@angular/material/material"}], "offset": 35, "line": 51}, "sortText": "\uFFFF0", "kind": 7}
This is typescript-language-server issue.
workaround:
call ncm2#override_source('lsp-ts', {'filter': [{'name': 'set_dup', 'value': 0}]})
Thanks @roxma, it work
This is my config
The result:
I think this is cause by typescript language server, right? Do we have any way to fix it.
Btw. Is ncm2-vim-lsp support auto import ? It'd be great if we have that.
Thanks you very much, @roxma