-
Notifications
You must be signed in to change notification settings - Fork 51
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
feat: Provide InlayHint for property expression in microprofile-config.properties #972
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/MicroProfileBundle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Red Hat Inc. and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package com.redhat.devtools.intellij.lsp4mp4ij; | ||
|
||
import com.intellij.DynamicBundle; | ||
import org.jetbrains.annotations.Nls; | ||
import org.jetbrains.annotations.NonNls; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.PropertyKey; | ||
|
||
import java.util.function.Supplier; | ||
|
||
/** | ||
* MicroProfile messages bundle. | ||
*/ | ||
public final class MicroProfileBundle extends DynamicBundle { | ||
|
||
@NonNls public static final String BUNDLE = "messages.MicroProfileBundle"; | ||
private static final MicroProfileBundle INSTANCE = new MicroProfileBundle(); | ||
|
||
private MicroProfileBundle() { | ||
super(BUNDLE); | ||
} | ||
|
||
@NotNull | ||
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) { | ||
return INSTANCE.getMessage(key, params); | ||
} | ||
|
||
@NotNull | ||
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) { | ||
return INSTANCE.getLazyMessage(key, params); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/MicroProfileConfigurable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Red Hat Inc. and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package com.redhat.devtools.intellij.lsp4mp4ij.settings; | ||
|
||
import com.intellij.openapi.options.ConfigurationException; | ||
import com.intellij.openapi.ui.NamedConfigurable; | ||
import com.intellij.openapi.util.NlsContexts; | ||
import com.redhat.devtools.intellij.lsp4mp4ij.MicroProfileBundle; | ||
|
||
import javax.swing.*; | ||
|
||
/** | ||
* MicroProfile configuration. | ||
*/ | ||
public class MicroProfileConfigurable extends NamedConfigurable<UserDefinedMicroProfileSettings> { | ||
|
||
private MicroProfileView myView; | ||
|
||
public MicroProfileConfigurable() { | ||
} | ||
|
||
@Override | ||
public UserDefinedMicroProfileSettings getEditableObject() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public @NlsContexts.DetailedDescription String getBannerSlogan() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public JComponent createOptionsPanel() { | ||
if (myView == null) { | ||
myView = new MicroProfileView(); | ||
} | ||
return myView.getComponent(); | ||
} | ||
|
||
@Override | ||
public void setDisplayName(String name) { | ||
} | ||
|
||
@Override | ||
public @NlsContexts.ConfigurableName String getDisplayName() { | ||
return MicroProfileBundle.message("microprofile"); | ||
} | ||
|
||
|
||
@Override | ||
public boolean isModified() { | ||
if (myView == null) return false; | ||
return false; | ||
} | ||
|
||
@Override | ||
public void apply() throws ConfigurationException { | ||
// Do nothing | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...ava/com/redhat/devtools/intellij/lsp4mp4ij/settings/MicroProfileConfigurableProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Red Hat Inc. and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package com.redhat.devtools.intellij.lsp4mp4ij.settings; | ||
|
||
import com.intellij.openapi.options.Configurable; | ||
import com.intellij.openapi.options.ConfigurableProvider; | ||
|
||
/** | ||
* MicroProfile UI settings provider. | ||
*/ | ||
public class MicroProfileConfigurableProvider extends ConfigurableProvider { | ||
|
||
@Override | ||
public Configurable createConfigurable() { | ||
return new MicroProfileConfigurable(); | ||
} | ||
|
||
@Override | ||
public boolean canCreateConfigurable() { | ||
return true; | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems wrong. The viewport's start range won't start from 0, if the editor was scrolled down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which means you're likely unnecessarily computing hidden inlayhints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did that because the inlay hint is not refreshed when you are scrolling. Vscode provides this feature because when you scroll it refreshes the inlay hint. IJ doesn't support that it means that you need to consider that view port is the full document and not the visual view port.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a comment then, as it's not obvious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I have add a comment