Closed
Description
Thank you for the bug report
- I am using the latest version of
lsp-mode
related packages. - I checked FAQ and Troubleshooting sections
- You may also try reproduce the issue using clean environment using the following command
emacs -q -l lsp-start-plain.el
where lsp-start-plain.el
can be downloaded here.
Alternatively, it will be great if you can reproduce the issue using lsp-docker which provides the minimal configurations for lsp-mode
and ships with most of the language servers.
Bug description
So I am using a custom derived more of web-mode
to handle my .tsx
files. This does not respect my indendation configurations.
For eg:
import {
Stack,
} from '@chakra-ui/react';
In the above snippet if I try to add another import and use completion, it indents to 4 spaces instead of two. Even though according to normal indentation rules, I consistently use 2 spaces.
Steps to reproduce
- Set
web-mode-code-indent-offset
to 2 - Verify that standard indendation uses 2 spaces.
- Try to use completion when doing imports in
.tsx
files with web-mode.
Expected behavior
lsp-mode should respect web-mode indendation variables.
Which Language Server did you use?
ESLint and typescript-language-server
OS
Linux
Error callstack
No response
Anything else?
Adding the following advice in doom-emacs fixes the issue.
(defadvice! +lsp--fix-indent-width-in-web-mode-a (orig-fn mode)
:around #'lsp--get-indent-width
(if (provided-mode-derived-p mode 'web-mode)
'tab-width
(funcall orig-fn mode)))