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

Start LS when a C/C++ file is opened with the LSP based editor #231

Open
ghentschke opened this issue Jan 17, 2024 · 5 comments
Open

Start LS when a C/C++ file is opened with the LSP based editor #231

ghentschke opened this issue Jan 17, 2024 · 5 comments

Comments

@ghentschke
Copy link
Contributor

It turns out that users expect the LS to be started when C/C++ file is opened in the new editor (see this comment)

@ghentschke
Copy link
Contributor Author

ghentschke commented Feb 12, 2024

The enable of the LS is coupled to the parent project properties of the file to be opened or on the workspace preferences (under Editor (LSP)). If Set C/C++ Editor (LSP) as default is set, the LS will be started, when this file gets opened in an editor. Furthermore, a file opening with the old C/C++ editor will be prevented. This shall ensure, that the LS won't be started, when a file gets opened with the old editor (via Open With).
This is necessary, because there is no coupling of the LS to a fixed editor by LSP4E design, and a files document can be opened in several editors at the same time in Eclipse.
Conclusion: The LS has no knowledge about the editor to be used for a file. Therefor the LS cannot should not be started when a file gets opened in the LS-based editor via Open With

@ghentschke
Copy link
Contributor Author

I think this PR for this platform issue could makes the handling a little easier.

@ghentschke
Copy link
Contributor Author

Fixed by this Eclipse platform PR #1665 together with this cdt PR #809

@ghentschke
Copy link
Contributor Author

Fixed by this Eclipse platform PR #1665 together with this cdt PR #809

I was too fast. This fixes only works for external files. If the user selects a C/C++ source file from a C/C++ project for which Set C/C++ Editor (LSP) as default has been disabled:
image
and selects the new C/C Editor (LSP) to open the file with:
image

then the LS won't be started, because it has been disabled for the project (see first screenshot)

So the user has to enable it via the checkbox in the first screenshot. I don't see the use case for using different editors for files in the same project.

@ghentschke
Copy link
Contributor Author

I think a warning/error dialog should pop up, if a source file has been opened in the new editor and the LS has not been started. It should inform the user and asks if the Set C/C++ Editor (LSP) as default checkbox has been enabled for this project/workspace.

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

1 participant