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

Feature: dynamically grab target definition and build completion out of it #12

Open
edbzn opened this issue May 27, 2022 · 3 comments
Open
Labels
enhancement New feature or request

Comments

@edbzn
Copy link
Member

edbzn commented May 27, 2022

Actually, the plugin statically describes commands and their arguments. It might break on different workspaces as they may use another type of executor than the one described in the plugin.

To fix this issue we could dynamically grab the target definition and build the completion out of it.

@edbzn edbzn added the enhancement New feature or request label May 27, 2022
@barbados-clemens
Copy link

barbados-clemens commented Mar 6, 2023

wonder if there is a way to leverage nxls, the nx language server or if there is a way to exec commands like nx show projects or just nx graph (just saw that the plugin does use nx graph 🙃 ) and be able to use that information for completions. Esp for workspaces that no longer have workspace.json.

I don't know anything about zsh plugins so idk if any of that is possible, but would be a great QoL improvement if it is possible.

Just some ideas 😃

@edbzn
Copy link
Member Author

edbzn commented Mar 6, 2023

Hi @barbados-clemens, thanks for the input.

How could the nx language server be used? An example of its usage could help to see if it's usable with Zsh.

We recently fixed the completion to work without workspace.json file, so now it generates a graph using nx graph in /tmp that is used to build the completion for each workspace.

However, there are some limitations and I don't know how to overcome them. One limitation is that shortcut commands like nx custom-command my-project are not autocompleted dynamically, it is because we need to statically describe the command and its options to zsh compdef.

Note that command completion works well when using nx verbose style, eg: nx run my-project:custom-command, but without any option completion.

So yeah, all of this seems very hard to do with Zsh, or I just ignore how to do it... so if anybody has Zsh knowledge, raise your hand.

@barbados-clemens
Copy link

the nx lsp basically contains a bunch of info about the workspace itself, like different executor options and generator options. which can be helpful for getting auto complete for targets, but generating the target list dynamically is really the thing I'd really like. which can all be done via the graph, except (like you mentioned) the plugin has to statically define all sub commands.

I didn't realize the plugin was using the nx graph when first commenting, I was using an older version and needed to update (kept getting the warning about no workspace.json.

if there was a way to have lazy init of the sub commands, then that would be all we needed, but I guess it's not really possible with the zsh plugin system. :/

Thanks for all the hard work on this plugin though really appreciate it!

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

No branches or pull requests

2 participants