Skip to content
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

Whitespace removed when formatting TypeScript files #1884

Closed
terrybrash opened this issue Mar 30, 2022 · 3 comments
Closed

Whitespace removed when formatting TypeScript files #1884

terrybrash opened this issue Mar 30, 2022 · 3 comments
Labels
A-language-server Area: Language server client C-bug Category: This is a bug

Comments

@terrybrash
Copy link
Contributor

Summary

Formatting a TypeScript file in helix causes whitespace to be removed. Check the logs for the cause.

typescript-language-server 0.9.7

Reproduction Steps

Asciinema

I expect the TypeScript file to be formatted while maintaining whitespace.

Instead, all whitespace is removed.

Helix log

~/.cache/helix/helix.log
2022-03-29T21:30:20.307 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/formatting","params":{"options":{"insertSpaces":false,"tabSize":0},"textDocument":{"uri":"[file:///home/terry/work/vk/client/pages/index.tsx"}},"id":1](file:///home/terry/work/vk/client/pages/index.tsx%22%7D%7D,%22id%22:1)[](https://matrix.to/#/!zMuVRxoqjyxyjSEBXc:matrix.org/$sC7Oal8kNmIX5UFfl8tmpjqjvD22ko-FuA-sZ990yrI?via=matrix.org&via=tchncs.de&via=mozilla.org)}

Platform

Linux

Terminal Emulator

alacritty 0.10.1

Helix Version

helix 22.03 (c8082a1)

@terrybrash terrybrash added the C-bug Category: This is a bug label Mar 30, 2022
@kirawi kirawi added the A-language-server Area: Language server client label Mar 30, 2022
@archseer
Copy link
Member

This is because we use FormattingOptions::default() https://github.com/helix-editor/helix/blob/f2dd3d446914ec0953cd7e056d430fc3b959e75d/helix-view/src/document.rs#L415=

We should construct FormattingOptions according to doc settings and use ...Default::default() for the rest of the fields.

@archseer
Copy link
Member

Can you try c18de0e ?

@terrybrash
Copy link
Contributor Author

Fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-server Area: Language server client C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

3 participants