ratmice / nimbleparse_lsp

lsp server for grmtools lex & yacc
Other
7 stars 1 forks source link

Railroad diagram generator fails when command is run with non-yacc filetype active #38

Open liluyue opened 1 month ago

liluyue commented 1 month ago

ERR cannot open nimbleparse_lsp://railroad.svg.cmd/railroad.svg?%2FUsers%2Fliluyue%2Frust_workspace%2Fnimbleparse_lsp%2Ftests%2Fgoodproject%2Fnimbleparse.toml. Detail: Unable to resolve text model content for resource nimbleparse_lsp://railroad.svg.cmd/railroad.svg?%2FUsers%2Fliluyue%2Frust_workspace%2Fnimbleparse_lsp%2Ftests%2Fgoodproject%2Fnimbleparse.toml: CodeExpectedError: cannot open nimbleparse_lsp://railroad.svg.cmd/railroad.svg?%2FUsers%2Fliluyue%2Frust_workspace%2Fnimbleparse_lsp%2Ftests%2Fgoodproject%2Fnimbleparse.toml. Detail: Unable to resolve text model content for resource nimbleparse_lsp://railroad.svg.cmd/railroad.svg?%2FUsers%2Fliluyue%2Frust_workspace%2Fnimbleparse_lsp%2Ftests%2Fgoodproject%2Fnimbleparse.toml at n.$tryOpenDocument (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2195:62578)

ratmice commented 1 month ago

I'll need to look into this, in general the javascript/vscode pieces to this could use some work as i'm not really familiar with the language or APIs beyond this project, but from recollection I believe that what might be going on is that the command only worked properly when a grammar/yacc file has focus. from the error, it appears as though the .toml file has focus.

It is also possible though that this has regressed since the last time I tried it.

liluyue commented 1 month ago

successful.is

command only worked properly when a grammar/yacc file has focus.

this is no statement in the document

ratmice commented 1 month ago

Indeed, this is all fairly proof of concept quality work at the moment.

What I was hoping was rather to replace the commands with some form of UX that is specific to the yacc filetype on the VSCode side rather than keep the current mechanism where the command exists for all filetypes but only works if the right type is selected.

There are similar issues with the generictree ast generator (requires an input file), and the state table commands (again parser). But you're right I should document these as limitations until A better mechanism is found.

ratmice commented 1 month ago

also worth noting this is related to point 3 of #36

liluyue commented 1 month ago

I add a view on activitybar,It is convenient to obtain the lsp command. Do you think it is necessary to integrate it into your plugin. The screenshot is as follows

截屏2024-05-09 16 39 15

code

ratmice commented 1 month ago

That seems like it would be most welcome, do you think that there is a way we can enable/disable the item in the activity bar depending upon the current filetype?

liluyue commented 1 month ago

That seems like it would be most welcome, do you think that there is a way we can enable/disable the item in the activity bar depending upon the current filetype?

Yes.Provide help links or hover prompts when unavailable

ratmice commented 1 month ago

One thing I note though is the link here: https://code.visualstudio.com/api/ux-guidelines/activity-bar

Don't

  • Use an Activity Bar item to open a Webview Panel

Seems like all these actions probably qualify as opening webview panels. So it seems like this would for some reason be going against the ux guidelines. Still I would probably consider it an improvement over what we currently have

liluyue commented 1 month ago

This requires self-made SVG images. For simplicity, it is recommended to include text inside the SVG.

Duplicate an existing icon

I used the TreeDataProvider recommended by vscode in the code above, and did not create a self-made Webview Panel. Corresponding help information and other information that require opening the Webview Panel, along with a list option, can be clicked by the user to open it in the editing area, which does not violate the guidelines

Use an Activity Bar item to open a Webview Panel
ratmice commented 1 month ago

I was referring specifically to the Webview opened here extension.ts as part of the railroad diagram code. It is entirely possible and I wouldn't be surprised if there is some misunderstanding on my part regarding this though.

liluyue commented 1 month ago

I was referring specifically to the Webview opened here extension.ts as part of the railroad diagram code. It is entirely possible and I wouldn't be surprised if there is some misunderstanding on my part regarding this though.

Guidelines is referring do not use Webview Panel within the Activity Bar. cmd is used in the editing area and does not violate guidelines

ratmice commented 1 month ago

Great, thanks for clarifying!