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

C/C++ Editor (LSP) opening files in standard C/C++ Editor instead #95

Closed
kolipakakondal opened this issue May 18, 2023 · 7 comments · Fixed by #97
Closed

C/C++ Editor (LSP) opening files in standard C/C++ Editor instead #95

kolipakakondal opened this issue May 18, 2023 · 7 comments · Fixed by #97
Milestone

Comments

@kolipakakondal
Copy link
Contributor

I am experiencing an issue with the C/C++ Editor (LSP). I have selected the C/C++ Editor (LSP) option in the Editor(LSP) Preferences. However, when I double click on a file, it does not open in the C/C++ Editor (LSP) as expected. Instead, it opens in the standard C/C++ Editor. However, if I choose the C/C++ Editor (LSP) from the menu list and click on it, then it opens in the C/C++ Editor (LSP).

Please correct me if I am wrong in my understanding of the C/C++ Editor (LSP) preference option.

Please find the screen recording for your reference.

IRkM6eIz59.mp4
@ghentschke
Copy link
Contributor

The "Prefer C/C++ Editor (LSP)" setting must be enabled in the project properties as well for existing projects in the workspace:
image

The workspace setting will be inherited for new projects in the workspace.

ghentschke added a commit to ghentschke/eclipse-cdt-lsp that referenced this issue May 22, 2023
ghentschke added a commit to ghentschke/eclipse-cdt-lsp that referenced this issue May 22, 2023
ghentschke added a commit that referenced this issue May 22, 2023
@kolipakakondal
Copy link
Contributor Author

Hi @ghentschke I have reviewed again today, this does not seem to work for me even after enabling Prefer C/C++ Editor (LSP) in the central preferences and project preferences. Am I missing anything?

If I create a new file in the project, it's opening in the LSP editor. If I close the same file and reopen it, it's opening the old C/C++ editor.

@ghentschke
Copy link
Contributor

ghentschke commented Aug 10, 2023

If I create a new file in the project, it's opening in the LSP editor. If I close the same file and reopen it, it's opening the old C/C++ editor.

The file association to the new editor needs at least CDT 11.2.0 for proper work.

Do you use the latest cdt-lsp bundles?

@ghentschke
Copy link
Contributor

Do you see entries in the Error Log?

@ghentschke
Copy link
Contributor

When opening the context menu on a c file in a LSP enabled project it should look like this:
image
The new editor should be the defualt.
If not, can you select the new editor via Open With -> Other...

@ghentschke
Copy link
Contributor

ghentschke commented Aug 10, 2023

I've seen that you started Eclipse from source. Can you set breakpoints in the override methods in CEditorAssociationOverride i.e. org.eclipse.cdt.lsp.editor.CEditorAssociationOverride.overrideEditors(IEditorInput, IContentType, IEditorDescriptor[])

They should be hidden, when opening a C/C++ file. They should return a IEditorDescriptor which points to the new editor ID org.eclipse.cdt.lsp.CEditor

@kolipakakondal
Copy link
Contributor Author

CDT 11.2.0

Hi @ghentschke CDT 11.2.0 did the magic! I was using CDT 11.1.0 earlier. Thank you so much!

@jonahgraham jonahgraham added this to the 1.0.0 milestone Sep 18, 2023
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

Successfully merging a pull request may close this issue.

3 participants