Skip to content

Commit a94a1de

Browse files
committed
refresh LS server if robotidy configuration changed
1 parent 455028b commit a94a1de

File tree

3 files changed

+57
-6
lines changed

3 files changed

+57
-6
lines changed

robotcode/language_server/robotframework/parts/robot_workspace.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class RobotWorkspaceProtocolPart(RobotLanguageServerProtocolPart):
2020

2121
def __init__(self, parent: RobotLanguageServerProtocol) -> None:
2222
super().__init__(parent)
23+
# self.parent.on_initialized.add(self._on_initialized)
2324

2425
@_logger.call
2526
async def get_or_open_document(
@@ -39,3 +40,47 @@ async def get_or_open_document(
3940
return await self.parent.documents.append_document(
4041
document_uri=DocumentUri(uri), language_id=language_id, text=text, version=version
4142
)
43+
44+
# @_logger.call
45+
# async def _on_initialized(self, sender: Any) -> None:
46+
# self.parent.workspace.did_change_configuration.add(self._on_change_configuration)
47+
48+
# @_logger.call
49+
# @threaded()
50+
# async def _on_change_configuration(self, sender: Any, settings: Dict[str, Any]) -> None:
51+
# async def run() -> None:
52+
# await asyncio.sleep(1)
53+
# token = await self.parent.window.create_progress()
54+
55+
# self.parent.window.progress_begin(token, "Analyze files")
56+
# try:
57+
# for folder in self.parent.workspace.workspace_folders:
58+
# config = (
59+
# await self.parent.workspace.get_configuration(WorkspaceConfig, folder.uri)
60+
# or WorkspaceConfig()
61+
# )
62+
63+
# async for f in iter_files(
64+
# folder.uri.to_path(),
65+
# (f"**/*.{{{ROBOT_FILE_EXTENSION[1:]},{RESOURCE_FILE_EXTENSION[1:]}}}"),
66+
# ignore_patterns=config.exclude_patterns or [], # type: ignore
67+
# absolute=True,
68+
# ):
69+
# self.parent.window.progress_report(token, "analyze "
70+
# + str(f.relative_to(folder.uri.to_path())))
71+
# try:
72+
# document = await self.get_or_open_document(f, "robotframework")
73+
# await (await self.parent.documents_cache.get_namespace(document)).ensure_initialized()
74+
# run_coroutine_in_thread(self.parent.diagnostics.publish_diagnostics, str(document.uri))
75+
76+
# except (SystemExit, KeyboardInterrupt, asyncio.CancelledError):
77+
# raise
78+
# except BaseException:
79+
# pass
80+
# except BaseException:
81+
# self.parent.window.progress_cancel(token)
82+
# raise
83+
# else:
84+
# self.parent.window.progress_end(token)
85+
86+
# await run()

tests/robotcode/language_server/robotframework/parts/data/.vscode/settings.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
},
1515
"robotcode.languageServer.args": [
1616
"--debugpy",
17-
"--log",
18-
"--log-level",
19-
"TRACE",
20-
"--log-robotframework",
21-
"--log-language-server"
17+
// "--log",
18+
// "--log-level",
19+
// "TRACE",
20+
// "--log-robotframework",
21+
// "--log-language-server"
2222
],
2323
// "robotcode.debug.groupOutput": false,
2424
// "robotcode.robot.args": [

vscode-client/extension.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,13 @@ export async function activateAsync(context: vscode.ExtensionContext): Promise<v
6565

6666
context.subscriptions.push(
6767
vscode.workspace.onDidChangeConfiguration(async (event) => {
68-
for (const s of ["robotcode.python", "robotcode.languageServer", "robotcode.robot", "robotcode.robocop"]) {
68+
for (const s of [
69+
"robotcode.python",
70+
"robotcode.languageServer",
71+
"robotcode.robot",
72+
"robotcode.robocop",
73+
"robotcode.robotidy",
74+
]) {
6975
if (event.affectsConfiguration(s)) {
7076
await languageClientManger.restart();
7177
}

0 commit comments

Comments
 (0)