Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can import autocompletion not insert semicolon? #806

Closed
blakeembrey opened this issue Jan 5, 2016 · 5 comments
Closed

Can import autocompletion not insert semicolon? #806

blakeembrey opened this issue Jan 5, 2016 · 5 comments

Comments

@blakeembrey
Copy link
Member

I don't really use semi-colons, can we detect this on the line and if a semicolon is missing skip inserting it?

@basarat
Copy link
Member

basarat commented Jan 8, 2016

I don't really use semi-colons

Now I don't feel so bad about my lack of using them sometimes (or maybe I should be cause that means I'm inconsistent). Up for grabs 🌹

Implementer guidance

Recently work was done to make import autocomplete preserve whitespace #805 . Similar approach should be taken here 🌹

@blakeembrey
Copy link
Member Author

FWIW, I love that you do this 👍 You leave fantastic comments for the next person to come along!

@augustsaintfreytag
Copy link

A +1 from me, it should preserve every allowed code style. The auto-complete system could either read an existing linter style or use a style option from the tsconfig.

@lierdakil
Copy link
Collaborator

@ApricumMedia, there is no style option in tsconfig, is there? https://www.typescriptlang.org/docs/handbook/compiler-options.html

Besides, since we're using tsserver, for autocompletion, built-in formatting, etc, I feel like this issue belongs to the TypeScript repo, and hey, look, here it is.

Also, to be fair, we do support non-standard formatCodeOptions setting in tsconfig.json. It doesn't support semicolon behaviour configuration though.

For the sake of completeness, here is the schema of formatCodeOptions (taken from tsserver protocol description, may change depending on your TypeScript version):

    interface FormatCodeSettings {
        baseIndentSize?: number;
        indentSize?: number;
        tabSize?: number;
        newLineCharacter?: string;
        convertTabsToSpaces?: boolean;
        indentStyle?: "None" | "Block" | "Smart";
        insertSpaceAfterCommaDelimiter?: boolean;
        insertSpaceAfterSemicolonInForStatements?: boolean;
        insertSpaceBeforeAndAfterBinaryOperators?: boolean;
        insertSpaceAfterConstructor?: boolean;
        insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
        insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
        insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
        insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
        insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
        insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
        insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
        insertSpaceAfterTypeAssertion?: boolean;
        insertSpaceBeforeFunctionParenthesis?: boolean;
        placeOpenBraceOnNewLineForFunctions?: boolean;
        placeOpenBraceOnNewLineForControlBlocks?: boolean;
    }

In the meantime, consider using some sort of 'save-on-prettify' tool with the prettifier you like. We're using prettier and found it to be rather nice.

@finscn
Copy link

finscn commented Nov 22, 2021

any news?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants