Closed Gelio closed 3 years ago
Hey @Gelio, thanks for the fantastic bug reports and PR! Sorry it took me a couple days to get to it - I do most of my personal coding on the weekends.
Anyway, I see what happened here! Up until now, stylelint-lsp was used, pretty much exclusively, by coc-stylelintplus. That package includes tslib as a dependency, so it all worked out. That's why I never noticed this issue π’
Instead of removing importHelpers
, I've added tslib as a dependency. That will fix the problem, but also reduce duplicate code when used with coc-stylelintplus. I've also pinned the version of vscode-languageserver-protocol in the package.json, which should fix the build problem you're having. Looks like MS made breaking changes without bumping the major version of that package π
I just published v1.2.1 with these updates. Can you give them a try and let me know if it works for you?
Thanks for the response and for the updates π v1.2.1 seems to work indeed. tslib
is no longer required, and vscode-languageserver-protocol
is at 3.15.3
. In the end, stylelint_lsp diagnostics are shown correctly:
With that, I'll close #14, #15, and #16
Thanks for fixing it π I appreciate it!
And yeah, that was kind of a silly move on MS part to keep the major version when doing breaking changes π
Yay! Glad it works! Thanks again for the detailed bug reports... Made it super easy to fix for ya =)
No prob, I'm glad I could help π
Hey, in #14 I have noticed that the
build
script fails after installing the packages withnpm
.`npm install` logs
``` 10:51 $ npm i > stylelint-lsp@1.2.0 prepare /home/grzegorz/projects/open-source/stylelint-lsp > run-s clean build ^[ > stylelint-lsp@1.2.0 clean /home/grzegorz/projects/open-source/stylelint-lsp > rimraf dist > stylelint-lsp@1.2.0 build /home/grzegorz/projects/open-source/stylelint-lsp > tsc -p tsconfig.build.json node_modules/vscode-languageserver/lib/callHierarchy.proposed.d.ts:5:58 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'CallHierarchyPrepareParams'. 5 onPrepare(handler: ServerRequestHandler' requires 1 type argument(s). 261 add
(type: NotificationType
, registerParams: RO): void; ~~~~~~~~~~~~~~~~~~~~~~~ node_modules/vscode-languageserver/lib/main.d.ts:267:25 - error TS2314: Generic type 'RequestType0' requires 2 type argument(s).
267 add(type: RequestType0, registerParams: RO): void;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:268:28 - error TS2314: Generic type 'RequestType
' requires 3 type argument(s). 268 add
(type: RequestType
, registerParams: RO): void; ~~~~~~~~~~~~~~~~~~~~~~~~ node_modules/vscode-languageserver/lib/main.d.ts:304:24 - error TS2315: Type 'NotificationType0' is not generic. 304 register(type: NotificationType0, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:305:27 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s). 305 register
(type: NotificationType
, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:313:61 - error TS2315: Type 'NotificationType0' is not generic.
313 register(unregisteration: BulkUnregistration, type: NotificationType0, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:314:64 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s). 314 register
(unregisteration: BulkUnregistration, type: NotificationType
, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:321:30 - error TS2314: Generic type 'RequestType0' requires 2 type argument(s).
321 register(type: RequestType0, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:322:33 - error TS2314: Generic type 'RequestType
' requires 3 type argument(s). 322 register
(type: RequestType
, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:330:67 - error TS2314: Generic type 'RequestType0' requires 2 type argument(s).
330 register(unregisteration: BulkUnregistration, type: RequestType0, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:331:70 - error TS2314: Generic type 'RequestType
' requires 3 type argument(s). 331 register
(unregisteration: BulkUnregistration, type: RequestType
, registerParams?: RO): Promise;
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:418:31 - error TS2314: Generic type 'RequestType0' requires 2 type argument(s).
418 onRequest(type: RequestType0, handler: RequestHandler0): void;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:419:34 - error TS2314: Generic type 'RequestType
' requires 3 type argument(s). 419 onRequest
(type: RequestType
, handler: RequestHandler
): void; ~~~~~~~~~~~~~~~~~~~~~~~~ node_modules/vscode-languageserver/lib/main.d.ts:439:33 - error TS2314: Generic type 'RequestType0' requires 2 type argument(s).
439 sendRequest(type: RequestType0, token?: CancellationToken): Promise;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:440:36 - error TS2314: Generic type 'RequestType
' requires 3 type argument(s). 440 sendRequest
(type: RequestType
, params: P, token?: CancellationToken): Promise;
~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:455:30 - error TS2315: Type 'NotificationType0' is not generic.
455 onNotification(type: NotificationType0, handler: NotificationHandler0): void;
~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:456:33 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s). 456 onNotification
(type: NotificationType
, handler: NotificationHandler
): void; ~~~~~~~~~~~~~~~~~~~~~~~ node_modules/vscode-languageserver/lib/main.d.ts:476:32 - error TS2315: Type 'NotificationType0' is not generic. 476 sendNotification(type: NotificationType0): void;
~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:477:35 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s). 477 sendNotification
(type: NotificationType
, params: P): void; ~~~~~~~~~~~~~~~~~~~~~~~ node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:5:51 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensParams'. 5 on(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:5:82 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokens'.
5 on(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:5:107 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensPartialResult'.
5 on(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:6:56 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensEditsParams'.
6 onEdits(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:6:92 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensEdits'.
6 onEdits(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:6:123 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokens'.
6 onEdits(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:6:148 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensEditsPartialResult'.
6 onEdits(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:6:192 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensEditsPartialResult'.
6 onEdits(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:7:56 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensRangeParams'.
7 onRange(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:7:92 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokens'.
7 onRange(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:7:117 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensPartialResult'.
7 onRange(handler: ServerRequestHandler): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:23:23 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokens'.
23 build(): Proposed.SemanticTokens;
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:25:28 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokens'.
25 buildEdits(): Proposed.SemanticTokens | Proposed.SemanticTokensEdits;
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/sematicTokens.proposed.d.ts:25:54 - error TS2694: Namespace '"/home/grzegorz/projects/open-source/stylelint-lsp/node_modules/vscode-languageserver-protocol/lib/common/api".Proposed' has no exported member 'SemanticTokensEdits'.
25 buildEdits(): Proposed.SemanticTokens | Proposed.SemanticTokensEdits;
~~~~~~~~~~~~~~~~~~~
src/buffered-message-queue.ts:9:3 - error TS2459: Module '"../node_modules/vscode-languageserver/lib/main"' declares 'RPCMessageType' locally, but it is not exported.
9 RPCMessageType,
~~~~~~~~~~~~~~
node_modules/vscode-languageserver/lib/main.d.ts:3:557
3 import { TextDocumentContentChangeEvent, TextDocumentSaveReason, Location, Command, TextEdit, WorkspaceEdit, CompletionItem, CompletionList, Hover, SignatureHelp, Definition, DocumentHighlight, SymbolInformation, DocumentSymbol, WorkspaceSymbolParams, DocumentSymbolParams, CodeLens, DocumentLink, Range, RequestType, RequestType0, RequestHandler, RequestHandler0, GenericRequestHandler, StarRequestHandler, HandlerResult, NotificationType, NotificationType0, NotificationHandler, NotificationHandler0, GenericNotificationHandler, StarNotificationHandler, RPCMessageType, MessageReader, MessageWriter, CancellationToken, Disposable, Event, ConnectionStrategy, InitializeParams, InitializeResult, InitializeError, InitializedParams, MessageActionItem, DidChangeConfigurationParams, DidOpenTextDocumentParams, DidChangeTextDocumentParams, DidCloseTextDocumentParams, DidSaveTextDocumentParams, WillSaveTextDocumentParams, DidChangeWatchedFilesParams, PublishDiagnosticsParams, CompletionParams, ReferenceParams, CodeActionParams, CodeLensParams, DocumentFormattingParams, DocumentRangeFormattingParams, DocumentOnTypeFormattingParams, RenameParams, DocumentLinkParams, ExecuteCommandParams, ApplyWorkspaceEditParams, ApplyWorkspaceEditResponse, ClientCapabilities, ServerCapabilities, DocumentColorParams, ColorInformation, ColorPresentationParams, ColorPresentation, CodeAction, FoldingRangeParams, FoldingRange, Declaration, DeclarationLink, DefinitionLink, SelectionRange, SelectionRangeParams, ProgressType, HoverParams, SignatureHelpParams, DefinitionParams, DocumentHighlightParams, PrepareRenameParams, DeclarationParams, TypeDefinitionParams, ImplementationParams, WorkDoneProgressParams, PartialResultParams } from 'vscode-languageserver-protocol';
~~~~~~~~~~~~~~
'RPCMessageType' is declared here.
src/buffered-message-queue.ts:145:11 - error TS2314: Generic type 'RequestType
' requires 3 type argument(s). 145 type: RequestType,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/buffered-message-queue.ts:150:38 - error TS7006: Parameter 'param' implicitly has an 'any' type.
150 this.connection.onRequest(type, (param, token) => {
~~~~~
src/buffered-message-queue.ts:150:45 - error TS7006: Parameter 'token' implicitly has an 'any' type.
150 this.connection.onRequest(type, (param, token) => {
~~~~~
src/buffered-message-queue.ts:181:11 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s). 181 type: NotificationType,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/buffered-message-queue.ts:186:42 - error TS7006: Parameter 'param' implicitly has an 'any' type.
186 this.connection.onNotification(type, param => {
~~~~~
src/buffered-message-queue.ts:204:11 - error TS2314: Generic type 'NotificationType
' requires 1 type argument(s). 204 type: NotificationType,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/buffered-message-queue.ts:244:24 - error TS2339: Property 'RequestCancelled' does not exist on type 'typeof ErrorCodes'.
244 ErrorCodes.RequestCancelled,
~~~~~~~~~~~~~~~~
src/buffered-message-queue.ts:264:24 - error TS2339: Property 'RequestCancelled' does not exist on type 'typeof ErrorCodes'.
264 ErrorCodes.RequestCancelled,
~~~~~~~~~~~~~~~~
src/index.ts:79:47 - error TS2558: Expected 1 type arguments, but got 2.
79 const exitNotification = new NotificationType<[number, string?], void>(
~~~~~~~~~~~~~~~~~~~~~~~
src/validate.ts:33:3 - error TS2558: Expected 1 type arguments, but got 2.
33 VersionedTextDocumentIdentifier,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34 void
~~~~~~
src/validate.ts:184:38 - error TS2571: Object is of type 'unknown'.
184 const document = documents.get(identifier.uri)
~~~~~~~~~~
src/validate.ts:199:19 - error TS2571: Object is of type 'unknown'.
199 (document) => document.version
~~~~~~~~
Found 56 errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! stylelint-lsp@1.2.0 build: `tsc -p tsconfig.build.json`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the stylelint-lsp@1.2.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/grzegorz/.npm/_logs/2021-04-22T08_51_32_767Z-debug.log
ERROR: "build" exited with 2.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! stylelint-lsp@1.2.0 prepare: `run-s clean build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the stylelint-lsp@1.2.0 prepare script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/grzegorz/.npm/_logs/2021-04-22T08_51_32_801Z-debug.log
```
As far as I have investigated, this is because the version of
vscode-languageserver-protocol
installed bynpm
is3.16.0
, which in turn includesvscode-jsonrpc@6.0.0
:Whereas when installing with yarn, the versions are
3.15.3
and5.0.1
respectively, set inyarn.lock
:This is likely because npm is trying to install the latest versions according to semver, and since there is no
package-lock.json
, it installs the ones that I listed above :worried:I see possible 2 solutions in this case :smile:
README
that contributors should useyarn
to install packagesvscode-languageserver-protocol@3.16.0
and refactor the code. It looks like 3.16.0 is quite a significant change in the vscode-languageserver ecosystem: https://github.com/microsoft/vscode-languageserver-node#3160-protocol-600-json-rpc-700-client-and-700-server