ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

LSP-tsgo

by sublimelsp ST4 Missing

TypeScript, JavaScript support for Sublime LSP plugin based on typescript-go

Details

Installs

  • Total 187
  • Win 54
  • Mac 66
  • Linux 67
Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18
Windows 0 0 0 0 0 0 0 2 0 0 0 0 0 1 0 0 0 2 2 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
Mac 0 0 0 1 0 0 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 3 3 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 1
Linux 1 0 0 1 0 0 0 1 0 0 0 2 1 0 0 0 0 0 1 1 0 1 0 1 0 1 0 1 0 0 0 0 1 0 0 0 1 0 1 0 0 1 0 1 0 0

Readme

Source
raw.​githubusercontent.​com

LSP-tsgo

TypeScript and JavaScript support for Sublime's LSP plugin provided through typescript (go based).

[!NOTE] typescript-go is now merged into the main typescript repo. This package will likely follow and get merged into LSP-typescript once Typescript 7 gains the tsserver API.

Installation

  • Install LSP and LSP-tsgo from Package Control.
  • Restart Sublime.

Configuration

Open the configuration file using the Command Palette Preferences: LSP-tsgo Settings command or open it from the Sublime menu.

Go to Source Definition

LSP: Goto Definition on a symbol from a dependency lands in its .d.ts. The LSP-tsgo: Goto Source Definition command (lsp_tsgo_goto_source_definition) asks the server for the implementation behind that declaration instead: the .js shipped next to the typings, or the original .ts when a declaration map is available. When the server has nothing to map (the symbol is already in source, or the server is too old to support the request) the command falls back to the ordinary definition, so it can take over a definition key binding:

{
    "keys": ["super+i"],
    "command": "lsp_tsgo_goto_source_definition",
    "args": {"fallback": true},
    "context": [
        {"key": "lsp.session_with_name", "operand": "LSP-tsgo"}
    ]
}

Pass "fallback": false to get a status message instead of the fallback.

Code Actions on Save

The server supports the following code actions that can be specified in the global lsp_code_actions_on_save setting and run on saving files:

  • source.fixAll - despite the name, fixes a couple of specific issues: unreachable code, await in non-async functions, incorrectly implemented interface
  • source.organizeImports - organizes and removes unused imports
  • source.removeUnusedImports - removes unused imports
  • source.sortImports - sorts imports