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

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

Open
liluyue opened this issue May 9, 2024 · 12 comments

Comments

@liluyue
Copy link

liluyue commented May 9, 2024

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
Copy link
Owner

ratmice commented May 9, 2024

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
Copy link
Author

liluyue commented May 9, 2024

successful.is

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

this is no statement in the document

@ratmice
Copy link
Owner

ratmice commented May 9, 2024

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 ratmice changed the title vscode error Railroad diagram generator fails when command is run with non-yacc filetype active May 9, 2024
@ratmice
Copy link
Owner

ratmice commented May 9, 2024

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

@liluyue
Copy link
Author

liluyue commented May 9, 2024

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
Copy link
Owner

ratmice commented May 9, 2024

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
Copy link
Author

liluyue commented May 9, 2024

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
Copy link
Owner

ratmice commented May 9, 2024

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
Copy link
Author

liluyue commented May 9, 2024

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
Copy link
Owner

ratmice commented May 9, 2024

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
Copy link
Author

liluyue commented May 9, 2024

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
Copy link
Owner

ratmice commented May 9, 2024

Great, thanks for clarifying!

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

No branches or pull requests

2 participants