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

[#394] Add clangd console view for log data #395

Merged
merged 8 commits into from
Jan 23, 2025

Conversation

ghentschke
Copy link
Contributor

  • the logging can be enabled in the clangd preference page

fixes #394

- the logging can be enabled in the clangd preference page

fixes eclipse-cdt#394
@ghentschke ghentschke requested a review from ruspl-afed January 22, 2025 22:15
Copy link
Member

@jonahgraham jonahgraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change LGTM. I haven't run it up in the UI. See my comment on the issue too.

ghentschke and others added 3 commits January 23, 2025 15:01
because at startup we have no project info available. At startup time we
need to know if the stderr should be piped to the console.
// destroy LS process first, to prevent a write operation on a already closed output stream:
super.stop();
// then close output stream.
// TODO: we need to wait here until the process has been terminated:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to fix this in LSP4E. See eclipse-lsp4e/lsp4e#1194

@ghentschke ghentschke merged commit a999cb7 into eclipse-cdt:main Jan 23, 2025
3 checks passed
@ghentschke ghentschke deleted the add-clangd-console branch January 24, 2025 06:38
Copy link
Member

@ruspl-afed ruspl-afed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late review @ghentschke , I was out of connection for some time. Please have a look at my comments

@@ -15,7 +15,7 @@
import org.eclipse.core.resources.IProject;

/**
* @since 2.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this increment was necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, otherwise it hadn't build

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very strange. Does this mean that we had this interface for 2.1 already and now we need to redeclare the same interface for 2.2 as well? Or do we have a baseline configuration issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or do we have a baseline configuration issue?

Yes it didn't build because of that:
image
I was wondering as well and hadn't had the time for further investigations.

.getExtensionPoint(EXTENSION_ID).getConfigurationElements()) {
if (LOGGER_ELEMENT.equals(configurationElement.getName())) {
return Optional
.ofNullable((ILogProvider) getInstanceFromExtension(configurationElement, ILogProvider.class));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have multiple extensions, then the actual log provider becomes difficult to predict. Do we really need to introduce extension point for logger?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're having a point here. My thought was that this extension point is not intended to be used by external bundles as well (if so, we can still refactor) and I favor extension point mechanism over OSGi services.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..but when I think about the use case, a service provider would may be better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that you would prefer to have extension point here. But unfortunately, we are unlikely to be able to do two things:

  1. declare extension point as private
  2. declare extension point as singleton

But before searching for way how to solve these issues I need to ask: do we already have a need to replace your default implementation of console by something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we already have a need to replace your default implementation of console by something else?

The use case I can think about is a vendor who want to connect their own console to the clangd stderr output.

But I am currently thinking about a refactoring of this part, because I want to allow that the data from clangd stderr could be written onto several output streams in the AsyncStreamPipe.
Despite the use case above, I had the idea of a temporary parsing of stderr for clang-format failures when a user wants to format a source file. (See #400)

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 this pull request may close these issues.

Clangd console view for log data
3 participants