Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use stylelint-vscode from vscode-stylelint #10

Closed

Conversation

guillaumewuip
Copy link
Contributor

@guillaumewuip guillaumewuip commented Feb 23, 2020

Fixes #9

This PR to use the latest stylelint-vscode lib (now in vscode-stylelint) in order to take advantage of stylelint/vscode-stylelint#26

@guillaumewuip
Copy link
Contributor Author

Apparently I have still something to do as diagnostics don't show up in nvim.

I've try to log things from here

https://github.com/guillaumewuip/coc-stylelint/blob/40861f39965074c444337d666ebadb06a86c9d5d/server/server.ts#L50-L53

with something like

    const d = await stylelintVSCode(document, options);
  
    connection.window.showErrorMessage(`stylelint: ${JSON.stringify(d)}`) ;

    connection.sendDiagnostics({
      uri: document.uri,
      diagnostics: await stylelintVSCode(document, options)
    })

I do see the diagnostics in the error message.

I don't understand what is going on and as I'm not familiar with coc and vscode extensions I don't know where to look for errors. Any hint @chemzqm ?

@chemzqm
Copy link
Member

chemzqm commented Feb 24, 2020

npm is used for install extension by default, but "vscode-stylelint": "github:stylelint/vscode-stylelint#v0.83.0" can't be recognized by npm

@guillaumewuip
Copy link
Contributor Author

Ok, I've updated the field to "git://github.com/stylelint/vscode-stylelint#v0.83.0" which should be npm-compatible and installed the extension with yarn add https://github.com/guillaumewuip/coc-stylelint#update-stylelintVSCode in .config/coc/extensions. Still no diagnostic.

Here is my :CocOpenLog output

2020-02-24T09:09:46.599 INFO (pid:3537) [services] - registered service "eslint"
2020-02-24T09:09:46.612 INFO (pid:3537) [services] - registered service "highlight"
2020-02-24T09:09:46.698 INFO (pid:3537) [plugin] - coc 0.0.74-377c2729b9 initialized with node: v12.16.0
2020-02-24T09:09:46.703 INFO (pid:3537) [language-client-index] - highlight started with 3543
2020-02-24T09:09:46.778 INFO (pid:3537) [watchman] - watchman watching project: .......
2020-02-24T09:09:46.788 INFO (pid:3537) [services] - highlight server state change: starting => running
2020-02-24T09:09:46.823 INFO (pid:3537) [watchman] - watchman watching project: .........
2020-02-24T09:09:50.817 INFO (pid:3537) [services] - registered service "css"
2020-02-24T09:09:50.818 INFO (pid:3537) [services] - Css language server state change: stopped => starting
2020-02-24T09:09:50.823 INFO (pid:3537) [services] - registered service "stylelint"
2020-02-24T09:09:50.823 INFO (pid:3537) [services] - stylelint langserver state change: stopped => starting
2020-02-24T09:09:50.843 INFO (pid:3537) [language-client-index] - css started with 3611
2020-02-24T09:09:50.853 INFO (pid:3537) [language-client-index] - stylelint started with 3612
2020-02-24T09:09:51.083 INFO (pid:3537) [services] - stylelint langserver state change: starting => running
2020-02-24T09:09:51.084 INFO (pid:3537) [services] - service stylelint started
2020-02-24T09:09:51.092 INFO (pid:3537) [services] - Css language server state change: starting => running
2020-02-24T09:09:51.094 INFO (pid:3537) [services] - service css started
2020-02-24T09:09:52.337 ERROR (pid:3537) [language-client-client] - Notification handler 'textDocument/publishDiagnostics' failed with message: diagnostics.forEach is not a function
2020-02-24T09:09:53.227 ERROR (pid:3537) [language-client-client] - Notification handler 'textDocument/publishDiagnostics' failed with message: diagnostics.forEach is not a function
2020-02-24T09:09:54.153 ERROR (pid:3537) [language-client-client] - Notification handler 'textDocument/publishDiagnostics' failed with message: diagnostics.forEach is not a function
2020-02-24T09:09:56.206 ERROR (pid:3537) [language-client-client] - Notification handler 'textDocument/publishDiagnostics' failed with message: diagnostics.forEach is not a function
2020-02-24T09:09:56.434 ERROR (pid:3537) [language-client-client] - Notification handler 'textDocument/publishDiagnostics' failed with message: diagnostics.forEach is not a function
2020-02-24T09:09:57.029 ERROR (pid:3537) [language-client-client] - Notification handler 'textDocument/publishDiagnostics' failed with message: diagnostics.forEach is not a function
2020-02-24T09:09:59.200 ERROR (pid:3537) [language-client-client] - Notification handler 'textDocument/publishDiagnostics' failed with message: diagnostics.forEach is not a function
2020-02-24T09:10:01.762 ERROR (pid:3537) [language-client-client] - Notification handler 'textDocument/publishDiagnostics' failed with message: diagnostics.forEach is not a function
2020-02-24T09:10:04.781 ERROR (pid:3537) [language-client-client] - Notification handler 'textDocument/publishDiagnostics' failed with message: diagnostics.forEach is not a function

stylelint is started which I think say that the extension is well installed and running. I don't know how to interpret Notification handler 'textDocument/publishDiagnostics' failed with message: diagnostics.forEach is not a function. What to you think I miss ?

@guillaumewuip guillaumewuip marked this pull request as ready for review February 29, 2020 22:54
@guillaumewuip
Copy link
Contributor Author

Ok, it's ready @chemzqm. My problem was that stylelintVSCode now returns an object.

@guillaumewuip guillaumewuip mentioned this pull request Mar 1, 2020
@chemzqm
Copy link
Member

chemzqm commented Mar 2, 2020

We should not use source code from github directly, since it can be easily broken, we could rework it like https://github.com/stylelint/vscode-stylelint

@guillaumewuip
Copy link
Contributor Author

Ok I understand.

The stylelint/vscode-stylelint team has an issue to publish stylelint-vscode back to npm (stylelint/vscode-stylelint#65). I will watch their progress and push another PR once the npm package is published again, if that sounds ok for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update to latest vscode-stylelint
2 participants