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
|
### Emacs with LSP
|
||||||
|
|
||||||
LSP will, by default, use its own `tsserver`, no matter what is in the
|
#### Tell lsp-mode to automatically find and use your project's tsserver
|
||||||
local `node_modules`. Because of the [issue with tsserver's approach
|
|
||||||
to plugin loading][tsserver-plugin-loading-problem], this means that
|
Since lsp-mode version 8.0.1, the first thing to try is to set
|
||||||
by default it will not load the Syndicate plugin.
|
`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
|
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
|
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
|
### Emacs with LSP
|
||||||
|
|
||||||
`lsp-mode` helpfully puts logs in a `.log/` directory in your project
|
Older versions of `lsp-mode` by default helpfully put logs in a `.log/` directory in your
|
||||||
root! So you can follow `.log/tsserver.log`. There are also `lsp-mode`
|
project root. Newer versions seem not to have that logging enabled by default; for these
|
||||||
options for changing the `tsserver` logging level, but I haven't
|
versions, set (customize) the variable `lsp-clients-typescript-server-args` to include the
|
||||||
explored them yet.
|
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
|
[tsserver-plugin-loading-problem]: https://github.com/microsoft/TypeScript/issues/42688
|
||||||
|
|
Loading…
Reference in New Issue