tommasongr / nova-vue

Vue support for Nova editor.
MIT License
37 stars 7 forks source link

Cannot insert import #28

Open dougalg opened 3 years ago

dougalg commented 3 years ago

If I type some code and want to add an import for something, I can type CMD + SHIFT + A, and get the action menu including "add import for..." as expected for an unimported item. However, when I select that item, the import is not added.

I didn't see this as a known issue in the readme, sorry if it's listed somewhere and I missed it.

tommasongr commented 3 years ago

Hi there! Thanks for the report @dougalg but I'm not really sure what are you referring to.

Is this action menu provided with vanilla Nova? I wasn't able to find it with the shortcut you pointed out or inside Nova as a whole. Would you mind be more descriptive about the process or even better attaching some screenshost?

Thanks a lot!

dougalg commented 3 years ago

Hi, @tommasongr thanks for your quick reply. I'm very new to Nova, so I'm not 100% sure 😅

I am using only the Vue and TypeScript plugins. After disabling the TS plugin, the action still appears:

image

You can get this action menu by placing the cursor on the unimported item and then either clicking the "lightbulb" or pressing "CMD + SHIFT + A". The key is that the cursor (not mouse cursor, but the text entry cursor) must be on the unimported item's text.

tommasongr commented 3 years ago

Hi there! Sorry for the delay.

I took the weekend for a big update/refactor #29. Now a lot of options for configuring the Vue Language Server (VLS) are exposed.

I'm not really sure what is the cause of your issue. Probably is something out of the scope of the extension. Maybe a problem of Nova or how Nova and the Vue Language Server communicates.

I tried to upgrade the working version of VLS to the latest release but I've encountered some breaking issues. I need to investigate on it.

Anyway I'm sorry that the problem isn't solved but maybe you can try to tweak the new preferences and see if something changes 🤷🏼‍♂️

I'll keep the issue open for now. Thanks

dougalg commented 3 years ago

You're doing this for free! Take as long as you want to reply, hahah 😄

Thanks for following up. Maybe if I can find some time it would be fun to delve into this a bit deeper, and see what the root cause is... time is, of course, the issue.

dougalg commented 3 years ago

Also, just to clarify, does auto-import work for you?

tommasongr commented 3 years ago

ahaha Thanks!

You are free to investigate as much as you want! I would love to have some help, also because most of the time I have no idea what I'm doing 😂

With the last update I basically rewritten all the Javascript implementation and add a lot of comments to explain as best as I can what is going on. If you decide to take a look that would help I hope.

Anyway auto-import doesn't work for me either... Probably @yoyo930021 is the right person to ask for some insights on this

tommasongr commented 3 years ago

Sorry, closed by accident ahaha

dougalg commented 3 years ago

Thanks a lot. I think you're right that it's probably a bug (or just missing feature) in Nova's language client.

yoyo930021 commented 3 years ago

It works fine in vscode. I don't know how to trace nova and language serve messages. =_= It can help us to find questions.

Probably reason:

  1. Vue LSP returns wrong data or unsupport date when codeAction.
  2. Vue LSP has some wrong with special env.
tommasongr commented 3 years ago

Thanks @yoyo930021 I'll reach out to @panicinc and see if they are aware of this issue

tommasongr commented 3 years ago

Anyway @yoyo930021 I selected the DEBUG log level, but I don't see any useful prompts.

This is all:

Vue Language Server[10:55:34.844000] [INFO ] Find node_modules paths in /Volumes/Macintosh HD/Users/tommaso/Studies/vue/hello-vue3 - 95ms

Vue Language Server[10:55:34.845000] [INFO ] Loaded bundled typescript@4.2.4.

Vue Language Server[10:55:34.893000] [INFO ] Loaded prettier@1.19.1 from /Volumes/Macintosh HD/Users/tommaso/Studies/vue/hello-vue3/node_modules/prettier.

Vue Language Server[10:55:34.893000] [INFO ] Loaded bundled @starptech/prettyhtml.

Vue Language Server[10:55:34.894000] [INFO ] Loaded bundled prettier-eslint.

Vue Language Server[10:55:34.894000] [INFO ] Loaded bundled prettier-tslint.

Vue Language Server[10:55:34.894000] [INFO ] Loaded bundled stylus-supremacy.

Vue Language Server[10:55:34.938000] [INFO ] Loaded bundled @prettier/plugin-pug.

Vue Language Server[10:55:34.938000] Vetur initialized
Schermata 2021-05-04 alle 10 59 04

When I fire the import action nothing is logged in the console. Is that right?


Another possible factor is that currently I'm using VLS v0.5.7 instead of the latest v0.7.2. I tried to upgrade but I encounted some breaking issues. This is what I get in the console when I try to run the v0.7.2:

Vue Language Server[11:04:53.713000] Vetur initialized

Vue Language Server[11:04:53.718000] Registering request handler for textDocument/formatting failed.

Vue Language Server[11:04:53.718000] (node:3468) UnhandledPromiseRejectionWarning: Error: Invalid parameter: registrations
Registrations must be of type Registration[]
    at /Users/tommaso/Library/Application Support/Nova/Extensions/com.tommasonegri.Vue/dependencyManagement/node_modules/vls/dist/vueServerMain.js:1:33573
    at /Users/tommaso/Library/Application Support/Nova/Extensions/com.tommasonegri.Vue/dependencyManagement/node_modules/vls/dist/vueServerMain.js:1:33868
    at Immediate.<anonymous> (/Users/tommaso/Library/Application Support/Nova/Extensions/com.tommasonegri.Vue/dependencyManagement/node_modules/vls/dist/vueServerMain.js:1:34233)
    at processImmediate (internal/timers.js:461:21)
