SUMMARY When using the LSP plugin with the typescript-language-server (https://github.com/typescript-language-server/typescript-language-server), there is no way to import missing names. The "Add imports automatically if needed upon completion" option for the plugin does nothing, and there are no code actions available to import missing names. STEPS TO REPRODUCE 1. Install typescript-language-server (https://github.com/typescript-language-server/typescript-language-server) 2. Enable the Kate LSP plugin 3. Open a nodejs project 4. Write the name of an object exported in an other file 5. Notice how there is no way to add the import automatically OBSERVED RESULT Imports are not added upon completion and there are no code actions available for this. EXPECTED RESULT Imports should be added automatically upon completion if the option "Add imports automatically if needed upon completion" is set and there should be a code actions available when selecting a missing name. SOFTWARE/OS VERSIONS Operating System: Manjaro Linux KDE Plasma Version: 5.26.3 KDE Frameworks Version: 5.99.0 Qt Version: 5.15.7 Kernel Version: 6.0.8-1-MANJARO (64-bit)
I looked more into this and it seems Kate expects the LSP server to send the import text to insert in the additionalTextEdits key. (see https://invent.kde.org/utilities/kate/-/blob/master/addons/lspclient/lspclientcompletion.cpp#L506 and https://invent.kde.org/utilities/kate/-/blob/master/addons/lspclient/lspclientserver.cpp#L704) But typescript-language-server is not filling this key, instead it uses the data key to pass a more complex object (see the function asCompletionItem in https://github.com/typescript-language-server/typescript-language-server/blob/master/src/completion.ts). Here is an example of data sent by the server when showing the completion for a component named KateTestFunction: { "commitCharacters": [ ".", ",", "(" ], "data": { "entryNames": [ { "data": { "exportName": "KateTestFunction", "fileName": "/path/to/KateTestFunction.tsx", "moduleSpecifier": "./KateTestFunction" }, "name": "KateTestFunction", "source": "./KateTestFunction" } ], "file": "/path/to/KateTest.tsx", "line": 4, "offset": 20 }, "detail": "./KateTestFunction", "kind": 3, "label": "KateTestFunction", "sortText": "16" } So in this case, Kate should use the content of the response to generate the following text at the top of the file: import { KateTestFunction } from "./KateTestFunction"; Or insert the name in an already existing import statement: import { OtherFunction } from "./KateTestFunction"; => import { OtherFunction, KateTestFunction } from "./KateTestFunction"; I don't know much about Kate or LSP so maybe I'm wrong, but hopefully this helps understanding the issue.
Compiled latest version from git and it seems fixed, thanks for your hard work!