Bug 474989

Summary: Autocompleting with LSP-plugin "import" (typescript) expressions inserts second import with { and }
Product: [Applications] kate Reporter: Henri K <henrikau>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: waqar.17a
Priority: NOR    
Version First Reported In: 23.04.3   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Henri K 2023-09-28 14:31:08 UTC
STEPS TO REPRODUCE
1. Enable LSP-plugin.
2. install a language server, in my case: npm -g install typescript-language-server
3. make sure server is enabled.
4. open a file supported by the language server. in my case a .ts -file.
5. write "import { " and begin to type something until you see completion suggestions.
6. Select one and hit enter

OBSERVED RESULT

for example if I type:

"import { take"

and select from completion popup-menu "takeUntil [rxjs]" and hit enter I get:

import { import { takeUntil } from 'rxjs';}

It adds second "import" with extra { and }.

EXPECTED RESULT

import { takeUntil } from 'rxjs';

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.109.0
Qt Version: 5.15.10
Comment 1 Waqar Ahmed 2023-09-28 16:31:25 UTC
Can you try with latest Kate (23.08.3) ?
Comment 2 Henri K 2023-09-30 08:36:04 UTC
(In reply to Waqar Ahmed from comment #1)
> Can you try with latest Kate (23.08.3) ?

Seems that it's fixed in that version. There's still extra '}' at the end of line but noticed it's from setting "Automatically close brackets when opening bracket is typed". So when "{" is typed it already adds that "}" at right side of cursor which stays there after completion. Seems unexpected for me. Can be avoided by skipping typing that first "{"  though.
Comment 3 Waqar Ahmed 2023-11-30 07:44:03 UTC
> So when "{" is typed it already adds that "}" at right side of cursor

These kinds of annoyances are still there, I will see if I can find a generic way to work around this issue. Thanks for testing and reporting the bug.