zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
45.71k stars 2.52k forks source link

Tabs in JS file do not seem to work #4907

Open morten-krogh opened 1 year ago

morten-krogh commented 1 year ago

Check for existing issues

Describe the bug / provide steps to reproduce it

I want to use tabs instead of spaces in a JS file.

Setting hard_tabs: true does not seem to do anything. Either it is not working or it is difficult to understand the settings.

Environment

Zed: v0.77.3 (stable) OS: macOS 13.2.1 Memory: 32 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

gabeidx commented 1 year ago

I'm experiencing a very similar problem, though not only scoped to JS files.

"hard_tabs": true, in settings.json.

The Zed.log show some instances of a unhandled notification eslint/noLibrary info message, not sure if related.

Environment

Zed: v0.92.4 (stable) OS: macOS 13.4.1 Memory: 16 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

https://github.com/zed-industries/community/assets/192261/b75e46cb-2ef0-444b-9aa8-caa9fb402549

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

2023-07-03T12:30:16 [INFO] Opening main db
2023-07-03T12:30:16 [INFO] starting language server name:typescript-language-server, path:"/[Users/gabe/[…]", id:0
2023-07-03T12:30:16 [INFO] starting language server name:eslint, path:"/[Users/gabe/[…]", id:1
2023-07-03T12:30:17 [INFO] unhandled notification eslint/noLibrary:
{
  "source": {
    "uri": "file:///Users/gabe/[…]/monitoring/logger.ts"
  }
}
2023-07-03T12:30:19 [INFO] unhandled notification $/typescriptVersion:
{
  "version": "5.1.6",
  "source": "user-setting"
}
2023-07-03T12:30:32 [INFO] unhandled notification eslint/noLibrary:
{
  "source": {
    "uri": "file:///Users/gabe/[…]/analytics/track.ts"
  }
}
CurbaiCode commented 10 months ago

If this is the same as zed-industries/zed#5082, then it seems like it's the autoformatter's fault.

Has anyone found a fix or a workaround? hard_tabs not working is a nightmare when working on git repositories that use tabs instead of spaces, because the autoformatter changes all the tabs to spaces, resulting in changes to almost every line.

SomeoneToIgnore commented 10 months ago

Zed currently supports prettier formatting in JS files, even if the project itself does not install one, if "formatter": "auto" (current default) or "formatter": "prettier" is set in Zed's settings.

As a workaround, the project can install prettier (so it appears in project's node_modules) and configure it inside the project files, or adjust "prettier" settings with the configuration needed.

https://prettier.io/docs/en/options.html#tabs shows that "useTabs": true config could be used.

SyntheticBird45 commented 1 month ago

Just to be perfectly clear. This is the same issue with rust and other languages. Any form of autocomplete will insert spaces instead of tabs even with hard_tabs = true.