Skip to content

Commit 9a62acd

Browse files
committed
Update packages, switch to LSP Version 3.17
1 parent dea74bb commit 9a62acd

File tree

8 files changed

+253
-257
lines changed

8 files changed

+253
-257
lines changed

package-lock.json

Lines changed: 179 additions & 178 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@
766766
"dependencies": {
767767
"ansi-colors": "^4.1.1",
768768
"@vscode/debugadapter": "^1.55.1",
769-
"vscode-languageclient": "^8.0.0-next"
769+
"vscode-languageclient": "^8.0.0"
770770
},
771771
"devDependencies": {
772772
"@types/glob": "^7.2.0",
@@ -777,20 +777,20 @@
777777
"@typescript-eslint/parser": "^5.19.0",
778778
"@vscode/debugadapter-testsupport": "^1.55.1",
779779
"@vscode/test-electron": "^2.1.3",
780-
"eslint": "^8.13.0",
780+
"eslint": "^8.15.0",
781781
"eslint-config-prettier": "^8.5.0",
782782
"eslint-plugin-import": "^2.26.0",
783783
"eslint-plugin-jsx-a11y": "^6.5.1",
784784
"eslint-plugin-node": "^11.1.0",
785785
"eslint-plugin-prettier": "^4.0.0",
786786
"glob": "^8.0.1",
787-
"mocha": "^9.2.2",
787+
"mocha": "^10.0.0",
788788
"ovsx": "^0.3.0",
789789
"prettier": "^2.6.2",
790-
"ts-loader": "^9.2.8",
791-
"typescript": "^4.6.3",
790+
"ts-loader": "^9.3.0",
791+
"typescript": "^4.6.4",
792792
"vsce": "^2.7.0",
793-
"webpack": "^5.72.0",
793+
"webpack": "^5.72.1",
794794
"webpack-cli": "^4.9.2"
795795
}
796796
}

poetry.lock

Lines changed: 43 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

robotcode/debugger/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
import asyncio
4-
from typing import Any, Optional, cast
4+
from typing import Any, Optional
55

66
from ..jsonrpc2.server import TcpParams
77
from ..utils.logging import LoggingDescriptor
@@ -60,7 +60,7 @@ async def wait() -> None:
6060
port=self.tcp_params.port,
6161
)
6262

63-
self._protocol = cast(DAPClientProtocol, protocol)
63+
self._protocol = protocol
6464
self._protocol.on_connection_lost.add(self.on_connection_lost)
6565
except (asyncio.CancelledError, KeyboardInterrupt, SystemExit):
6666
raise

robotcode/jsonrpc2/protocol.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from typing import (
1313
Any,
1414
Callable,
15+
Coroutine,
1516
Dict,
1617
Generic,
1718
Iterator,
@@ -722,7 +723,7 @@ def handle_notification(self, message: JsonRPCNotification) -> None:
722723
params = self._convert_params(e.method, e.param_type, message.params)
723724
result = e.method(*params[0], **params[1])
724725
if inspect.isawaitable(result):
725-
create_sub_task(result)
726+
create_sub_task(cast(Coroutine[Any, Any, Any], result))
726727

727728
except asyncio.CancelledError:
728729
pass

robotcode/language_server/common/lsp_types.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,9 @@ def __repr__(self) -> str:
3030
for f in dataclasses.fields(self)
3131
if f.repr
3232
and (
33-
(f.default == dataclasses.MISSING and f.default_factory == dataclasses.MISSING) # type: ignore
33+
(f.default == dataclasses.MISSING and f.default_factory == dataclasses.MISSING)
3434
or (f.default != dataclasses.MISSING and f.default != getattr(self, f.name))
35-
or (
36-
f.default_factory != dataclasses.MISSING # type: ignore
37-
and getattr(self, f.name) != f.default_factory()
38-
)
35+
or (f.default_factory != dataclasses.MISSING and getattr(self, f.name) != f.default_factory())
3936
)
4037
)
4138
return f"{self.__class__.__qualname__}({args})"

robotcode/utils/async_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ def get_current_future_info() -> Optional[FutureInfo]:
682682

683683

684684
def create_sub_task(
685-
coro: Awaitable[_T], *, name: Optional[str] = None, loop: Optional[asyncio.AbstractEventLoop] = None
685+
coro: Coroutine[Any, Any, _T], *, name: Optional[str] = None, loop: Optional[asyncio.AbstractEventLoop] = None
686686
) -> asyncio.Task[_T]:
687687

688688
ct = get_current_future_info()

vscode-client/languageclientsmanger.ts

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,17 @@ export class LanguageClientsManager {
430430
result = new LanguageClient(`$robotCode:${workspaceFolder.uri.toString()}`, name, serverOptions, clientOptions);
431431

432432
this.outputChannel.appendLine(`trying to start Language client: ${name}`);
433-
result.start();
434433

435434
result.onDidChangeState((e) => {
436435
if (e.newState == State.Running) {
436+
this.outputChannel.appendLine(
437+
`client for ${result?.clientOptions.workspaceFolder?.uri ?? "unknown"} running.`
438+
);
437439
closeHandlerAction = CloseAction.Restart;
438440
} else if (e.newState == State.Stopped) {
441+
this.outputChannel.appendLine(
442+
`client for ${result?.clientOptions.workspaceFolder?.uri ?? "unknown"} stopped.`
443+
);
439444
if (workspaceFolder && this.clients.get(workspaceFolder.uri.toString()) !== result)
440445
closeHandlerAction = CloseAction.DoNotRestart;
441446
}
@@ -451,35 +456,27 @@ export class LanguageClientsManager {
451456
});
452457
});
453458

454-
result = await result.onReady().then(
455-
async (_) => {
456-
this.outputChannel.appendLine(`client ${result?.clientOptions.workspaceFolder?.uri ?? "unknown"} ready.`);
457-
let counter = 0;
458-
try {
459-
while (!result?.initializeResult && counter < 1000) {
460-
await sleep(10);
461-
counter++;
462-
}
463-
} catch {
464-
// do nothing
465-
this.outputChannel.appendLine(
466-
`client ${result?.clientOptions.workspaceFolder?.uri ?? "unknown"} did not initialize correctly`
467-
);
468-
return undefined;
469-
}
470-
return result;
459+
const started = await result.start().then(
460+
(_) => {
461+
this.outputChannel.appendLine(
462+
`client for ${result?.clientOptions.workspaceFolder?.uri ?? "unknown"} started.`
463+
);
464+
return true;
471465
},
472466
(reason) => {
473467
this.outputChannel.appendLine(
474468
`client ${result?.clientOptions.workspaceFolder?.uri ?? "unknown"} error: ${reason}`
475469
);
476-
return undefined;
470+
return false;
477471
}
478472
);
479473

480-
if (result) this.clients.set(workspaceFolder.uri.toString(), result);
474+
if (started) {
475+
this.clients.set(workspaceFolder.uri.toString(), result);
476+
return result;
477+
}
481478

482-
return result;
479+
return undefined;
483480
});
484481
}
485482

0 commit comments

Comments
 (0)