sublimelsp / LSP-typescript

TypeScript, JavaScript support for Sublime LSP plugin
MIT License
131 stars 11 forks source link

automatic save format issue #209

Closed h-polaris closed 1 year ago

h-polaris commented 1 year ago

lsp-typescript set automatic save to add semicolons, but it does not take effect on the last or only one line of the file.

rchl commented 1 year ago

Be more specific. I'm not sure what are you exactly doing on save. I'm not sure if LSP-typescript has anything to do with fixing semicolons.

h-polaris commented 1 year ago

here are my lsp-typescript settings

{
    "settings": {
        "javascript.format.semicolons": "insert",
        "typescript.format.semicolons": "insert"
    }
}

I want to automatically format the code as I save to add a semicolon at the end of each line.

example:

// right
var a = 1;
var b = 2;

but the results are not what I expected. The result is this:

// wrong
var a = 1;
var b = 2 // The last line does not append a semicolon

or:

var a = 1 // No semicolons are appended when there is only one line

What changes do I need to set?

rchl commented 1 year ago

And do you expect that to be fixed on running "LSP: Format file" or did you set up some lsp_code_actions_on_save for this?

h-polaris commented 1 year ago

i expect that to be fixed on running "LSP: Format file".

rchl commented 1 year ago

Fixed in https://github.com/sublimelsp/LSP-typescript/releases/tag/v2.4.0