mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 08:07:49 +00:00
Reformat Code only asked the language server for formatting, so files whose server has no formatting capability (Markdown with marksman, and others depending on the server) could not be formatted. Languages can now declare an external formatter. Prettier is the first: a managed tool installed on demand, or the project's own node_modules/prettier, an explicit path, or PATH. It runs on the backend copy of the document with the file's path so Prettier resolves the project's config, overrides and ignore files, and its result is applied as one undoable edit. Language servers that format a file keep doing so unless Prettier is preferred in Settings › Languages › Prettier; formatting on save is opt-in. Parsers without range support format the whole file and say so. Errors carry structured tool data, so a missing Prettier reuses the shared install prompt and Prettier diagnostics or timeouts show as non-sticky notifications. Fixes #639
33 lines
1.3 KiB
TOML
33 lines
1.3 KiB
TOML
id = "html"
|
|
name = "HTML"
|
|
formatter = { tool = "prettier", parser = "html", range = false }
|
|
extensions = ["html", "htm", "xhtml", "shtml", "html.tmpl"]
|
|
first-line = "^\\s*<!(?i:doctype)\\s+html"
|
|
block-comment = ["<!--", "-->"]
|
|
indent = { tab-size = 2, insert-spaces = true }
|
|
ui-mode = "HTML"
|
|
tree-sitter = "html"
|
|
|
|
# Angular projects: component templates, with bindings and interpolations
|
|
# highlighted as expressions.
|
|
[[framework-ui-modes]]
|
|
ui-mode = "Angular Template"
|
|
root-markers = ["angular.json", "node_modules/@angular/core"]
|
|
|
|
# Angular projects only: component templates. First, so that hover, rename and
|
|
# document symbols of templates come from it rather than plain HTML.
|
|
[[language-servers]]
|
|
name = "angular-language-server"
|
|
command = "ngserver"
|
|
args = ["--stdio", "--includeCompletionsWithSnippetText", "--includeAutomaticOptionalChainCompletions"]
|
|
root-markers = ["angular.json", "node_modules/@angular/core"]
|
|
require-root-marker = true
|
|
install-hint = "npm i -g @angular/language-server"
|
|
|
|
[[language-servers]]
|
|
name = "vscode-html-language-server"
|
|
command = "vscode-html-language-server"
|
|
args = ["--stdio"]
|
|
initialization-options = { provideFormatter = true, embeddedLanguages = { css = true, javascript = true } }
|
|
install-hint = "npm i -g vscode-langservers-extracted"
|