(Use `node --trace-warnings ...` to show where the warning was created)

Vue Language Server[11:04:53.718000] (node:3468) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

Vue Language Server[11:04:53.718000] (node:3468) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Vue Language Server[11:04:53.719000] Registering request handler for workspace/didChangeWorkspaceFolders failed.

Vue Language Server[11:04:53.719000] (node:3468) UnhandledPromiseRejectionWarning: Error: Invalid parameter: registrations
Registrations must be of type Registration[]
    at /Users/tommaso/Library/Application Support/Nova/Extensions/com.tommasonegri.Vue/dependencyManagement/node_modules/vls/dist/vueServerMain.js:1:33573
    at /Users/tommaso/Library/Application Support/Nova/Extensions/com.tommasonegri.Vue/dependencyManagement/node_modules/vls/dist/vueServerMain.js:1:33868
    at Immediate.<anonymous> (/Users/tommaso/Library/Application Support/Nova/Extensions/com.tommasonegri.Vue/dependencyManagement/node_modules/vls/dist/vueServerMain.js:1:34233)
    at processImmediate (internal/timers.js:461:21)

Vue Language Server[11:04:53.719000] (node:3468) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)

Have any idea of what is going on? Thanks

yoyo930021 commented 3 years ago

Anyway @yoyo930021 I selected the DEBUG log level, but I don't see any useful prompts.

This is all:

Vue Language Server[10:55:34.844000] [INFO ] Find node_modules paths in /Volumes/Macintosh HD/Users/tommaso/Studies/vue/hello-vue3 - 95ms

Vue Language Server[10:55:34.845000] [INFO ] Loaded bundled typescript@4.2.4.

Vue Language Server[10:55:34.893000] [INFO ] Loaded prettier@1.19.1 from /Volumes/Macintosh HD/Users/tommaso/Studies/vue/hello-vue3/node_modules/prettier.

Vue Language Server[10:55:34.893000] [INFO ] Loaded bundled @starptech/prettyhtml.

Vue Language Server[10:55:34.894000] [INFO ] Loaded bundled prettier-eslint.

Vue Language Server[10:55:34.894000] [INFO ] Loaded bundled prettier-tslint.

Vue Language Server[10:55:34.894000] [INFO ] Loaded bundled stylus-supremacy.

Vue Language Server[10:55:34.938000] [INFO ] Loaded bundled @prettier/plugin-pug.

Vue Language Server[10:55:34.938000] Vetur initialized
Schermata 2021-05-04 alle 10 59 04

When I fire the import action nothing is logged in the console. Is that right?

The log level only provides minimal information.

I want this information. https://github.com/vuejs/vetur/wiki/Collecting-LSP-log But this option only works in vscode language client.

Another possible factor is that currently I'm using VLS v0.5.7 instead of the latest v0.7.2. I tried to upgrade but I encounted some breaking issues. This is what I get in the console when I try to run the v0.7.2:

Vue Language Server[11:04:53.713000] Vetur initialized

Vue Language Server[11:04:53.718000] Registering request handler for textDocument/formatting failed.

Vue Language Server[11:04:53.718000] (node:3468) UnhandledPromiseRejectionWarning: Error: Invalid parameter: registrations
Registrations must be of type Registration[]
    at /Users/tommaso/Library/Application Support/Nova/Extensions/com.tommasonegri.Vue/dependencyManagement/node_modules/vls/dist/vueServerMain.js:1:33573
    at /Users/tommaso/Library/Application Support/Nova/Extensions/com.tommasonegri.Vue/dependencyManagement/node_modules/vls/dist/vueServerMain.js:1:33868
    at Immediate.<anonymous> (/Users/tommaso/Library/Application Support/Nova/Extensions/com.tommasonegri.Vue/dependencyManagement/node_modules/vls/dist/vueServerMain.js:1:34233)
    at processImmediate (internal/timers.js:461:21)
(Use `node --trace-warnings ...` to show where the warning was created)

Vue Language Server[11:04:53.718000] (node:3468) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

Vue Language Server[11:04:53.718000] (node:3468) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Vue Language Server[11:04:53.719000] Registering request handler for workspace/didChangeWorkspaceFolders failed.

Vue Language Server[11:04:53.719000] (node:3468) UnhandledPromiseRejectionWarning: Error: Invalid parameter: registrations
Registrations must be of type Registration[]
    at /Users/tommaso/Library/Application Support/Nova/Extensions/com.tommasonegri.Vue/dependencyManagement/node_modules/vls/dist/vueServerMain.js:1:33573
    at /Users/tommaso/Library/Application Support/Nova/Extensions/com.tommasonegri.Vue/dependencyManagement/node_modules/vls/dist/vueServerMain.js:1:33868
    at Immediate.<anonymous> (/Users/tommaso/Library/Application Support/Nova/Extensions/com.tommasonegri.Vue/dependencyManagement/node_modules/vls/dist/vueServerMain.js:1:34233)
    at processImmediate (internal/timers.js:461:21)

Vue Language Server[11:04:53.719000] (node:3468) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)

Have any idea of what is going on? Thanks

I think it's a nova language client problem. Relative issue: https://github.com/bmewburn/vscode-intelephense/issues/1534

https://microsoft.github.io/language-server-protocol/specifications/specification-current/#client_registerCapability This request is wrong from nova language client.

tommasongr commented 3 years ago

Thanks! I'll report it

dougalg commented 3 years ago

Thanks @tommasongr and @yoyo930021 for debugging this!

Adding a link to the Nova thread as well, to make it easier to cross-reference: https://devforum.nova.app/t/lsp-import-action-error/860