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

Support for autocompletion of xref xml:ids #30

Closed
StevenClontz opened this issue Apr 24, 2023 · 8 comments
Closed

Support for autocompletion of xref xml:ids #30

StevenClontz opened this issue Apr 24, 2023 · 8 comments

Comments

@StevenClontz
Copy link

No description provided.

@angelozerr
Copy link
Contributor

angelozerr commented Jul 15, 2023

vscode xml provide the xml.references to manage this usecase , see https://github.com/redhat-developer/vscode-xml/blob/main/docs/Features/XMLReferencesFeatures.md#attribute-node-references-fooattr

Once you will have declared in settings the proper références you will benefit with completion validation hyperlink find références and rename.

There are some few limitation when you will use included document. Please read the doc at https://github.com/redhat-developer/vscode-xml/blob/main/docs/Features/XMLReferencesFeatures.md#limitation

@angelozerr
Copy link
Contributor

@oscarlevin as you have defined a default vscode-xml settings for pretext, I think this issue can be closed, no?

@StevenClontz
Copy link
Author

It does suggest xml:ids from the currently edited file, but does not see any xml:ids from other files in the PreTeXt project.

@angelozerr
Copy link
Contributor

It does suggest xml:ids from the currently edited file, but does not see any xml:ids from other files in the PreTeXt project.

Scanning all files from the project could degrade the performance, but if you use xi:include it should work no?

@oscarlevin
Copy link
Owner

It's somewhere in between now. Any xi:included file works (i.e., you see suggestions of refs in files that are below your current file in the tree). But you don't look up the tree.

I agree that scanning all files seems like the wrong thing to do (and would be incorrect if you had files that are not part of the main document anyway). What about finding the root document, or setting it as a default for the workspace, and always scanning the xml tree from there? I haven't looked at any code yet, but perhaps there is a way to leverage the xml extension for this purpose. So instead of using the current file, use main.ptx in whatever search it uses.

@angelozerr, do you think a setting like this would be useful for other users of the xml extension? Perhaps an upstream contribution would be worthwhile?

@angelozerr
Copy link
Contributor

For the moment there are no way to customize the files scope to scan. Please create an issue in lemminx side with your suggestion in détail.

@oscarlevin
Copy link
Owner

Done here: eclipse-lemminx/lemminx#1576

@oscarlevin
Copy link
Owner

I have implemented a version of this directly in pretext-tools now. At startup, the extension scans all the files for xml:ids and stores them. Whenever a file is saved, it refreshes the ids for that file. Seems to be working well so far. Could give false positives if you have files that are not included but still in your source directory.

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

3 participants