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

Disable CDT indexer when LSP is activated #147

Open
ghentschke opened this issue Jul 4, 2023 · 8 comments
Open

Disable CDT indexer when LSP is activated #147

ghentschke opened this issue Jul 4, 2023 · 8 comments
Labels
enhancement New feature or request

Comments

@ghentschke
Copy link
Contributor

When the LSP editor is used in a C/C++ project or workspace, the CDT indexer should be disabled for the project or workspace:

image

Alternative: Disable and hide indexer settings when LSP editor is activated?

@ghentschke
Copy link
Contributor Author

I am not sure if this should be done automatically.
Maybe it's a better approach that the user has to do it manually. Either on project or on workspace level, depending on the users workflow (i.e. the user may want to use the LSP based editor only for a single project in his workspace).

However, this issue here will introduce a dependency the user is not aware of.
Another idea is, that we show a pop-up info window when the user enables the 'Prefer C/C++ Editor (LSP)' check-box. In this window we can recommend to disable the indexer for the project or the workspace (depending on the pref scope). To not annoy the user to much, we can add something like 'Don't show this dialog again' to the dialog box.

@jonahgraham WDYT?

@jonahgraham
Copy link
Member

we show a pop-up info window when the user enables the 'Prefer C/C++ Editor (LSP)' check-box.

I think this is a good idea for the first version(s) - it makes it explicit what is going on. That should also allow vendors to default LSP on and Indexer off without prompts and in the future we can make the "don't show this dialog again" the default so that it isn't shown.

@ghentschke
Copy link
Contributor Author

That should also allow vendors to default LSP on and Indexer off without prompts

Is there already a API to disable the indexer? I.e. via extension point(s)?

@jonahgraham
Copy link
Member

That should also allow vendors to default LSP on and Indexer off without prompts

Is there already a API to disable the indexer? I.e. via extension point(s)?

I simply don't know :-( If you need help finding answer let me know. I doubt there is an extension point mechanism to control it, there is probably code, but it may not be API. Like the other changes though I wouldn't make any new public API for this and just make cdt lsp friends with cdt.

@ghentschke
Copy link
Contributor Author

I investigated it a little. I think we should provide a extension for this. I think it must be somewhere around here:
org.eclipse.cdt.ui.dialogs.IndexerBlock

@ghentschke
Copy link
Contributor Author

The extension could implement a method like boolean isIndexEnabled(IProject) which will be called prior to opening the project properties UI. If the method return false, the indexer page is not shown.
And the extension method must be considered in the PDOMManager as well: i.e. in org.eclipse.cdt.internal.core.pdom.PDOMManager.getIndexerId(ICProject)

But that's not the end of the story. IPDOMManager.ID_NO_INDEXER gets called a lot of times in the cdt codebase.

@ghentschke ghentschke added the enhancement New feature or request label Aug 8, 2023
@kolipakakondal
Copy link
Contributor

If there is a preference store id for the Enable Indexer option, probably we can overwrite the value whenever LSP(Editor) is enabled based on the user choice. I haven't check the internals.

@jantje
Copy link

jantje commented Aug 22, 2024

Is there already a API to disable the indexer? I.e. via extension point(s)?

This does the trick for me to disable the indexer at the workspace level.
CCorePlugin.getIndexManager().setDefaultIndexerId( IPDOMManager.ID_NO_INDEXER );

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

4 participants