Sublime Forum

Anyone using Sublime Text to edit TypeScript code?

#1

Sublime is by far my favourite editor and I try to use it for everything. However, I found it’s quite lacking for TypeScript compared to VSCode. I’ve installed the TypeScript package and it sorts of work, but not very well.

One example is when I type Ctrl+Space - it shows the possible properties but mixed with other unrelated properties and even irrelevant names like “this” or “const”.

Ctrl+R is not great either as it lists a bunch of symbols with no indication of what’s a method or what’s a local variable.

“Go Definition” is not useful either as it lists both were the symbol is defined and where it is used:

So I’m just curious if it’s me who needs to configure the package better, or use it better, or if it’s just how TypeScript editing is on Sublime Text?

0 Likes

#2

Maybe https://packagecontrol.io/packages/TypeScript%20Syntax + https://packagecontrol.io/packages/LSP + https://packagecontrol.io/packages/LSP-typescript but I am not a TypeScript coder. Iirc MS’s TypeScript package provides some language service feature so I wonder why the Go to definition is not working well…

0 Likes

#3

One example is when I type Ctrl+Space - it shows the possible properties but mixed with other unrelated properties and even irrelevant names like “this” or “const”.

Setting "only_show_lsp_completions" to true in LSP.sublime-settings will show you only relevant completion items.

As for the Ctrl+R. I think that you are using the Sublime Text default keybinding to show the symbols within the document.

If you want to see a list of symbols in the document that LSP provides,
copy/paste this bellow to your keybindings file.

{"keys": ["ctrl+r"], "command": "lsp_document_symbols", "context": [{"key": "setting.lsp_active"}]},

“Go Definition” is not useful either as it lists both were the symbol is defined and where it is used:

Check if you enabled LSP goto definition in your keybindings file. By default it is not set to anything.

 // Go To Definition
    // {"keys": ["UNBOUND"], "command": "lsp_symbol_definition", "context": [{"key": "setting.lsp_active"}]},

Or if you want to just confirm that the LSP goto definition works.
You can do a right click on the function name. Select in the context menu LSP > Go To symbol definition.

0 Likes