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

LSP FMT: Indent with tabs instead of spaces #7808

Open
cyann opened this issue Mar 5, 2025 · 2 comments
Open

LSP FMT: Indent with tabs instead of spaces #7808

cyann opened this issue Mar 5, 2025 · 2 comments
Labels
a:lsp slint-lsp and formating (mO,bT) enhancement New feature or request

Comments

@cyann
Copy link

cyann commented Mar 5, 2025

Feature Description

I'm using VS Code, and tried many settings to force the use of tabs instead of spaces for indentation.

"[slint]": {
	"editor.insertSpaces": false,
	"editor.detectIndentation": false,
}

Apparently the LSP FMT tool does not support that. It looks like the 4 spaces are hard-coded:

new_line += " ";

I'm not sure what would be the easiest way to implement this. Maybe re-using the config from rustfmt - see hard_tabs? Or a command line parameter that we could set using slint.lsp-args?

Product Impact

No response

@cyann cyann added enhancement New feature or request need triaging Issue that the owner of the area still need to triage labels Mar 5, 2025
@cyann
Copy link
Author

cyann commented Mar 5, 2025

Workaround

Set the .slint files to not format on save, and change the File: Save shortcut to:

  1. format
  2. convert indentation to tabs
  3. save

settings.json

	"[slint]": {
		"editor.formatOnSave": false
	}

keybindings.json

{
	"key": "cmd+s",
	"command": "runCommands",
	"args": {
		"commands": [
			"editor.action.formatDocument",
			"editor.action.indentationToTabs",
			"workbench.action.files.save"
		]
	},
	"when": "editorTextFocus && editorLangId == 'slint'"
}

@ogoffart ogoffart added a:lsp slint-lsp and formating (mO,bT) and removed need triaging Issue that the owner of the area still need to triage labels Mar 6, 2025
@ogoffart
Copy link
Member

ogoffart commented Mar 6, 2025

I agree, we should have settings for the formatter for this kind of stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:lsp slint-lsp and formating (mO,bT) enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants