sublimelsp / LSP-typescript

TypeScript, JavaScript support for Sublime LSP plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to remove whitspace around autocompleted import statements

silverwind opened this issue · comments

Is there an option to change space around variables in a autocompleted import statement? e.g.

import { something } from "./something.js";

into

import {something} from "./something.js";

I tried disabling space-related settings but none seem to have any effect on import statements.

Not aware of a setting for that.

Your options are to create a feature request in https://github.com/microsoft/TypeScript/issues or use LSP-eslint with specific rule that correct that on save.

Ok, assuming typescript gains this option, do you need to add support here or is that automatic?

I pick up all new typescript options whenever typescript adds new ones so more or less "automatic". No need for an issue for tracking.

Okay, closing here then.

Actually I think there is already an option for this: typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces
or the javascript equivalent.

If it doesn't work after setting this one then try formatting the document first (LSP: Format file) and then try completions again. If it works then then it's something that should be fixed in the server.

Tested this myself and noticed that depending on how the import is completed, it either follows or doesn't follow the setting:

Screen.Recording.2022-09-28.at.14.44.22.mov

I've reproduced it in VSCode also so I would suggest just reporting it as a bug in TypeScript.

If you report mentioning the issue being reproducible in VSCode then it has much higher chance of being looked at. It's enough to set "typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false to reproduce there.

I can reproduce in ST as well, import foo<tab>, looks to just ignore the insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces option.

Yes, I know it reproduces but since both TypeScript and VSCode are made by Microsoft it's easier for them to look at reports that report against VSCode.