-
Notifications
You must be signed in to change notification settings - Fork 74
Inlay Hint preferences for JS/TS #955
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
Merged
mickaelistria
merged 1 commit into
eclipse-wildwebdeveloper:master
from
angelozerr:typescript-preferences
Nov 15, 2022
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
39 changes: 39 additions & 0 deletions
39
org.eclipse.wildwebdeveloper/src/org/eclipse/wildwebdeveloper/jsts/ui/Messages.java
This file contains hidden or 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,39 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 2022 Red Hat Inc. and others. | ||
| * This program and the accompanying materials are made | ||
| * available under the terms of the Eclipse Public License 2.0 | ||
| * which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| * Contributors: | ||
| * Angelo ZERR (Red Hat Inc.) - initial implementation | ||
| *******************************************************************************/ | ||
| package org.eclipse.wildwebdeveloper.jsts.ui; | ||
|
|
||
| import org.eclipse.osgi.util.NLS; | ||
|
|
||
| /** | ||
| * JS/TS messages keys. | ||
| * | ||
| */ | ||
| public class Messages extends NLS { | ||
|
|
||
| // --------- TypeScript Inlay Hints preference page | ||
| public static String TypeScriptInlayHintPreferencePage_showInlayHintsFor_label; | ||
| public static String TypeScriptInlayHintPreferencePage_includeInlayEnumMemberValueHints; | ||
| public static String TypeScriptInlayHintPreferencePage_includeInlayFunctionLikeReturnTypeHints; | ||
| public static String TypeScriptInlayHintPreferencePage_includeInlayFunctionParameterTypeHints; | ||
| public static String TypeScriptInlayHintPreferencePage_includeInlayParameterNameHints; | ||
| public static String TypeScriptInlayHintPreferencePage_includeInlayParameterNameHints_none; | ||
| public static String TypeScriptInlayHintPreferencePage_includeInlayParameterNameHints_literals; | ||
| public static String TypeScriptInlayHintPreferencePage_includeInlayParameterNameHints_all; | ||
| public static String TypeScriptInlayHintPreferencePage_includeInlayParameterNameHintsWhenArgumentMatchesName; | ||
| public static String TypeScriptInlayHintPreferencePage_includeInlayPropertyDeclarationTypeHints; | ||
| public static String TypeScriptInlayHintPreferencePage_includeInlayVariableTypeHints; | ||
| public static String TypeScriptInlayHintPreferencePage_includeInlayVariableTypeHintsWhenTypeMatchesName; | ||
|
|
||
| static { | ||
| NLS.initializeMessages("org.eclipse.wildwebdeveloper.jsts.ui.messages", Messages.class); //$NON-NLS-1$ | ||
| } | ||
| } |
25 changes: 25 additions & 0 deletions
25
org.eclipse.wildwebdeveloper/src/org/eclipse/wildwebdeveloper/jsts/ui/messages.properties
This file contains hidden or 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,25 @@ | ||
| #/******************************************************************************* | ||
| # * Copyright (c) 2022 Red Hat Inc. and others. | ||
| # * This program and the accompanying materials are made | ||
| # * available under the terms of the Eclipse Public License 2.0 | ||
| # * which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
| # * | ||
| # * SPDX-License-Identifier: EPL-2.0 | ||
| # * | ||
| # * Contributors: | ||
| # * Angelo ZERR (Red Hat Inc.) - initial implementation | ||
| # *******************************************************************************/ | ||
|
|
||
| # TypeScript Inlay Hints preference page | ||
| TypeScriptInlayHintPreferencePage_showInlayHintsFor_label=Show inlay hints for: | ||
| TypeScriptInlayHintPreferencePage_includeInlayEnumMemberValueHints=member values in enum declarations. | ||
| TypeScriptInlayHintPreferencePage_includeInlayFunctionLikeReturnTypeHints=implicit return types on function signatures. | ||
| TypeScriptInlayHintPreferencePage_includeInlayFunctionParameterTypeHints=function parameter type. | ||
| TypeScriptInlayHintPreferencePage_includeInlayPropertyDeclarationTypeHints=property declaration type. | ||
| TypeScriptInlayHintPreferencePage_includeInlayParameterNameHints=parameter names: | ||
| TypeScriptInlayHintPreferencePage_includeInlayParameterNameHints_none=Disable parameter name hints. | ||
| TypeScriptInlayHintPreferencePage_includeInlayParameterNameHints_literals=Only for literal arguments. | ||
| TypeScriptInlayHintPreferencePage_includeInlayParameterNameHints_all=For literal and non-literal arguments. | ||
| TypeScriptInlayHintPreferencePage_includeInlayParameterNameHintsWhenArgumentMatchesName=also on arguments whose text is identical to the parameter name. | ||
| TypeScriptInlayHintPreferencePage_includeInlayVariableTypeHints=variable type. | ||
| TypeScriptInlayHintPreferencePage_includeInlayVariableTypeHintsWhenTypeMatchesName=also variables whose name is identical to the type name. | ||
38 changes: 38 additions & 0 deletions
38
...webdeveloper/src/org/eclipse/wildwebdeveloper/jsts/ui/preferences/JSTSPreferencePage.java
This file contains hidden or 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,38 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 2022 Red Hat Inc. and others. | ||
| * | ||
| * This program and the accompanying materials are made | ||
| * available under the terms of the Eclipse Public License 2.0 | ||
| * which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| * Contributors: | ||
| * Angelo ZERR (Red Hat Inc.) - initial implementation | ||
| *******************************************************************************/ | ||
| package org.eclipse.wildwebdeveloper.jsts.ui.preferences; | ||
|
|
||
| import org.eclipse.jface.preference.FieldEditorPreferencePage; | ||
| import org.eclipse.ui.IWorkbench; | ||
| import org.eclipse.ui.IWorkbenchPreferencePage; | ||
| import org.eclipse.wildwebdeveloper.Activator; | ||
|
|
||
| /** | ||
| * JS/TS main preference page. | ||
| * | ||
| */ | ||
| public class JSTSPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { | ||
|
|
||
| public JSTSPreferencePage() { | ||
| super(GRID); | ||
| } | ||
|
|
||
| @Override | ||
| public void init(IWorkbench workbench) { | ||
| setPreferenceStore(Activator.getDefault().getPreferenceStore()); | ||
| } | ||
|
|
||
| @Override | ||
| protected void createFieldEditors() { | ||
| } | ||
| } |
88 changes: 88 additions & 0 deletions
88
...se/wildwebdeveloper/jsts/ui/preferences/javascript/JavaScriptInlayHintPreferencePage.java
This file contains hidden or 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,88 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 2022 Red Hat Inc. and others. | ||
| * | ||
| * This program and the accompanying materials are made | ||
| * available under the terms of the Eclipse Public License 2.0 | ||
| * which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| * Contributors: | ||
| * Angelo ZERR (Red Hat Inc.) - initial implementation | ||
| *******************************************************************************/ | ||
| package org.eclipse.wildwebdeveloper.jsts.ui.preferences.javascript; | ||
|
|
||
| import static org.eclipse.wildwebdeveloper.jsts.ui.preferences.javascript.JavaScriptPreferenceServerConstants.JAVASCRIPT_PREFERENCES_INLAY_HINTS_INCLUDE_INLAY_ENUM_MEMBER_VALUE_HINTS; | ||
| import static org.eclipse.wildwebdeveloper.jsts.ui.preferences.javascript.JavaScriptPreferenceServerConstants.JAVASCRIPT_PREFERENCES_INLAY_HINTS_INCLUDE_INLAY_FUNCTION_LIKE_RETURN_TYPE_HINTS; | ||
| import static org.eclipse.wildwebdeveloper.jsts.ui.preferences.javascript.JavaScriptPreferenceServerConstants.JAVASCRIPT_PREFERENCES_INLAY_HINTS_INCLUDE_INLAY_FUNCTION_PARAMETER_TYPE_HINTS; | ||
| import static org.eclipse.wildwebdeveloper.jsts.ui.preferences.javascript.JavaScriptPreferenceServerConstants.JAVASCRIPT_PREFERENCES_INLAY_HINTS_INCLUDE_INLAY_PARAMETER_NAME_HINTS; | ||
| import static org.eclipse.wildwebdeveloper.jsts.ui.preferences.javascript.JavaScriptPreferenceServerConstants.JAVASCRIPT_PREFERENCES_INLAY_HINTS_INCLUDE_INLAY_PARAMETER_NAME_HINTS_WHEN_ARGUMENT_MATCHES_NAME; | ||
| import static org.eclipse.wildwebdeveloper.jsts.ui.preferences.javascript.JavaScriptPreferenceServerConstants.JAVASCRIPT_PREFERENCES_INLAY_HINTS_INCLUDE_INLAY_PROPERTY_DECLARATION_TYPE_HINTS; | ||
| import static org.eclipse.wildwebdeveloper.jsts.ui.preferences.javascript.JavaScriptPreferenceServerConstants.JAVASCRIPT_PREFERENCES_INLAY_HINTS_INCLUDE_INLAY_VARIABLE_TYPE_HINTS; | ||
| import static org.eclipse.wildwebdeveloper.jsts.ui.preferences.javascript.JavaScriptPreferenceServerConstants.JAVASCRIPT_PREFERENCES_INLAY_HINTS_INCLUDE_INLAY_VARIABLE_TYPE_HINTS_WHEN_TYPE_MATCHES_NAME; | ||
|
|
||
| import org.eclipse.jface.preference.BooleanFieldEditor; | ||
| import org.eclipse.jface.preference.ComboFieldEditor; | ||
| import org.eclipse.jface.preference.FieldEditorPreferencePage; | ||
| import org.eclipse.swt.SWT; | ||
| import org.eclipse.swt.widgets.Composite; | ||
| import org.eclipse.swt.widgets.Label; | ||
| import org.eclipse.ui.IWorkbench; | ||
| import org.eclipse.ui.IWorkbenchPreferencePage; | ||
| import org.eclipse.wildwebdeveloper.Activator; | ||
| import org.eclipse.wildwebdeveloper.jsts.ui.Messages; | ||
| import org.eclipse.wildwebdeveloper.ui.preferences.IndentedBooleanFieldEditor; | ||
|
|
||
| /** | ||
| * JavaScript Inlay Hint preference page. | ||
| * | ||
| */ | ||
| public class JavaScriptInlayHintPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { | ||
|
|
||
| public JavaScriptInlayHintPreferencePage() { | ||
| super(GRID); | ||
| } | ||
|
|
||
| @Override | ||
| public void createFieldEditors() { | ||
| Composite parent = getFieldEditorParent(); | ||
| Label label = new Label(parent, SWT.NONE); | ||
| label.setText(Messages.TypeScriptInlayHintPreferencePage_showInlayHintsFor_label); | ||
|
|
||
| addField(new BooleanFieldEditor(JAVASCRIPT_PREFERENCES_INLAY_HINTS_INCLUDE_INLAY_ENUM_MEMBER_VALUE_HINTS, | ||
| Messages.TypeScriptInlayHintPreferencePage_includeInlayEnumMemberValueHints, parent)); | ||
| addField( | ||
| new BooleanFieldEditor(JAVASCRIPT_PREFERENCES_INLAY_HINTS_INCLUDE_INLAY_FUNCTION_LIKE_RETURN_TYPE_HINTS, | ||
| Messages.TypeScriptInlayHintPreferencePage_includeInlayFunctionLikeReturnTypeHints, parent)); | ||
| addField(new BooleanFieldEditor(JAVASCRIPT_PREFERENCES_INLAY_HINTS_INCLUDE_INLAY_FUNCTION_PARAMETER_TYPE_HINTS, | ||
| Messages.TypeScriptInlayHintPreferencePage_includeInlayFunctionParameterTypeHints, parent)); | ||
| addField( | ||
| new BooleanFieldEditor(JAVASCRIPT_PREFERENCES_INLAY_HINTS_INCLUDE_INLAY_PROPERTY_DECLARATION_TYPE_HINTS, | ||
| Messages.TypeScriptInlayHintPreferencePage_includeInlayPropertyDeclarationTypeHints, parent)); | ||
|
|
||
| addField(new BooleanFieldEditor(JAVASCRIPT_PREFERENCES_INLAY_HINTS_INCLUDE_INLAY_VARIABLE_TYPE_HINTS, | ||
| Messages.TypeScriptInlayHintPreferencePage_includeInlayVariableTypeHints, parent)); | ||
| addField(new IndentedBooleanFieldEditor( | ||
| JAVASCRIPT_PREFERENCES_INLAY_HINTS_INCLUDE_INLAY_VARIABLE_TYPE_HINTS_WHEN_TYPE_MATCHES_NAME, | ||
| Messages.TypeScriptInlayHintPreferencePage_includeInlayVariableTypeHintsWhenTypeMatchesName, parent)); | ||
|
|
||
| addField(new ComboFieldEditor(JAVASCRIPT_PREFERENCES_INLAY_HINTS_INCLUDE_INLAY_PARAMETER_NAME_HINTS, | ||
| Messages.TypeScriptInlayHintPreferencePage_includeInlayParameterNameHints, | ||
| new String[][] { | ||
| { Messages.TypeScriptInlayHintPreferencePage_includeInlayParameterNameHints_none, "none" }, | ||
| { Messages.TypeScriptInlayHintPreferencePage_includeInlayParameterNameHints_literals, | ||
| "literals" }, | ||
| { Messages.TypeScriptInlayHintPreferencePage_includeInlayParameterNameHints_all, "all" } }, | ||
| parent)); | ||
| addField(new IndentedBooleanFieldEditor( | ||
| JAVASCRIPT_PREFERENCES_INLAY_HINTS_INCLUDE_INLAY_PARAMETER_NAME_HINTS_WHEN_ARGUMENT_MATCHES_NAME, | ||
| Messages.TypeScriptInlayHintPreferencePage_includeInlayParameterNameHintsWhenArgumentMatchesName, | ||
| parent)); | ||
| } | ||
|
|
||
|
|
||
| @Override | ||
| public void init(IWorkbench workbench) { | ||
| setPreferenceStore(Activator.getDefault().getPreferenceStore()); | ||
| } | ||
| } |
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.