Update ts-plugin README
This commit is contained in:
parent
075893fc85
commit
1008d6acca
|
@ -84,10 +84,34 @@ your project (and then close and re-open that TypeScript file).
|
|||
|
||||
### Emacs with LSP
|
||||
|
||||
LSP will, by default, use its own `tsserver`, no matter what is in the
|
||||
local `node_modules`. Because of the [issue with tsserver's approach
|
||||
to plugin loading][tsserver-plugin-loading-problem], this means that
|
||||
by default it will not load the Syndicate plugin.
|
||||
#### Tell lsp-mode to automatically find and use your project's tsserver
|
||||
|
||||
Since lsp-mode version 8.0.1, the first thing to try is to set
|
||||
`lsp-clients-typescript-prefer-use-project-ts-server` to `t`. From the lsp-mode documentation:
|
||||
|
||||
> `lsp-clients-typescript-prefer-use-project-ts-server`
|
||||
>
|
||||
> *Type:* `boolean`
|
||||
>
|
||||
> *Default:* `nil`
|
||||
>
|
||||
> When set, prefers using the tsserver.js from your project. This can allow loading plugins configured in your tsconfig.json.
|
||||
|
||||
When `lsp-clients-typescript-prefer-use-project-ts-server` is set, but your emacs hasn't
|
||||
downloaded and installed the `ts-ls` lsp-mode backend yet, lsp-mode will prompt you to download
|
||||
and install `ts-ls`. After that process has completed, it should then look for and load your
|
||||
project's tsserver.
|
||||
|
||||
If `lsp-clients-typescript-prefer-use-project-ts-server` is not available (e.g. your lsp-mode
|
||||
is older than 8.0.1), or if, for some reason, it doesn't work, read on.
|
||||
|
||||
#### Explicitly configuring your project's tsserver with lsp-mode
|
||||
|
||||
LSP will, by default (for versions older than 8.0.1 or when
|
||||
`lsp-clients-typescript-prefer-use-project-ts-server` is `nil`), use its own `tsserver`, no
|
||||
matter what is in the local `node_modules`. Because of the [issue with tsserver's approach to
|
||||
plugin loading][tsserver-plugin-loading-problem], this means that by default it will not load
|
||||
the Syndicate plugin.
|
||||
|
||||
Overriding the `tsserver` location is similar to the way it's done for
|
||||
Tide, but instead of a variable value change, a function has to be
|
||||
|
@ -203,9 +227,13 @@ Finally, you can set these options in a `.dir-locals.el` file, too:
|
|||
|
||||
### Emacs with LSP
|
||||
|
||||
`lsp-mode` helpfully puts logs in a `.log/` directory in your project
|
||||
root! So you can follow `.log/tsserver.log`. There are also `lsp-mode`
|
||||
options for changing the `tsserver` logging level, but I haven't
|
||||
explored them yet.
|
||||
Older versions of `lsp-mode` by default helpfully put logs in a `.log/` directory in your
|
||||
project root. Newer versions seem not to have that logging enabled by default; for these
|
||||
versions, set (customize) the variable `lsp-clients-typescript-server-args` to include the
|
||||
strings `"--tsserver-log-verbosity" "verbose"`. For example,
|
||||
|
||||
```elisp
|
||||
(setq lsp-clients-typescript-server-args '("--stdio" "--tsserver-log-verbosity" "verbose"))
|
||||
```
|
||||
|
||||
[tsserver-plugin-loading-problem]: https://github.com/microsoft/TypeScript/issues/42688
|
||||
|
|
Loading…
Reference in New Issue