Skip to content

Commit

Permalink
Add LSP-typescript: Organize Imports command (#42)
Browse files Browse the repository at this point in the history
Resolves #41
  • Loading branch information
rchl authored Feb 12, 2021
1 parent 846a019 commit dc710f7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
9 changes: 9 additions & 0 deletions LSP-typescript.sublime-commands
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,13 @@
"default": "// Settings in here override those in \"LSP-typescript/LSP-typescript.sublime-settings\"\n\n{\n\t$0\n}\n"
}
},
{
"caption": "LSP-typescript: Organize Imports",
"command": "lsp_execute",
"args": {
"session_name": "LSP-typescript",
"command_name": "_typescript.organizeImports",
"command_args": ["${file}"]
}
},
]
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,25 @@ TypeScript and JavaScript support for Sublime's LSP plugin provided through [The

### Installation

* Install [LSP](https://packagecontrol.io/packages/LSP) and `LSP-typescript` from Package Control.
* Install [`LSP`](https://packagecontrol.io/packages/LSP) and `LSP-typescript` from Package Control.
* For ST3: If you use TypeScript install [TypeScript Syntax](https://packagecontrol.io/packages/TypeScript%20Syntax). If you use React install [JSCustom](https://packagecontrol.io/packages/JSCustom).
* For ST4: The TypeScript and React (TSX) syntaxes are built-in so no need to install anything else.
* Restart Sublime.

### Configuration

Open configuration file using command palette with `Preferences: LSP-typescript Settings` command or opening it from the Sublime menu.
Open the configuration file using the Command Palette `Preferences: LSP-typescript Settings` command or open it from the Sublime menu.

### Organize Imports command

To sort or remove unused imports you can trigger the `LSP-typescript: Organize Imports` command from the Command Palette or create a key binding. For example:

```json
{ "keys": ["ctrl+k"], "command": "lsp_execute",
"args": {
"session_name": "LSP-typescript",
"command_name": "_typescript.organizeImports",
"command_args": ["${file}"]
}
},
```

0 comments on commit dc710f7

Please sign in to comment.