-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[indent] Over-indentation creates weird interactions with LSP formatter #10
Comments
cc @jordwalke |
The other possibility is that prabirshrestha/vim-lsp should not be applying additional indentation to the results of |
Indeed, autozimu/LanguageClient-neovim doesn't seem to have this problem when you run |
This may not have anything to do with bucklescript annotations. Perhaps just long lines/functions. With external render :
ReasonReact.reactElement =>
Dom.element =>
array Dom.element =>
Dom.element =>
array Dom.element =>
unit =
"render";
external _getElementsByClassName : string => array Dom.element = "document.getElementsByClassName";
external _getElementById : string => option Dom.element = "document.getElementById"; Formats to this: external render :
ReasonReact.reactElement =>
Dom.element =>
array Dom.element =>
Dom.element =>
array Dom.element =>
unit =
"render";
external _getElementsByClassName : string => array Dom.element = "document.getElementsByClassName";
external _getElementById : string => option Dom.element = "document.getElementById"; |
Worth trying on the new syntax! If it's suitable, we can close. |
Still seeing over-indentation with [@bs.val] [@bs.module "react-dom"]
external render : (ReasonReact.reactElement, Dom.element) => unit =
"render";
[@bs.val] external _getElementsByClassName : string => array(Dom.element) =
"document.getElementsByClassName";
[@bs.val] [@bs.return nullable] external _getElementById : string => option(Dom.element) =
"document.getElementById"; |
I think there is a problem with indentation after lines with bucklescript annotations. For example, with the file (example from near the beginning of reason-react, src/ReactDOMRe.re):
If I go to the end of the first expression (after
[@@bs.module "react-dom"];
), and insert a new line, the new line is automatically indented by 2 spaces. I think it should not be indented at all, unless we're in a block, surrounded by { }.This may not sound like a big deal, but it is causing reformatting with
vim-lsp
andocaml-language-server
using the:LspDocumentFormat
command to indent lines following each expression with bucklescript annotations by an additional indentation level. So you wind up with some of these lines being 3 or 4 indentation levels deep when they should actually start at the beginning of the line, and do if you just runrefmt --in-place
on the file from outside the editor. It winds up looking like this:Moving
indent/reason.vim
somewhere else makes things indent normally. Looks like an issue with the indent configuration.The text was updated successfully, but these errors were encountered: