Skip to content

Commit

Permalink
feat: improve detail of LSP console
Browse files Browse the repository at this point in the history
Signed-off-by: azerr <azerr@redhat.com>
  • Loading branch information
angelozerr authored and fbricon committed Mar 25, 2024
1 parent cd5fad6 commit da1907b
Show file tree
Hide file tree
Showing 28 changed files with 972 additions and 374 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ LSP4IJ also provides:

![LSP console](./docs/images/LSPConsole.png)

If you select the language server node, you can configure it the same way as in the [Language Servers preferences page](./docs/UserGuide.md#language-servers-preferences)

![LSP language server detail](./docs/images/LSPLanguageServerDetail.png)

and use the left toolbar to `Apply` or `Reset` the settings.

* a [Language Servers preferences page](./docs/UserGuide.md#language-servers-preferences) to configure the LSP trace level, the debug port to use to debug language server:

![Language Server preferences](./docs/images/LanguageServerPreferences.png)
Expand Down Expand Up @@ -120,6 +126,10 @@ You can select:
* `None` : in this case the language server error will be ignored.
* `In notification` (default value) : in this case the language server error appear as a `notification`:
![Error in notification](./docs/images/troubleshooting/LanguageServerErrorInNotification.png)
The error notification shows 3 possible actions:
* `Disable error reporting` : sets the error reporting to `None`.
* `Report error in Log` : sets the error reporting to `In log`.
* `Open LSP4IJ documentation` : opens this documentation.
* `In log` : in this case the language server error will be logged in the standard `IntelliJ log`:
![Error in log](./docs/images/troubleshooting/LanguageServerErrorInLog.png)

Expand Down
Binary file modified docs/images/LSPConsoleSettings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/LSPLanguageServerDetail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*******************************************************************************
* Copyright (c) 2024 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package com.redhat.devtools.lsp4ij;

/**
* LSP4IJ Url documentation
*
* @see <a href="https://github.com/redhat-developer/lsp4ij">LSP4IJ</a>
*/
public class LSP4IJWebsiteUrlConstants {

public static final String FEEDBACK_URL = "https://github.com/redhat-developer/lsp4ij#feedback";
}
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,23 @@ private void removeAssociationsFor(LanguageServerDefinition definition) {
fileAssociations.removeAll(mappingsToRemove);
}


public void updateServerDefinition(@NotNull UserDefinedLanguageServerDefinition serverDefinition,
@Nullable String name,
@Nullable String commandLine,
@NotNull List<ServerMappingSettings> mappings,
@Nullable String configurationContent,
@Nullable String initializationOptionsContent) {
updateServerDefinition(serverDefinition, name, commandLine, mappings, configurationContent, initializationOptionsContent, true);
}

@Nullable
public LanguageServerDefinitionListener.LanguageServerChangedEvent updateServerDefinition(@NotNull UserDefinedLanguageServerDefinition serverDefinition,
@Nullable String name,
@Nullable String commandLine,
@NotNull List<ServerMappingSettings> mappings,
@Nullable String configurationContent,
@Nullable String initializationOptionsContent) {
@Nullable String initializationOptionsContent,
boolean notify) {
String languageServerId = serverDefinition.getId();
serverDefinition.setName(name);
serverDefinition.setCommandLine(commandLine);
Expand Down Expand Up @@ -417,12 +427,20 @@ public void updateServerDefinition(@NotNull UserDefinedLanguageServerDefinition
if (nameChanged || commandChanged || mappingsChanged || configurationContentChanged || initializationOptionsContentChanged) {
// Notifications
LanguageServerDefinitionListener.LanguageServerChangedEvent event = new LanguageServerDefinitionListener.LanguageServerChangedEvent(serverDefinition, nameChanged, commandChanged, mappingsChanged, configurationContentChanged, initializationOptionsContentChanged);
for (LanguageServerDefinitionListener listener : this.listeners) {
try {
listener.handleChanged(event);
} catch (Exception e) {
LOGGER.error("Error while server definition has changed of the language server '" + languageServerId + "'", e);
}
if (notify) {
handleChangeEvent(event);
}
return event;
}
return null;
}

public void handleChangeEvent(LanguageServerDefinitionListener.LanguageServerChangedEvent event) {
for (LanguageServerDefinitionListener listener : this.listeners) {
try {
listener.handleChanged(event);
} catch (Exception e) {
LOGGER.error("Error while server definition has changed of the language server '" + event.serverDefinition.getId() + "'", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ public void handleRemoved(@NotNull LanguageServerDefinitionListener.LanguageServ
@Override
public void handleChanged(@NotNull LanguageServerChangedEvent event) {
if (event.commandChanged || event.mappingsChanged) {
// Stop all servers where command or mappings has changed
List<LanguageServerWrapper> serversToStop = startedServers
// Restart all servers where command or mappings has changed
List<LanguageServerWrapper> serversToRestart = startedServers
.stream()
.filter(server -> event.serverDefinition.equals(server.getServerDefinition()))
.collect(Collectors.toList());
serversToStop.forEach(LanguageServerWrapper::stop);
serversToRestart.forEach(LanguageServerWrapper::restart);
}
}
};
Expand Down
Loading

0 comments on commit da1907b

Please sign in to comment.