update settings
This commit is contained in:
@@ -124,7 +124,9 @@ def formatting(params: lsp.DocumentFormattingParams) -> list[lsp.TextEdit] | Non
|
||||
doc = LSP_SERVER.workspace.get_text_document(params.text_document.uri)
|
||||
text = doc.source
|
||||
|
||||
formatted = format_tcl(text)
|
||||
formatted = text
|
||||
if GLOBAL_SETTINGS.get("formatter", False):
|
||||
formatted = format_tcl(text)
|
||||
|
||||
last_line = len(text.splitlines())
|
||||
full_range = lsp.Range(
|
||||
@@ -138,6 +140,13 @@ def formatting(params: lsp.DocumentFormattingParams) -> list[lsp.TextEdit] | Non
|
||||
# **********************************************************
|
||||
# Required Language Server Initialization and Exit handlers.
|
||||
# **********************************************************
|
||||
@LSP_SERVER.feature(lsp.WORKSPACE_DID_CHANGE_CONFIGURATION)
|
||||
def did_change_configuration(params: lsp.DidChangeConfigurationParams):
|
||||
settings = params.settings
|
||||
|
||||
log_to_output(str(settings))
|
||||
|
||||
|
||||
@LSP_SERVER.feature(lsp.INITIALIZE)
|
||||
def initialize(params: lsp.InitializeParams) -> lsp.InitializeResult:
|
||||
"""LSP handler for initialize request."""
|
||||
@@ -158,7 +167,7 @@ def initialize(params: lsp.InitializeParams) -> lsp.InitializeResult:
|
||||
)
|
||||
return lsp.InitializeResult(
|
||||
capabilities=lsp.ServerCapabilities(
|
||||
document_formatting_provider=True,
|
||||
document_formatting_provider=GLOBAL_SETTINGS.get("formatter", True),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -182,7 +191,7 @@ def _get_global_defaults():
|
||||
"args": GLOBAL_SETTINGS.get("args", []),
|
||||
"importStrategy": GLOBAL_SETTINGS.get("importStrategy", "useBundled"),
|
||||
"showNotifications": GLOBAL_SETTINGS.get("showNotifications", "off"),
|
||||
"formatter": GLOBAL_SETTINGS.get("formatter", False),
|
||||
"formatter": GLOBAL_SETTINGS.get("formatter", True),
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user