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

Auto-format after save doesn't work correctly on files opened after load #779

Open
caub opened this issue Aug 14, 2021 · 1 comment
Open

Comments

@caub
Copy link

caub commented Aug 14, 2021

I'm using Sublime build 4113, under linux (Lubuntu 18.04)

I've customized https://github.com/microsoft/TypeScript-Sublime-Plugin/blob/master/typescript/libs/editor_client.py#L110 by adding these options:

        format_options = {
            "tabSize": self.tab_size,
            "indentSize": self.indent_size,
            "convertTabsToSpaces": self.translate_tab_to_spaces,
            "insertSpaceAfterFunctionKeywordForAnonymousFunctions": True,
            "typescript.format.InsertSpaceAfterFunctionKeywordForAnonymousFunctions": True,
            "javascript.format.InsertSpaceAfterFunctionKeywordForAnonymousFunctions": True
        }

If I open a file modify it and save, the formatting works but doesn't respect these settings, so it'll format like this:

const fn = function(arg) { }

but then, if I close and reopen Sublime Text modify the file and save again, the formatting works correctly

const fn = function (arg) { }

Is there something I'm doing wrong? I know it's maybe hacky the way I modified my ~/.config/sublime-text-3/Packages/TypeScript/typescript/libs/editor_client.py setting directly

@caub caub changed the title Auto-format after save only works correctly if the file was opened at Sublime loading Auto-format after save doesn't work correctly on files opened after load Aug 14, 2021
@caub
Copy link
Author

caub commented Aug 30, 2021

I switched to LSP-typescript

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

No branches or pull requests

1 participant