links: gh-sdk-samples -> gh-sdk-samples-master

This commit is contained in:
Yann Cébron 2024-05-14 14:19:35 +02:00
parent 9a92e5ca49
commit bb008a1c8f
54 changed files with 198 additions and 198 deletions

View File

@ -1,4 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# Modifying the PSI # Modifying the PSI
@ -21,7 +21,7 @@ See also [](psi_files.md#how-do-i-create-a-psi-file).
Most languages provide factory methods that let you create specific code constructs more easily. Most languages provide factory methods that let you create specific code constructs more easily.
Examples: Examples:
* [`PsiJavaParserFacade`](%gh-ic%/java/java-psi-api/src/com/intellij/psi/PsiJavaParserFacade.java) class contains methods such as `createMethodFromText()`, which creates a Java method from the given text * [`PsiJavaParserFacade`](%gh-ic%/java/java-psi-api/src/com/intellij/psi/PsiJavaParserFacade.java) class contains methods such as `createMethodFromText()`, which creates a Java method from the given text
* [`SimpleElementFactory.createProperty()`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleElementFactory.java) creating a Simple language property * [`SimpleElementFactory.createProperty()`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleElementFactory.java) creating a Simple language property
When you're implementing refactorings, [intentions](code_intentions.md), or inspection [quickfixes](code_inspections_and_intentions.md) that work with existing code, the text that you pass to the various `createFromText()` methods will combine hard-coded fragments and fragments of code taken from the existing file. When you're implementing refactorings, [intentions](code_intentions.md), or inspection [quickfixes](code_inspections_and_intentions.md) that work with existing code, the text that you pass to the various `createFromText()` methods will combine hard-coded fragments and fragments of code taken from the existing file.
For small code fragments (individual identifiers), you can simply append the text from the existing code to the text of the code fragment you are building. For small code fragments (individual identifiers), you can simply append the text from the existing code to the text of the code fragment you are building.

View File

@ -1,4 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# Navigating the PSI # Navigating the PSI
@ -58,4 +58,4 @@ PsiMethod containingMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.clas
PsiClass containingClass = containingMethod.getContainingClass(); PsiClass containingClass = containingMethod.getContainingClass();
``` ```
To see how the navigation works in practice, please refer to the [code sample](%gh-sdk-samples%/psi_demo/src/main/java/org/intellij/sdk/psi/PsiNavigationDemoAction.java). To see how the navigation works in practice, please refer to the [code sample](%gh-sdk-samples-master%/psi_demo/src/main/java/org/intellij/sdk/psi/PsiNavigationDemoAction.java).

View File

@ -116,7 +116,7 @@ See [Grouping Actions](#grouping-actions) for more information about the `compac
> >
{style="note"} {style="note"}
An example of enabling a menu action based on whether a project is open is demonstrated in [`PopupDialogAction.update()`](%gh-sdk-samples%/action_basics/src/main/java/org/intellij/sdk/action/PopupDialogAction.java) method. An example of enabling a menu action based on whether a project is open is demonstrated in [`PopupDialogAction.update()`](%gh-sdk-samples-master%/action_basics/src/main/java/org/intellij/sdk/action/PopupDialogAction.java) method.
### Overriding the `AnAction.actionPerformed()` Method ### Overriding the `AnAction.actionPerformed()` Method
@ -128,7 +128,7 @@ For example, the `actionPerformed()` method can modify, remove, or add PSI eleme
The code that executes in the `AnAction.actionPerformed()` method should execute efficiently, but it does not have to meet the same stringent requirements as the `update()` method. The code that executes in the `AnAction.actionPerformed()` method should execute efficiently, but it does not have to meet the same stringent requirements as the `update()` method.
An example of inspecting PSI elements is demonstrated in the SDK code sample `action_basics` [`PopupDialogAction.actionPerformed()`](%gh-sdk-samples%/action_basics/src/main/java/org/intellij/sdk/action/PopupDialogAction.java) method. An example of inspecting PSI elements is demonstrated in the SDK code sample `action_basics` [`PopupDialogAction.actionPerformed()`](%gh-sdk-samples-master%/action_basics/src/main/java/org/intellij/sdk/action/PopupDialogAction.java) method.
### Action IDs ### Action IDs
@ -227,7 +227,7 @@ To exclude a group from appearing in <ui-path>Help | Find Action</ui-path> resul
> >
Action and group localization use resource bundles containing property files named <path>$NAME$Bundle.properties</path>, each file consisting of `key=value` pairs. Action and group localization use resource bundles containing property files named <path>$NAME$Bundle.properties</path>, each file consisting of `key=value` pairs.
The [`action_basics`](%gh-sdk-samples%/action_basics) plugin demonstrates using a resource bundle to localize the group and action entries added to the Editor Popup Menu. The [`action_basics`](%gh-sdk-samples-master%/action_basics) plugin demonstrates using a resource bundle to localize the group and action entries added to the Editor Popup Menu.
When localizing actions and groups, the `text` and `description` attributes are not declared in <path>plugin.xml</path>. When localizing actions and groups, the `text` and `description` attributes are not declared in <path>plugin.xml</path>.
Instead, those attribute values vary depending on the locale and get declared in a resource bundle. Instead, those attribute values vary depending on the locale and get declared in a resource bundle.

View File

@ -111,7 +111,7 @@ If the settings editor requires validation, implement [`CheckableRunConfiguratio
If the settings editor is complex, see [](#simplifying-settings-editors) for solutions. If the settings editor is complex, see [](#simplifying-settings-editors) for solutions.
**Example**: [DemoSettingsEditor](%gh-sdk-samples%/run_configuration/src/main/java/org/jetbrains/sdk/runConfiguration/DemoSettingsEditor.java) from the `run_configuration` code sample. **Example**: [DemoSettingsEditor](%gh-sdk-samples-master%/run_configuration/src/main/java/org/jetbrains/sdk/runConfiguration/DemoSettingsEditor.java) from the `run_configuration` code sample.
## Persistence ## Persistence

View File

@ -1,13 +1,13 @@
# Theme Structure <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> # Theme Structure
<link-summary>Overview of a theme plugin project structure and the most important elements.</link-summary> <link-summary>Overview of a theme plugin project structure and the most important elements.</link-summary>
Themes are components within [IntelliJ Platform plugins](plugin_structure.topic). Themes are components within [IntelliJ Platform plugins](plugin_structure.topic).
The theme plugins should be stand-alone and not combined with other plugin functionality. The theme plugins should be stand-alone and not combined with other plugin functionality.
> To see a full example theme project, see the [Theme Basics](%gh-sdk-samples%/theme_basics) in IntelliJ SDK Code Samples. > To see a full example theme project, see the [Theme Basics](%gh-sdk-samples-master%/theme_basics) in IntelliJ SDK Code Samples.
> >
{style="note"} {style="note"}

View File

@ -400,7 +400,7 @@ endif
## Sample Plugin ## Sample Plugin
To clarify how to use services, consider the **maxOpenProjects** sample plugin available in the [code samples](%gh-sdk-samples%/max_opened_projects). To clarify how to use services, consider the **maxOpenProjects** sample plugin available in the [code samples](%gh-sdk-samples-master%/max_opened_projects).
This plugin has an application service counting the number of currently opened projects in the IDE. This plugin has an application service counting the number of currently opened projects in the IDE.
If this number exceeds the maximum number of simultaneously opened projects allowed by the plugin (3), it displays an information message. If this number exceeds the maximum number of simultaneously opened projects allowed by the plugin (3), it displays an information message.

View File

@ -1,6 +1,6 @@
# Testing Overview <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> # Testing Overview
<link-summary>Introduction to testing plugins.</link-summary> <link-summary>Introduction to testing plugins.</link-summary>
@ -38,8 +38,8 @@ Please do not use <path>platform/testGuiFramework</path>, as it is reserved for
> Check out [this step-by-step tutorial](writing_tests_for_plugins.md) teaching how to write and run automated tests for your custom language plugin. > Check out [this step-by-step tutorial](writing_tests_for_plugins.md) teaching how to write and run automated tests for your custom language plugin.
> Also, code samples > Also, code samples
> [comparing_string_references_inspection](%gh-sdk-samples%/comparing_string_references_inspection) > [comparing_string_references_inspection](%gh-sdk-samples-master%/comparing_string_references_inspection)
> and [conditional_operator_intention](%gh-sdk-samples%/conditional_operator_intention) demonstrate using tests. > and [conditional_operator_intention](%gh-sdk-samples-master%/conditional_operator_intention) demonstrate using tests.
> >
{style="note"} {style="note"}

View File

@ -1,4 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# SDK Code Sample Guidelines # SDK Code Sample Guidelines
@ -177,7 +177,7 @@ The sequence of elements in an SDK code sample <path>plugin.xml</path> file is:
## README File ## README File
Each code sample provided within the IntelliJ Platform SDK should contain a README file describing the sample purpose and its content. Each code sample provided within the IntelliJ Platform SDK should contain a README file describing the sample purpose and its content.
The [`SAMPLE_README.md`](%gh-sdk-samples%/SAMPLE_README.md) file contains a template that should be used as an initial draft for further writing. The [`SAMPLE_README.md`](%gh-sdk-samples-master%/SAMPLE_README.md) file contains a template that should be used as an initial draft for further writing.
Each <path>README.md</path> file is supposed to have the same structure for better navigation and readability: Each <path>README.md</path> file is supposed to have the same structure for better navigation and readability:
- A header with the link to the main IntelliJ SDK documentation and a page that the sample refers to. - A header with the link to the main IntelliJ SDK documentation and a page that the sample refers to.

View File

@ -1,4 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# PyCharm Plugin Development # PyCharm Plugin Development
@ -29,7 +29,7 @@ Click on an entry in the table's *Attribute* column to go to the documentation a
The dependency on the PyCharm APIs must be declared in the <path>[plugin.xml](plugin_configuration_file.md)</path> file. The dependency on the PyCharm APIs must be declared in the <path>[plugin.xml](plugin_configuration_file.md)</path> file.
As described in [Configuring the plugin.xml File](dev_alternate_products.md#configuring-pluginxml), the [`<depends>`](plugin_configuration_file.md#idea-plugin__depends) tags must declare `com.intellij.modules.python`. As described in [Configuring the plugin.xml File](dev_alternate_products.md#configuring-pluginxml), the [`<depends>`](plugin_configuration_file.md#idea-plugin__depends) tags must declare `com.intellij.modules.python`.
See the SDK code sample [`pycharm_basics`](%gh-sdk-samples%/product_specific/pycharm_basics/) for an example configuration. See the SDK code sample [`pycharm_basics`](%gh-sdk-samples-master%/product_specific/pycharm_basics/) for an example configuration.
Please note that this code sample must be imported into Gradle explicitly, as it is not included in the `_gradleCompositeBuild`. Please note that this code sample must be imported into Gradle explicitly, as it is not included in the `_gradleCompositeBuild`.
## Available PyCharm APIs ## Available PyCharm APIs

View File

@ -31,7 +31,7 @@ To generate SVG icons suited for the IntelliJ-based IDEs, also consider third-pa
## Organizing Icons ## Organizing Icons
> See [Action Basics](%gh-sdk-samples%/action_basics) sample plugin as a reference. > See [Action Basics](%gh-sdk-samples-master%/action_basics) sample plugin as a reference.
In the case of a Gradle-based project, icons should be placed in the <path>resources</path> directory. In the case of a Gradle-based project, icons should be placed in the <path>resources</path> directory.
If the project is DevKit-based, the recommended approach is to put icons to a dedicated [source root](https://www.jetbrains.com/help/idea/content-roots.html) marked as <control>Resources Root</control>, e.g., <path>icons</path> or <path>resources</path>. If the project is DevKit-based, the recommended approach is to put icons to a dedicated [source root](https://www.jetbrains.com/help/idea/content-roots.html) marked as <control>Resources Root</control>, e.g., <path>icons</path> or <path>resources</path>.

View File

@ -1,4 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# Facet # Facet
@ -15,7 +15,7 @@ A module can have multiple facets.
E.g. Spring Framework specific configuration is stored in a Spring facet. E.g. Spring Framework specific configuration is stored in a Spring facet.
## Facet Basics Sample ## Facet Basics Sample
Please see [Facet Basics](%gh-sdk-samples%/facet_basics) sample plugin project. Please see [Facet Basics](%gh-sdk-samples-master%/facet_basics) sample plugin project.
## Working with Facets ## Working with Facets

View File

@ -76,7 +76,7 @@ To create a library, perform the following steps:
* For a module-level library, commit the modifiable model returned by `ModuleRootManager.getInstance(module).getModifiableModel()`. * For a module-level library, commit the modifiable model returned by `ModuleRootManager.getInstance(module).getModifiableModel()`.
For module-level libraries, you can also use simplified APIs in the [`ModuleRootModificationUtil`](%gh-ic%/platform/projectModel-api/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java) class to add a library with a single API call. For module-level libraries, you can also use simplified APIs in the [`ModuleRootModificationUtil`](%gh-ic%/platform/projectModel-api/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java) class to add a library with a single API call.
You can find an example of using these APIs in the [project_model](%gh-sdk-samples%/project_model/src/main/java/org/intellij/sdk/project/model/ModificationAction.java) code sample. You can find an example of using these APIs in the [project_model](%gh-sdk-samples-master%/project_model/src/main/java/org/intellij/sdk/project/model/ModificationAction.java) code sample.
### Adding Contents or Modifying a Library ### Adding Contents or Modifying a Library
To add or change the roots of a library, you need to perform the following steps: To add or change the roots of a library, you need to perform the following steps:
@ -105,9 +105,9 @@ You can use the following methods:
ProjectFileIndex.isInLibrarySource(virtualFileorDirectory) ProjectFileIndex.isInLibrarySource(virtualFileorDirectory)
``` ```
See the [project_model](%gh-sdk-samples%/project_model/src/main/java/org/intellij/sdk/project/model/ProjectFileIndexSampleAction.java) to see how the method mentioned above can be applied. See the [project_model](%gh-sdk-samples-master%/project_model/src/main/java/org/intellij/sdk/project/model/ProjectFileIndexSampleAction.java) to see how the method mentioned above can be applied.
More details on libraries can be found in the [plugin_model](%gh-sdk-samples%/project_model/src/main/java/org/intellij/sdk/project/model/LibrariesAction.java) code sample. More details on libraries can be found in the [plugin_model](%gh-sdk-samples-master%/project_model/src/main/java/org/intellij/sdk/project/model/LibrariesAction.java) code sample.
## Predefined Libraries ## Predefined Libraries
EP: `com.intellij.additionalLibraryRootsProvider` EP: `com.intellij.additionalLibraryRootsProvider`

View File

@ -111,7 +111,7 @@ Utility classes used for modifying the project structure can be found in the pac
Its [`roots`](%gh-ic%/platform/projectModel-impl/src/com/intellij/openapi/roots) subpackage contains instances and utilities intended for work with project and module source roots, including [`ModuleRootModificationUtil`](%gh-ic%/platform/projectModel-api/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java) and [`ProjectRootUtil`](%gh-ic%/platform/projectModel-impl/src/com/intellij/openapi/projectRoots/impl/ProjectRootUtil.java). Its [`roots`](%gh-ic%/platform/projectModel-impl/src/com/intellij/openapi/roots) subpackage contains instances and utilities intended for work with project and module source roots, including [`ModuleRootModificationUtil`](%gh-ic%/platform/projectModel-api/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java) and [`ProjectRootUtil`](%gh-ic%/platform/projectModel-impl/src/com/intellij/openapi/projectRoots/impl/ProjectRootUtil.java).
Project structure changes need to be performed in [write action](general_threading_rules.md#read-write-lock). Project structure changes need to be performed in [write action](general_threading_rules.md#read-write-lock).
Refer to the [project_model](%gh-sdk-samples%/project_model/src/main/java/org/intellij/sdk/project/model/ModificationAction.java) code sample to learn how project structure modification can be implemented. Refer to the [project_model](%gh-sdk-samples-master%/project_model/src/main/java/org/intellij/sdk/project/model/ModificationAction.java) code sample to learn how project structure modification can be implemented.
## Receiving Notifications About Project Structure Changes ## Receiving Notifications About Project Structure Changes

View File

@ -1,4 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<link-summary>Configuring and getting information about a project SDK.</link-summary> <link-summary>Configuring and getting information about a project SDK.</link-summary>
@ -49,7 +49,7 @@ Sdk projectSdk = ProjectRootManager.getInstance(project).getProjectSdk();
ProjectRootManager.getInstance(project).setProjectSdkName(name, sdk.getSdkType().getName()); ProjectRootManager.getInstance(project).setProjectSdkName(name, sdk.getSdkType().getName());
``` ```
See the [project_model](%gh-sdk-samples%/project_model/src/main/java/org/intellij/sdk/project/model/ProjectSdkAction.java) code sample to get more familiar with SDK manipulation toolset. See the [project_model](%gh-sdk-samples-master%/project_model/src/main/java/org/intellij/sdk/project/model/ProjectSdkAction.java) code sample to get more familiar with SDK manipulation toolset.
## Available SDKs ## Available SDKs

View File

@ -1,4 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<link-summary>Tutorial on creating and grouping actions.</link-summary> <link-summary>Tutorial on creating and grouping actions.</link-summary>
@ -9,4 +9,4 @@ By registering actions, you can add your own menu items, toolbar buttons and key
* [Creating Actions](working_with_custom_actions.md) * [Creating Actions](working_with_custom_actions.md)
* [Grouping Actions](grouping_action.md) * [Grouping Actions](grouping_action.md)
The source code for the [`action_basics`](%gh-sdk-samples%/action_basics) code sample is used throughout this tutorial. The source code for the [`action_basics`](%gh-sdk-samples-master%/action_basics) code sample is used throughout this tutorial.

View File

@ -6,7 +6,7 @@
If an implementation requires several actions, or there are simply too many actions that overload the menu, the actions can be placed into groups. If an implementation requires several actions, or there are simply too many actions that overload the menu, the actions can be placed into groups.
This tutorial demonstrates adding an action to an existing group, creating a new action group, and action groups with a variable number of actions. This tutorial demonstrates adding an action to an existing group, creating a new action group, and action groups with a variable number of actions.
The sample code discussed in this tutorial is from the code sample [`action_basics`](%gh-sdk-samples%/action_basics). The sample code discussed in this tutorial is from the code sample [`action_basics`](%gh-sdk-samples-master%/action_basics).
Some content in this tutorial assumes the reader is familiar with the tutorial for [Creating Actions](working_with_custom_actions.md). Some content in this tutorial assumes the reader is familiar with the tutorial for [Creating Actions](working_with_custom_actions.md).
@ -39,7 +39,7 @@ See [](basic_action_system.md#registering-actions-in-pluginxml) for more informa
The following sample shows how to use an [`<add-to-group>`](plugin_configuration_file.md#idea-plugin__actions__action__add-to-group) element to place a custom action group relative to an entry in the <ui-path>Tools</ui-path> menu. The following sample shows how to use an [`<add-to-group>`](plugin_configuration_file.md#idea-plugin__actions__action__add-to-group) element to place a custom action group relative to an entry in the <ui-path>Tools</ui-path> menu.
The attribute `relative-to-action` references the action `id` for `PopupDialogAction`, not a native IntelliJ menu entry. The attribute `relative-to-action` references the action `id` for `PopupDialogAction`, not a native IntelliJ menu entry.
Rather `PopupDialogAction` is defined in the same [`plugin.xml`](%gh-sdk-samples%/action_basics/src/main/resources/META-INF/plugin.xml) file. Rather `PopupDialogAction` is defined in the same [`plugin.xml`](%gh-sdk-samples-master%/action_basics/src/main/resources/META-INF/plugin.xml) file.
This group is placed after the single entry for the action `PopupDialogAction`, as defined in the tutorial [Creating Actions](working_with_custom_actions.md#registering-an-action-with-the-new-action-form). This group is placed after the single entry for the action `PopupDialogAction`, as defined in the tutorial [Creating Actions](working_with_custom_actions.md#registering-an-action-with-the-new-action-form).
```xml ```xml
@ -118,7 +118,7 @@ public class CustomDefaultActionGroup extends DefaultActionGroup {
### Registering the Custom Action Group ### Registering the Custom Action Group
As in the case with the static action group, the action [`<group>`](plugin_configuration_file.md#idea-plugin__actions__group) should be declared in the [`<actions>`](plugin_configuration_file.md#idea-plugin__actions) section of the <path>plugin.xml</path> file, for example, the [action_basics](%gh-sdk-samples%/action_basics/src/main/resources/META-INF/plugin.xml) plugin. As in the case with the static action group, the action [`<group>`](plugin_configuration_file.md#idea-plugin__actions__group) should be declared in the [`<actions>`](plugin_configuration_file.md#idea-plugin__actions) section of the <path>plugin.xml</path> file, for example, the [action_basics](%gh-sdk-samples-master%/action_basics/src/main/resources/META-INF/plugin.xml) plugin.
For demonstration purposes, this implementation will use localization. For demonstration purposes, this implementation will use localization.
The `<group>` element declaration below shows: The `<group>` element declaration below shows:
@ -165,7 +165,7 @@ In the `<action>` element declaration below:
</group> </group>
``` ```
Now the translations for the `text` and `description` attributes must be provided in the resource bundle [`BasicActionsBundle.properties`](%gh-sdk-samples%/action_basics/src/main/resources/messages/BasicActionsBundle.properties) file according to [Localizing Actions and Groups](basic_action_system.md#localizing-actions-and-groups). Now the translations for the `text` and `description` attributes must be provided in the resource bundle [`BasicActionsBundle.properties`](%gh-sdk-samples-master%/action_basics/src/main/resources/messages/BasicActionsBundle.properties) file according to [Localizing Actions and Groups](basic_action_system.md#localizing-actions-and-groups).
Note there are two sets of `text` and `description` translations, one for the action and one for the group. Note there are two sets of `text` and `description` translations, one for the action and one for the group.
Conceivably, there could be another set of translations for the action if it used the [`<override-text>`](plugin_configuration_file.md#idea-plugin__actions__action__override-text) attribute. Conceivably, there could be another set of translations for the action if it used the [`<override-text>`](plugin_configuration_file.md#idea-plugin__actions__action__override-text) attribute.
@ -208,7 +208,7 @@ The set of actions in the `ActionGroup` is dynamically defined.
### Creating Variable Action Group ### Creating Variable Action Group
To create a group of actions with a variable number of actions, extend `ActionGroup`. To create a group of actions with a variable number of actions, extend `ActionGroup`.
For example, as in the `action_basics` class [`DynamicActionGroup`](%gh-sdk-samples%/action_basics/src/main/java/org/intellij/sdk/action/DynamicActionGroup.java) code: For example, as in the `action_basics` class [`DynamicActionGroup`](%gh-sdk-samples-master%/action_basics/src/main/java/org/intellij/sdk/action/DynamicActionGroup.java) code:
```java ```java
public class DynamicActionGroup extends ActionGroup { public class DynamicActionGroup extends ActionGroup {
@ -217,7 +217,7 @@ public class DynamicActionGroup extends ActionGroup {
### Registering a Variable Action Group ### Registering a Variable Action Group
To register the dynamic menu group, a [`<group>`](plugin_configuration_file.md#idea-plugin__actions__group) attribute needs to be placed in the [`<actions>`](plugin_configuration_file.md#idea-plugin__actions) section of [`plugin`.xml](%gh-sdk-samples%/action_basics/src/main/resources/META-INF/plugin.xml). To register the dynamic menu group, a [`<group>`](plugin_configuration_file.md#idea-plugin__actions__group) attribute needs to be placed in the [`<actions>`](plugin_configuration_file.md#idea-plugin__actions) section of [`plugin`.xml](%gh-sdk-samples-master%/action_basics/src/main/resources/META-INF/plugin.xml).
When enabled, this group appears just below the [Static Grouped Actions](#binding-action-groups-to-ui-components) in the <ui-path>Tools</ui-path> menu: When enabled, this group appears just below the [Static Grouped Actions](#binding-action-groups-to-ui-components) in the <ui-path>Tools</ui-path> menu:
```xml ```xml

View File

@ -8,7 +8,7 @@ Plugins can add actions to existing IDE menus and toolbars, as well as add new m
The IntelliJ Platform calls the actions of plugins in response to user interactions with the IDE. The IntelliJ Platform calls the actions of plugins in response to user interactions with the IDE.
However, the actions of a plugin must first be defined and registered with the IntelliJ Platform. However, the actions of a plugin must first be defined and registered with the IntelliJ Platform.
Using the SDK code sample [`action_basics`](%gh-sdk-samples%/action_basics), this tutorial illustrates the steps to create an action for a plugin. Using the SDK code sample [`action_basics`](%gh-sdk-samples-master%/action_basics), this tutorial illustrates the steps to create an action for a plugin.
## Creating a Custom Action ## Creating a Custom Action
@ -18,7 +18,7 @@ Classes that extend it should override `AnAction.update()`, and must override `A
* The `actionPerformed()` method implements the code that executes when an action is invoked by the user. * The `actionPerformed()` method implements the code that executes when an action is invoked by the user.
* When targeting IntelliJ Platform 2022.3 or later, `AnAction.getActionUpdateThread()` must be implemented * When targeting IntelliJ Platform 2022.3 or later, `AnAction.getActionUpdateThread()` must be implemented
As an example, [`PopupDialogAction`](%gh-sdk-samples%/action_basics/src/main/java/org/intellij/sdk/action/PopupDialogAction.java) overrides `AnAction` for the `action_basics` code sample. As an example, [`PopupDialogAction`](%gh-sdk-samples-master%/action_basics/src/main/java/org/intellij/sdk/action/PopupDialogAction.java) overrides `AnAction` for the `action_basics` code sample.
```java ```java
public class PopupDialogAction extends AnAction { public class PopupDialogAction extends AnAction {
@ -111,7 +111,7 @@ An action declaration can be added manually to the <path>plugin.xml</path> file.
An exhaustive list of declaration elements and attributes is presented in [](basic_action_system.md#registering-actions-in-pluginxml). An exhaustive list of declaration elements and attributes is presented in [](basic_action_system.md#registering-actions-in-pluginxml).
Attributes are added by selecting them from the <control>New Action</control> form, or by editing the registration declaration directly in the <path>plugin.xml</path> file. Attributes are added by selecting them from the <control>New Action</control> form, or by editing the registration declaration directly in the <path>plugin.xml</path> file.
The [`<action>`](plugin_configuration_file.md#idea-plugin__actions__action) declaration for `PopupDialogAction` in the `action_basics` [plugin.xml](%gh-sdk-samples%/action_basics/src/main/resources/META-INF/plugin.xml) file. The [`<action>`](plugin_configuration_file.md#idea-plugin__actions__action) declaration for `PopupDialogAction` in the `action_basics` [plugin.xml](%gh-sdk-samples-master%/action_basics/src/main/resources/META-INF/plugin.xml) file.
It also contains an attribute for an [`Icon`](icons.md) and encloses elements declaring text overrides, keyboard and mouse shortcuts, and to which menu group the action should be added. It also contains an attribute for an [`Icon`](icons.md) and encloses elements declaring text overrides, keyboard and mouse shortcuts, and to which menu group the action should be added.
The full declaration is: The full declaration is:

View File

@ -1,4 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# Code Inspections # Code Inspections
@ -14,13 +14,13 @@
The IntelliJ Platform provides tools designed for static code analysis called _code inspections_, which help the user maintain and clean up code without actually executing it. The IntelliJ Platform provides tools designed for static code analysis called _code inspections_, which help the user maintain and clean up code without actually executing it.
Custom code inspections can be implemented as IntelliJ Platform plugins. Custom code inspections can be implemented as IntelliJ Platform plugins.
An example of the plugin approach is the [comparing_string_references_inspection](%gh-sdk-samples%/comparing_string_references_inspection) code sample. An example of the plugin approach is the [comparing_string_references_inspection](%gh-sdk-samples-master%/comparing_string_references_inspection) code sample.
See the [Inspections](https://jetbrains.design/intellij/text/inspections/) topic in the IntelliJ Platform UI Guidelines on naming, writing description, and message texts for inspections. See the [Inspections](https://jetbrains.design/intellij/text/inspections/) topic in the IntelliJ Platform UI Guidelines on naming, writing description, and message texts for inspections.
## Creating an Inspection Plugin ## Creating an Inspection Plugin
The [comparing_string_references_inspection](%gh-sdk-samples%/comparing_string_references_inspection) code sample adds a new inspection to the <control>Java | Probable Bugs</control> group in the [Inspections list](https://www.jetbrains.com/help/idea/inspections-settings.html). The [comparing_string_references_inspection](%gh-sdk-samples-master%/comparing_string_references_inspection) code sample adds a new inspection to the <control>Java | Probable Bugs</control> group in the [Inspections list](https://www.jetbrains.com/help/idea/inspections-settings.html).
The inspection reports when the `==` or `!=` operator is used between String expressions. The inspection reports when the `==` or `!=` operator is used between String expressions.
It illustrates the components for a custom inspection plugin: It illustrates the components for a custom inspection plugin:
@ -39,14 +39,14 @@ Consider also searching for existing implementations in [IntelliJ Platform Explo
## Creating an Inspection ## Creating an Inspection
The [comparing_string_references_inspection](%gh-sdk-samples%/comparing_string_references_inspection) code sample reports when the `==` or `!=` operators are used between String expressions. The [comparing_string_references_inspection](%gh-sdk-samples-master%/comparing_string_references_inspection) code sample reports when the `==` or `!=` operators are used between String expressions.
The user can apply a quick fix to change `a==b` to `a.equals(b)`, or `a!=b` to `!a.equals(b)`. The user can apply a quick fix to change `a==b` to `a.equals(b)`, or `a!=b` to `!a.equals(b)`.
The details of the `comparing_string_references_inspection` implementation illustrate the components of an inspection plugin. The details of the `comparing_string_references_inspection` implementation illustrate the components of an inspection plugin.
### Plugin Configuration File ### Plugin Configuration File
The `comparing_string_references_inspection` is described as a `com.intellij.localInspection` extension point in the `comparing_string_references_inspection` plugin configuration ([`plugin.xml`](%gh-sdk-samples%/comparing_string_references_inspection/src/main/resources/META-INF/plugin.xml)) file. The `comparing_string_references_inspection` is described as a `com.intellij.localInspection` extension point in the `comparing_string_references_inspection` plugin configuration ([`plugin.xml`](%gh-sdk-samples-master%/comparing_string_references_inspection/src/main/resources/META-INF/plugin.xml)) file.
There exist two types of inspection extensions: There exist two types of inspection extensions:
@ -61,7 +61,7 @@ If required, inspections can define all the attribute information (except `imple
### Inspection Implementation Java Class ### Inspection Implementation Java Class
Inspection implementations for Java files, like [`ComparingStringReferencesInspection`](%gh-sdk-samples%/comparing_string_references_inspection/src/main/java/org/intellij/sdk/codeInspection/ComparingStringReferencesInspection.java), are often based on the Java class [`AbstractBaseJavaLocalInspectionTool`](%gh-ic%/java/java-analysis-api/src/com/intellij/codeInspection/AbstractBaseJavaLocalInspectionTool.java). Inspection implementations for Java files, like [`ComparingStringReferencesInspection`](%gh-sdk-samples-master%/comparing_string_references_inspection/src/main/java/org/intellij/sdk/codeInspection/ComparingStringReferencesInspection.java), are often based on the Java class [`AbstractBaseJavaLocalInspectionTool`](%gh-ic%/java/java-analysis-api/src/com/intellij/codeInspection/AbstractBaseJavaLocalInspectionTool.java).
The [`AbstractBaseJavaLocalInspectionTool`](%gh-ic%/java/java-analysis-api/src/com/intellij/codeInspection/AbstractBaseJavaLocalInspectionTool.java) base class offers methods to inspect Java classes, fields, and methods. The [`AbstractBaseJavaLocalInspectionTool`](%gh-ic%/java/java-analysis-api/src/com/intellij/codeInspection/AbstractBaseJavaLocalInspectionTool.java) base class offers methods to inspect Java classes, fields, and methods.
More generally, `localInspection` types are based on the class [`LocalInspectionTool`](%gh-ic%/platform/analysis-api/src/com/intellij/codeInspection/LocalInspectionTool.java). More generally, `localInspection` types are based on the class [`LocalInspectionTool`](%gh-ic%/platform/analysis-api/src/com/intellij/codeInspection/LocalInspectionTool.java).
@ -168,7 +168,7 @@ The `comparing_string_references_inspection` tests run the inspection on the <pa
## Running the Comparing String References Inspection Code Sample ## Running the Comparing String References Inspection Code Sample
The [comparing_string_references_inspection](%gh-sdk-samples%/comparing_string_references_inspection) code sample adds a new inspection to the <control>Java | Probable Bugs</control> group in the [Inspections](https://www.jetbrains.com/help/idea/inspections-settings.html) configuration. The [comparing_string_references_inspection](%gh-sdk-samples-master%/comparing_string_references_inspection) code sample adds a new inspection to the <control>Java | Probable Bugs</control> group in the [Inspections](https://www.jetbrains.com/help/idea/inspections-settings.html) configuration.
See [](code_samples.md) on how to set up and run the plugin. See [](code_samples.md) on how to set up and run the plugin.

View File

@ -1,4 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# Intentions # Intentions
@ -12,7 +12,7 @@
</tldr> </tldr>
This topic describes the [conditional_operator_intention](%gh-sdk-samples%/conditional_operator_intention), a sample plugin that adds a new [intention action](https://www.jetbrains.com/help/idea/intention-actions.html) to the IDE Intentions list. This topic describes the [conditional_operator_intention](%gh-sdk-samples-master%/conditional_operator_intention), a sample plugin that adds a new [intention action](https://www.jetbrains.com/help/idea/intention-actions.html) to the IDE Intentions list.
In addition, the sample plugin contains a JUnit-based test. In addition, the sample plugin contains a JUnit-based test.
## About Intention Actions ## About Intention Actions
@ -26,7 +26,7 @@ You can view a list of all available intention actions as well as enable/disable
## Techniques Used ## Techniques Used
The [conditional_operator_intention](%gh-sdk-samples%/conditional_operator_intention) sample plugin illustrates the use of the following techniques: The [conditional_operator_intention](%gh-sdk-samples-master%/conditional_operator_intention) sample plugin illustrates the use of the following techniques:
- How to analyze a [PSI tree](psi_files.md). - How to analyze a [PSI tree](psi_files.md).
- How to find a Java token of interest in the PSI tree. - How to find a Java token of interest in the PSI tree.

View File

@ -1,6 +1,6 @@
# 7. Annotator <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> # 7. Annotator
<link-summary>Sample implementation of annotator highlighting resolved and unresolved Simple language properties in Java strings.</link-summary> <link-summary>Sample implementation of annotator highlighting resolved and unresolved Simple language properties in Java strings.</link-summary>
@ -8,7 +8,7 @@
**Reference**: [](syntax_highlighting_and_error_highlighting.md#annotator) **Reference**: [](syntax_highlighting_and_error_highlighting.md#annotator)
**Code**: [`SimpleAnnotator`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleAnnotator.java) **Code**: [`SimpleAnnotator`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleAnnotator.java)
**Testing**: [](annotator_test.md) **Testing**: [](annotator_test.md)
</tldr> </tldr>
@ -55,7 +55,7 @@ Then, declare the dependency in <path>[plugin.xml](plugin_configuration_file.md)
## Define an Annotator ## Define an Annotator
The [`SimpleAnnotator`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleAnnotator.java) subclasses [`Annotator`](%gh-ic%/platform/analysis-api/src/com/intellij/lang/annotation/Annotator.java). The [`SimpleAnnotator`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleAnnotator.java) subclasses [`Annotator`](%gh-ic%/platform/analysis-api/src/com/intellij/lang/annotation/Annotator.java).
Consider a literal string that starts with "simple:" as a prefix of a Simple Language key. Consider a literal string that starts with "simple:" as a prefix of a Simple Language key.
It isn't part of the Simple Language, but it is a useful convention for detecting Simple Language keys embedded as string literals in other languages, like Java. It isn't part of the Simple Language, but it is a useful convention for detecting Simple Language keys embedded as string literals in other languages, like Java.
Annotate the `simple:key` literal expression, and differentiate between a well-formed vs. an unresolved property. Annotate the `simple:key` literal expression, and differentiate between a well-formed vs. an unresolved property.

View File

@ -1,6 +1,6 @@
# 17. Code Style Settings <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> # 17. Code Style Settings
<link-summary>Sample implementation of code style settings allowing to configure the Simple language formatter.</link-summary> <link-summary>Sample implementation of code style settings allowing to configure the Simple language formatter.</link-summary>
@ -8,9 +8,9 @@
**Reference**: [](code_formatting.md#code-style-settings) **Reference**: [](code_formatting.md#code-style-settings)
**Code**: [`SimpleCodeStyleSettings`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCodeStyleSettings.java), **Code**: [`SimpleCodeStyleSettings`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCodeStyleSettings.java),
[`SimpleCodeStyleSettingsProvider`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCodeStyleSettingsProvider.java), [`SimpleCodeStyleSettingsProvider`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCodeStyleSettingsProvider.java),
[`SimpleLanguageCodeStyleSettingsProvider`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLanguageCodeStyleSettingsProvider.java) [`SimpleLanguageCodeStyleSettingsProvider`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLanguageCodeStyleSettingsProvider.java)
</tldr> </tldr>
@ -22,7 +22,7 @@ This example creates a Settings page that uses the default language code style s
## Define Code Style Settings ## Define Code Style Settings
Define [`SimpleCodeStyleSettings`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCodeStyleSettings.java) Define [`SimpleCodeStyleSettings`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCodeStyleSettings.java)
for Simple Language by subclassing [`CustomCodeStyleSettings`](%gh-ic%/platform/code-style-api/src/com/intellij/psi/codeStyle/CustomCodeStyleSettings.java). for Simple Language by subclassing [`CustomCodeStyleSettings`](%gh-ic%/platform/code-style-api/src/com/intellij/psi/codeStyle/CustomCodeStyleSettings.java).
```java ```java
@ -33,7 +33,7 @@ for Simple Language by subclassing [`CustomCodeStyleSettings`](%gh-ic%/platform/
The code style settings provider gives the IntelliJ Platform a standard way to instantiate `CustomCodeStyleSettings` for the Simple Language. The code style settings provider gives the IntelliJ Platform a standard way to instantiate `CustomCodeStyleSettings` for the Simple Language.
Define [`SimpleCodeStyleSettingsProvider`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCodeStyleSettingsProvider.java) Define [`SimpleCodeStyleSettingsProvider`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCodeStyleSettingsProvider.java)
for Simple Language by subclassing [`CodeStyleSettingsProvider`](%gh-ic%/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsProvider.java). for Simple Language by subclassing [`CodeStyleSettingsProvider`](%gh-ic%/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsProvider.java).
```java ```java
@ -53,7 +53,7 @@ The `SimpleCodeStyleSettingsProvider` implementation is registered with the Inte
## Define the Language Code Style Settings Provider ## Define the Language Code Style Settings Provider
Define [`SimpleLanguageCodeStyleSettingsProvider`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLanguageCodeStyleSettingsProvider.java) for Simple Language by subclassing [`LanguageCodeStyleSettingsProvider`](%gh-ic%/platform/lang-api/src/com/intellij/psi/codeStyle/LanguageCodeStyleSettingsProvider.java), which provides common code style settings for a specific language. Define [`SimpleLanguageCodeStyleSettingsProvider`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLanguageCodeStyleSettingsProvider.java) for Simple Language by subclassing [`LanguageCodeStyleSettingsProvider`](%gh-ic%/platform/lang-api/src/com/intellij/psi/codeStyle/LanguageCodeStyleSettingsProvider.java), which provides common code style settings for a specific language.
```java ```java
``` ```

View File

@ -1,6 +1,6 @@
# 18. Commenter <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> # 18. Commenter
<link-summary>Sample implementation of Simple language code commenter.</link-summary> <link-summary>Sample implementation of Simple language code commenter.</link-summary>
@ -8,7 +8,7 @@
**Reference**: [](additional_minor_features.md#comment-code) **Reference**: [](additional_minor_features.md#comment-code)
**Code**: [`SimpleCommenter`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCommenter.java) **Code**: [`SimpleCommenter`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCommenter.java)
**Testing**: [](commenter_test.md) **Testing**: [](commenter_test.md)
@ -21,7 +21,7 @@ The [`Commenter`](%gh-ic%/platform/core-api/src/com/intellij/lang/Commenter.java
## Define a Commenter ## Define a Commenter
The [`SimpleCommenter`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCommenter.java) for Simple Language defines the line comment prefix as `#`. The [`SimpleCommenter`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCommenter.java) for Simple Language defines the line comment prefix as `#`.
```java ```java
``` ```

View File

@ -1,6 +1,6 @@
# 9. Completion Contributor <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> # 9. Completion Contributor
<link-summary>Sample implementation of code completion in Simple language files.</link-summary> <link-summary>Sample implementation of code completion in Simple language files.</link-summary>
@ -8,7 +8,7 @@
**Reference**: [](code_completion.md) **Reference**: [](code_completion.md)
**Code**: [`SimpleCompletionContributor`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCompletionContributor.java) **Code**: [`SimpleCompletionContributor`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCompletionContributor.java)
</tldr> </tldr>
@ -19,7 +19,7 @@ Custom languages provide code completion using one of two approaches: Contributo
## Define a Completion Contributor ## Define a Completion Contributor
For this tutorial, the `simple_language_plugin` provides custom completion for values in Simple Language property files. For this tutorial, the `simple_language_plugin` provides custom completion for values in Simple Language property files.
Create [`SimpleCompletionContributor`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCompletionContributor.java) Create [`SimpleCompletionContributor`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCompletionContributor.java)
by subclassing [`CompletionContributor`](%gh-ic%/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionContributor.java). by subclassing [`CompletionContributor`](%gh-ic%/platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionContributor.java).
This rudimentary completion contributor always adds "Hello" to the completion variants result set, regardless of context: This rudimentary completion contributor always adds "Hello" to the completion variants result set, regardless of context:

View File

@ -15,7 +15,7 @@ In this tutorial, we will add support for a [.properties](https://en.wikipedia.o
> >
{title="Navigating this tutorial"} {title="Navigating this tutorial"}
> The complete and fully working example plugin used in this tutorial is the [`simple_language_plugin`](%gh-sdk-samples%/simple_language_plugin) code sample. > The complete and fully working example plugin used in this tutorial is the [`simple_language_plugin`](%gh-sdk-samples-master%/simple_language_plugin) code sample.
> >
> See [](code_samples.md) on how to build and run it. > See [](code_samples.md) on how to build and run it.
> >

View File

@ -8,8 +8,8 @@
**Reference**: [](documentation.md) **Reference**: [](documentation.md)
**Code**: [`SimpleDocumentationProvider`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleDocumentationProvider.java), **Code**: [`SimpleDocumentationProvider`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleDocumentationProvider.java),
[`SimpleUtil`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleUtil.java) [`SimpleUtil`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleUtil.java)
**Testing**: [](documentation_test.md) **Testing**: [](documentation_test.md)

View File

@ -1,6 +1,6 @@
# 11. Find Usages Provider <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> # 11. Find Usages Provider
<link-summary>Sample implementation of finding usages of Simple language properties.</link-summary> <link-summary>Sample implementation of finding usages of Simple language properties.</link-summary>
@ -8,7 +8,7 @@
**Reference**: [](find_usages.md) **Reference**: [](find_usages.md)
**Code**: [`SimpleFindUsagesProvider`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFindUsagesProvider.java) **Code**: [`SimpleFindUsagesProvider`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFindUsagesProvider.java)
**Testing**: [](find_usages_test.md) **Testing**: [](find_usages_test.md)
@ -21,7 +21,7 @@ A scanner breaks the text into words and defines the context for each word.
## Define a Find Usages Provider ## Define a Find Usages Provider
The [`SimpleFindUsagesProvider`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFindUsagesProvider.java) implements [`FindUsagesProvider`](%gh-ic%/platform/indexing-api/src/com/intellij/lang/findUsages/FindUsagesProvider.java). The [`SimpleFindUsagesProvider`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFindUsagesProvider.java) implements [`FindUsagesProvider`](%gh-ic%/platform/indexing-api/src/com/intellij/lang/findUsages/FindUsagesProvider.java).
Using the [`DefaultWordsScanner`](%gh-ic%/platform/indexing-api/src/com/intellij/lang/cacheBuilder/DefaultWordsScanner.java) ensures the scanner implementation is thread-safe. Using the [`DefaultWordsScanner`](%gh-ic%/platform/indexing-api/src/com/intellij/lang/cacheBuilder/DefaultWordsScanner.java) ensures the scanner implementation is thread-safe.
See the comments in `FindUsagesProvider` for more information. See the comments in `FindUsagesProvider` for more information.

View File

@ -6,7 +6,7 @@
<tldr> <tldr>
**Code**: [`SimpleFoldingBuilder`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFoldingBuilder.java) **Code**: [`SimpleFoldingBuilder`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFoldingBuilder.java)
**Testing**: [](folding_test.md) **Testing**: [](folding_test.md)
@ -20,7 +20,7 @@ Rather than the usual practice of using a folding builder to collapse a class, m
## Define a Folding Builder ## Define a Folding Builder
The [`SimpleFoldingBuilder`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFoldingBuilder.java) replaces usages of properties with their values by default. The [`SimpleFoldingBuilder`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFoldingBuilder.java) replaces usages of properties with their values by default.
Start by subclassing [`FoldingBuilderEx`](%gh-ic%/platform/core-api/src/com/intellij/lang/folding/FoldingBuilderEx.java) Start by subclassing [`FoldingBuilderEx`](%gh-ic%/platform/core-api/src/com/intellij/lang/folding/FoldingBuilderEx.java)
Note that `SimpleFoldingBuilder` is marked [dumb aware](indexing_and_psi_stubs.md#DumbAwareAPI), Note that `SimpleFoldingBuilder` is marked [dumb aware](indexing_and_psi_stubs.md#DumbAwareAPI),

View File

@ -8,8 +8,8 @@
**Reference**: [](code_formatting.md) **Reference**: [](code_formatting.md)
**Code**: [`SimpleBlock`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleBlock.java), **Code**: [`SimpleBlock`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleBlock.java),
[`SimpleFormattingModelBuilder`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFormattingModelBuilder.java) [`SimpleFormattingModelBuilder`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFormattingModelBuilder.java)
**Testing**: [](formatter_test.md) **Testing**: [](formatter_test.md)
@ -26,7 +26,7 @@ The formatter controls spaces, indents, wrap, and alignment.
The formatting model represents the formatting structure of a file as a tree of [`Block`](%gh-ic%/platform/code-style-api/src/com/intellij/formatting/Block.java) objects, with associated indent, wrap, alignment, and spacing settings. The formatting model represents the formatting structure of a file as a tree of [`Block`](%gh-ic%/platform/code-style-api/src/com/intellij/formatting/Block.java) objects, with associated indent, wrap, alignment, and spacing settings.
The goal is to cover each PSI element with such a block. The goal is to cover each PSI element with such a block.
Since each block builds its children's blocks, it can generate extra blocks or skip any PSI elements. Since each block builds its children's blocks, it can generate extra blocks or skip any PSI elements.
Define [`SimpleBlock`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleBlock.java) based on [`AbstractBlock`](%gh-ic%/platform/code-style-impl/src/com/intellij/psi/formatter/common/AbstractBlock.java). Define [`SimpleBlock`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleBlock.java) based on [`AbstractBlock`](%gh-ic%/platform/code-style-impl/src/com/intellij/psi/formatter/common/AbstractBlock.java).
```java ```java
``` ```
@ -47,7 +47,7 @@ foo = bar
``` ```
</compare> </compare>
Create [`SimpleFormattingModelBuilder`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFormattingModelBuilder.java) by implementing [`FormattingModelBuilder`](%gh-ic%/platform/code-style-api/src/com/intellij/formatting/FormattingModelBuilder.java). Create [`SimpleFormattingModelBuilder`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFormattingModelBuilder.java) by implementing [`FormattingModelBuilder`](%gh-ic%/platform/code-style-api/src/com/intellij/formatting/FormattingModelBuilder.java).
```java ```java
``` ```

View File

@ -1,4 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# 13. Go To Symbol Contributor # 13. Go To Symbol Contributor
@ -9,8 +9,8 @@
**Reference**: [](go_to_class_and_go_to_symbol.md) **Reference**: [](go_to_class_and_go_to_symbol.md)
**Code**: **Code**:
[`SimpleChooseByNameContributor`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleChooseByNameContributor.java), [`SimpleChooseByNameContributor`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleChooseByNameContributor.java),
[`SimplePsiImplUtil`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/impl/SimplePsiImplUtil.java) [`SimplePsiImplUtil`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/impl/SimplePsiImplUtil.java)
</tldr> </tldr>
@ -22,13 +22,13 @@ A _Go to Symbol Contributor_ helps the user to navigate to any PSI element by it
To specify what a PSI element looks like in the <ui-path>Navigate | Symbol</ui-path> popup window, <control>Structure</control> tool window, or other components, it should implement `getPresentation()`. To specify what a PSI element looks like in the <ui-path>Navigate | Symbol</ui-path> popup window, <control>Structure</control> tool window, or other components, it should implement `getPresentation()`.
This method gets defined in the utility class `SimplePsiImplUtil`, and the parser and PSI classes must be regenerated. This method gets defined in the utility class `SimplePsiImplUtil`, and the parser and PSI classes must be regenerated.
Add the following method to [`SimplePsiImplUtil`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/impl/SimplePsiImplUtil.java): Add the following method to [`SimplePsiImplUtil`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/impl/SimplePsiImplUtil.java):
```java ```java
``` ```
{src="simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/impl/SimplePsiImplUtil.java" include-symbol="getPresentation"} {src="simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/impl/SimplePsiImplUtil.java" include-symbol="getPresentation"}
In addition, to provide an icon for the displayed items, extend [`IconProvider`](%gh-ic%/platform/core-api/src/com/intellij/ide/IconProvider.java) and register it in `com.intellij.iconProvider` extension point. See [`SimplePropertyIconProvider`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimplePropertyIconProvider.java): In addition, to provide an icon for the displayed items, extend [`IconProvider`](%gh-ic%/platform/core-api/src/com/intellij/ide/IconProvider.java) and register it in `com.intellij.iconProvider` extension point. See [`SimplePropertyIconProvider`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimplePropertyIconProvider.java):
```java ```java
``` ```
@ -51,7 +51,7 @@ property ::= (KEY? SEPARATOR VALUE?) | KEY {
## Define a Go To Symbol Contributor ## Define a Go To Symbol Contributor
To contribute items to <ui-path>Navigate | Symbol</ui-path> results, subclass [`ChooseByNameContributorEx`](%gh-ic%/platform/lang-impl/src/com/intellij/navigation/ChooseByNameContributorEx.java) To contribute items to <ui-path>Navigate | Symbol</ui-path> results, subclass [`ChooseByNameContributorEx`](%gh-ic%/platform/lang-impl/src/com/intellij/navigation/ChooseByNameContributorEx.java)
to create [`SimpleChooseByNameContributor`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleChooseByNameContributor.java): to create [`SimpleChooseByNameContributor`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleChooseByNameContributor.java):
```java ```java
``` ```

View File

@ -1,4 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# 3. Grammar and Parser # 3. Grammar and Parser
@ -8,8 +8,8 @@
**Reference**: [](implementing_lexer.md), [](implementing_parser_and_psi.md) **Reference**: [](implementing_lexer.md), [](implementing_parser_and_psi.md)
**Code**: [`SimpleTokenType`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleTokenType.java), **Code**: [`SimpleTokenType`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleTokenType.java),
[`SimpleElementType`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleElementType.java) [`SimpleElementType`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleElementType.java)
</tldr> </tldr>
<include from="language_and_filetype.md" element-id="custom_language_tutorial_header"></include> <include from="language_and_filetype.md" element-id="custom_language_tutorial_header"></include>
@ -19,7 +19,7 @@ The Simple Language grammar must also be defined to generate a parser.
## Define a Token Type ## Define a Token Type
Create [`SimpleTokenType`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleTokenType.java) Create [`SimpleTokenType`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleTokenType.java)
in the `org.intellij.sdk.language.psi` package by subclassing `IElementType`. in the `org.intellij.sdk.language.psi` package by subclassing `IElementType`.
```java ```java
@ -28,7 +28,7 @@ in the `org.intellij.sdk.language.psi` package by subclassing `IElementType`.
## Define an Element Type ## Define an Element Type
Create the [`SimpleElementType`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleElementType.java) in the `org.intellij.sdk.language.psi` package by subclassing `IElementType`. Create the [`SimpleElementType`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleElementType.java) in the `org.intellij.sdk.language.psi` package by subclassing `IElementType`.
```java ```java
``` ```
@ -100,6 +100,6 @@ sourceSets.main.java.srcDirs 'src/main/gen'
</tab> </tab>
</tabs> </tabs>
See <path>[build.gradle.kts](%gh-sdk-samples%/simple_language_plugin/build.gradle.kts)</path> for the reference. See <path>[build.gradle.kts](%gh-sdk-samples-master%/simple_language_plugin/build.gradle.kts)</path> for the reference.
Reload the Gradle project for changes to take effect and build the project. Reload the Gradle project for changes to take effect and build the project.

View File

@ -8,9 +8,9 @@
**Reference**: [](registering_file_type.md) **Reference**: [](registering_file_type.md)
**Code**: [`SimpleLanguage`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLanguage.java), **Code**: [`SimpleLanguage`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLanguage.java),
[`SimpleIcons`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleIcons.java), [`SimpleIcons`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleIcons.java),
[`SimpleFileType`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFileType.java) [`SimpleFileType`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFileType.java)
</tldr> </tldr>
@ -28,7 +28,7 @@ Register the `LanguageFileType` with the IntelliJ Platform in the plugin configu
## Define the Language ## Define the Language
The language implemented in this tutorial is named "Simple" - note the case of the name. The language implemented in this tutorial is named "Simple" - note the case of the name.
The [`SimpleLanguage`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLanguage.java) class is defined in the `org.intellij.sdk.language` package of the `simple_language_plugin` code sample: The [`SimpleLanguage`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLanguage.java) class is defined in the `org.intellij.sdk.language` package of the `simple_language_plugin` code sample:
```java ```java
``` ```
@ -36,8 +36,8 @@ The [`SimpleLanguage`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org
## Define an Icon ## Define an Icon
The [icon](%gh-sdk-samples%/simple_language_plugin/src/main/resources/icons/jar-gray.png) for the Simple Language is defined by the The [icon](%gh-sdk-samples-master%/simple_language_plugin/src/main/resources/icons/jar-gray.png) for the Simple Language is defined by the
[`SimpleIcons`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleIcons.java) class. [`SimpleIcons`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleIcons.java) class.
Please see [](icons.md) for details on how to define and use icons. Please see [](icons.md) for details on how to define and use icons.
```java ```java
@ -46,7 +46,7 @@ Please see [](icons.md) for details on how to define and use icons.
## Define a File Type ## Define a File Type
The [`SimpleFileType`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFileType.java) is defined by subclassing [`LanguageFileType`](%gh-ic%/platform/core-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java): The [`SimpleFileType`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleFileType.java) is defined by subclassing [`LanguageFileType`](%gh-ic%/platform/core-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java):
```java ```java
``` ```

View File

@ -8,11 +8,11 @@
**Reference**: [](implementing_lexer.md) **Reference**: [](implementing_lexer.md)
**Code**: [`Simple.flex`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/Simple.flex), **Code**: [`Simple.flex`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/Simple.flex),
[`SimpleLexerAdapter`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLexerAdapter.java), [`SimpleLexerAdapter`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLexerAdapter.java),
[`SimpleFile`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleFile.java), [`SimpleFile`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleFile.java),
[`SimpleTokenSets`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleTokenSets.java), [`SimpleTokenSets`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleTokenSets.java),
[`SimpleParserDefinition`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleParserDefinition.java) [`SimpleParserDefinition`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleParserDefinition.java)
**Testing**: [](parsing_test.md) **Testing**: [](parsing_test.md)
@ -25,7 +25,7 @@ The easiest way to create a lexer is to use [JFlex](https://jflex.de/).
## Define a Lexer ## Define a Lexer
Define a [`Simple.flex`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/Simple.flex) file with rules for the Simple Language lexer in package `org.intellij.sdk.language`. Define a [`Simple.flex`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/Simple.flex) file with rules for the Simple Language lexer in package `org.intellij.sdk.language`.
```java ```java
``` ```
@ -49,7 +49,7 @@ After that, the IDE generates the lexer under the <path>gen</path> directory, fo
## Define a Lexer Adapter ## Define a Lexer Adapter
The JFlex lexer needs to be adapted to the IntelliJ Platform Lexer API. The JFlex lexer needs to be adapted to the IntelliJ Platform Lexer API.
Implement [`SimpleLexerAdapter`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLexerAdapter.java) by subclassing [`FlexAdapter`](%gh-ic%/platform/core-api/src/com/intellij/lexer/FlexAdapter.java). Implement [`SimpleLexerAdapter`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLexerAdapter.java) by subclassing [`FlexAdapter`](%gh-ic%/platform/core-api/src/com/intellij/lexer/FlexAdapter.java).
```java ```java
``` ```
@ -57,7 +57,7 @@ Implement [`SimpleLexerAdapter`](%gh-sdk-samples%/simple_language_plugin/src/mai
## Define a Root File ## Define a Root File
The [`SimpleFile`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleFile.java) implementation is the top-level node of the [tree of `PsiElements`](implementing_parser_and_psi.md) for a Simple Language file. The [`SimpleFile`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleFile.java) implementation is the top-level node of the [tree of `PsiElements`](implementing_parser_and_psi.md) for a Simple Language file.
```java ```java
``` ```
@ -65,7 +65,7 @@ The [`SimpleFile`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/int
## Define Token Sets ## Define Token Sets
Define all sets of related token types from `SimpleTypes` in [`SimpleTokenSets`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleTokenSets.java). Define all sets of related token types from `SimpleTypes` in [`SimpleTokenSets`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleTokenSets.java).
```java ```java
@ -74,7 +74,7 @@ Define all sets of related token types from `SimpleTypes` in [`SimpleTokenSets`]
## Define a Parser ## Define a Parser
The Simple Language parser is defined in [`SimpleParserDefinition`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleParserDefinition.java) by subclassing [`ParserDefinition`](%gh-ic%/platform/core-api/src/com/intellij/lang/ParserDefinition.java). The Simple Language parser is defined in [`SimpleParserDefinition`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleParserDefinition.java) by subclassing [`ParserDefinition`](%gh-ic%/platform/core-api/src/com/intellij/lang/ParserDefinition.java).
To avoid unnecessary classloading when initializing the extension point implementation, all `TokenSet` return values should use constants from dedicated `$Language$TokenSets` class. To avoid unnecessary classloading when initializing the extension point implementation, all `TokenSet` return values should use constants from dedicated `$Language$TokenSets` class.
```java ```java

View File

@ -1,12 +1,12 @@
# 8. Line Marker Provider <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> # 8. Line Marker Provider
<link-summary>Sample implementation of line marker provider adding gutter icons for Simple language property occurrences in Java files, and allowing to navigate to a property definition.</link-summary> <link-summary>Sample implementation of line marker provider adding gutter icons for Simple language property occurrences in Java files, and allowing to navigate to a property definition.</link-summary>
<tldr> <tldr>
**Code**: [`SimpleLineMarkerProvider`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLineMarkerProvider.java) **Code**: [`SimpleLineMarkerProvider`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLineMarkerProvider.java)
</tldr> </tldr>
@ -20,7 +20,7 @@ These markers can provide navigation targets to related code.
A line marker provider annotates usages of Simple Language properties within Java code and provides navigation to the definition of these properties. A line marker provider annotates usages of Simple Language properties within Java code and provides navigation to the definition of these properties.
The visual marker is a Simple Language icon in the gutter of the Editor window. The visual marker is a Simple Language icon in the gutter of the Editor window.
The [`SimpleLineMarkerProvider`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLineMarkerProvider.java) subclasses [`RelatedItemLineMarkerProvider`](%gh-ic%/platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerProvider.java). The [`SimpleLineMarkerProvider`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleLineMarkerProvider.java) subclasses [`RelatedItemLineMarkerProvider`](%gh-ic%/platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerProvider.java).
For this example, override the `collectNavigationMarkers()` method to collect usage of a Simple Language [key and separators](language_and_filetype.md#define-the-language): For this example, override the `collectNavigationMarkers()` method to collect usage of a Simple Language [key and separators](language_and_filetype.md#define-the-language):
```java ```java

View File

@ -1,12 +1,12 @@
# 6. PSI Helpers and Utilities <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> # 6. PSI Helpers and Utilities
<link-summary>Extending the Simple language PSI classes with the utility and helper methods.</link-summary> <link-summary>Extending the Simple language PSI classes with the utility and helper methods.</link-summary>
<tldr> <tldr>
**Code**: [`SimplePsiImplUtil`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/impl/SimplePsiImplUtil.java),[`SimpleUtil`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleUtil.java) **Code**: [`SimplePsiImplUtil`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/impl/SimplePsiImplUtil.java),[`SimpleUtil`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleUtil.java)
</tldr> </tldr>
@ -91,7 +91,7 @@ After making above changes to the grammar, [regenerate](grammar_and_parser.md#ge
## Define a Utility to Search Properties ## Define a Utility to Search Properties
Create [`SimpleUtil`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleUtil.java) utility class to search PSI elements for defined properties over the project. Create [`SimpleUtil`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleUtil.java) utility class to search PSI elements for defined properties over the project.
It will be used later when implementing [code completion](completion_contributor.md). It will be used later when implementing [code completion](completion_contributor.md).
```java ```java

View File

@ -1,6 +1,6 @@
# 19. Quick Fix <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> # 19. Quick Fix
<link-summary>Sample implementation a quick fix adding a missing Simple language property referenced in a Java file.</link-summary> <link-summary>Sample implementation a quick fix adding a missing Simple language property referenced in a Java file.</link-summary>
@ -10,9 +10,9 @@
**Reference**: [](code_inspections_and_intentions.md) **Reference**: [](code_inspections_and_intentions.md)
**Code**: [`SimpleElementFactory`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleElementFactory.java), **Code**: [`SimpleElementFactory`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleElementFactory.java),
[`SimpleCreatePropertyQuickFix`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCreatePropertyQuickFix.java), [`SimpleCreatePropertyQuickFix`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCreatePropertyQuickFix.java),
[`SimpleAnnotator`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleAnnotator.java) [`SimpleAnnotator`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleAnnotator.java)
</tldr> </tldr>
@ -20,7 +20,7 @@ A quick fix for a custom language supports the IntelliJ Platform-based IDE featu
For the Simple language, this tutorial adds a quick fix that helps to define an unresolved property from its usage. For the Simple language, this tutorial adds a quick fix that helps to define an unresolved property from its usage.
## Update the Element Factory ## Update the Element Factory
The [`SimpleElementFactory`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleElementFactory.java) is updated to include two new methods to support the user choice of creating a new property for the Simple Language quick fix. The [`SimpleElementFactory`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleElementFactory.java) is updated to include two new methods to support the user choice of creating a new property for the Simple Language quick fix.
The new `createCRLF()` method supports adding a newline to the end of the [`test.simple`](lexer_and_parser_definition.md#run-the-project) file before adding a new property. The new `createCRLF()` method supports adding a newline to the end of the [`test.simple`](lexer_and_parser_definition.md#run-the-project) file before adding a new property.
A new overload of `createProperty()` creates a new `key`-`value` pair for Simple Language. A new overload of `createProperty()` creates a new `key`-`value` pair for Simple Language.
@ -29,9 +29,9 @@ A new overload of `createProperty()` creates a new `key`-`value` pair for Simple
{src="simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleElementFactory.java" include-symbol="SimpleElementFactory"} {src="simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleElementFactory.java" include-symbol="SimpleElementFactory"}
## Define an Intention Action ## Define an Intention Action
The [`SimpleCreatePropertyQuickFix`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCreatePropertyQuickFix.java) creates a property in the file chosen by the user - in this case, a Java file containing a `prefix:key` - and navigate to this property after creation. The [`SimpleCreatePropertyQuickFix`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCreatePropertyQuickFix.java) creates a property in the file chosen by the user - in this case, a Java file containing a `prefix:key` - and navigate to this property after creation.
Under the hood, `SimpleCreatePropertyQuickFix` is an Intention Action. Under the hood, `SimpleCreatePropertyQuickFix` is an Intention Action.
For a more in-depth example of an Intention Action, see [`conditional_operator_intention`](%gh-sdk-samples%/conditional_operator_intention). For a more in-depth example of an Intention Action, see [`conditional_operator_intention`](%gh-sdk-samples-master%/conditional_operator_intention).
```java ```java
``` ```
@ -39,7 +39,7 @@ For a more in-depth example of an Intention Action, see [`conditional_operator_i
## Update the Annotator ## Update the Annotator
When a `badProperty` annotation is created, the `badProperty.registerFix()` method in When a `badProperty` annotation is created, the `badProperty.registerFix()` method in
[`SimpleAnnotator`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleAnnotator.java) is called. [`SimpleAnnotator`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleAnnotator.java) is called.
This method call registers the `SimpleCreatePropertyQuickFix` as the Intention Action for the IntelliJ Platform to use to correct the problem. This method call registers the `SimpleCreatePropertyQuickFix` as the Intention Action for the IntelliJ Platform to use to correct the problem.
```java ```java

View File

@ -1,6 +1,6 @@
# 10. Reference Contributor <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> # 10. Reference Contributor
<link-summary>Sample implementation of reference contributor adding Simple language references in Java strings.</link-summary> <link-summary>Sample implementation of reference contributor adding Simple language references in Java strings.</link-summary>
@ -8,11 +8,11 @@
**Reference**: [](references_and_resolve.md), [](psi_references.md) **Reference**: [](references_and_resolve.md), [](psi_references.md)
**Code**: [`SimpleNamedElement`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleNamedElement.java), **Code**: [`SimpleNamedElement`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleNamedElement.java),
[`SimpleNamedElementImpl`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/impl/SimpleNamedElementImpl.java), [`SimpleNamedElementImpl`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/impl/SimpleNamedElementImpl.java),
[`SimpleReference.java`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleReference.java), [`SimpleReference.java`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleReference.java),
[`SimpleReferenceContributor`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleReferenceContributor.java), [`SimpleReferenceContributor`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleReferenceContributor.java),
[`SimpleRefactoringSupportProvider`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleRefactoringSupportProvider.java) [`SimpleRefactoringSupportProvider`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleRefactoringSupportProvider.java)
**Testing**: [](completion_test.md), [](rename_test.md), [](reference_test.md), **Testing**: [](completion_test.md), [](rename_test.md), [](reference_test.md),
@ -31,13 +31,13 @@ Resolving references means the ability to go from the usage of an element to its
The classes below show how the Simple Language fulfills the need to implement `PsiNamedElement`. The classes below show how the Simple Language fulfills the need to implement `PsiNamedElement`.
The [`SimpleNamedElement`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleNamedElement.java) interface is subclassed from [`PsiNameIdentifierOwner`](%gh-ic%/platform/core-api/src/com/intellij/psi/PsiNameIdentifierOwner.java). The [`SimpleNamedElement`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleNamedElement.java) interface is subclassed from [`PsiNameIdentifierOwner`](%gh-ic%/platform/core-api/src/com/intellij/psi/PsiNameIdentifierOwner.java).
```java ```java
``` ```
{src="simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleNamedElement.java" include-symbol="SimpleNamedElement"} {src="simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/SimpleNamedElement.java" include-symbol="SimpleNamedElement"}
The [`SimpleNamedElementImpl`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/impl/SimpleNamedElementImpl.java) class implements the `SimpleNamedElement` interface and extends [`ASTWrapperPsiElement`](%gh-ic%/platform/core-impl/src/com/intellij/extapi/psi/ASTWrapperPsiElement.java). The [`SimpleNamedElementImpl`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/psi/impl/SimpleNamedElementImpl.java) class implements the `SimpleNamedElement` interface and extends [`ASTWrapperPsiElement`](%gh-ic%/platform/core-impl/src/com/intellij/extapi/psi/ASTWrapperPsiElement.java).
```java ```java
``` ```
@ -120,7 +120,7 @@ property ::= (KEY? SEPARATOR VALUE?) | KEY {
## Define a Reference ## Define a Reference
Now define a reference class [`SimpleReference.java`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleReference.java) to resolve a property from its usage. Now define a reference class [`SimpleReference.java`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleReference.java) to resolve a property from its usage.
This requires extending [`PsiReferenceBase`](%gh-ic%/platform/core-api/src/com/intellij/psi/PsiReferenceBase.java) and implementing [`PsiPolyVariantReference`](%gh-ic%/platform/core-api/src/com/intellij/psi/PsiPolyVariantReference.java). This requires extending [`PsiReferenceBase`](%gh-ic%/platform/core-api/src/com/intellij/psi/PsiReferenceBase.java) and implementing [`PsiPolyVariantReference`](%gh-ic%/platform/core-api/src/com/intellij/psi/PsiPolyVariantReference.java).
The latter enables the reference to resolve to more than one element or to resolve result(s) for a superset of valid resolve cases. The latter enables the reference to resolve to more than one element or to resolve result(s) for a superset of valid resolve cases.
@ -131,7 +131,7 @@ The latter enables the reference to resolve to more than one element or to resol
## Define a Reference Contributor ## Define a Reference Contributor
A reference contributor allows the `simple_language_plugin` to provide references to Simple Language from elements in other languages such as Java. A reference contributor allows the `simple_language_plugin` to provide references to Simple Language from elements in other languages such as Java.
Create [`SimpleReferenceContributor`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleReferenceContributor.java) by subclassing [`PsiReferenceContributor`](%gh-ic%/platform/core-api/src/com/intellij/psi/PsiReferenceContributor.java). Create [`SimpleReferenceContributor`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleReferenceContributor.java) by subclassing [`PsiReferenceContributor`](%gh-ic%/platform/core-api/src/com/intellij/psi/PsiReferenceContributor.java).
Contribute a reference to each usage of a property: Contribute a reference to each usage of a property:
```java ```java
@ -164,7 +164,7 @@ The [Rename refactoring](https://www.jetbrains.com/help/idea/rename-refactorings
## Define a Refactoring Support Provider ## Define a Refactoring Support Provider
Support for in-place refactoring is specified explicitly in a refactoring support provider. Support for in-place refactoring is specified explicitly in a refactoring support provider.
Create [`SimpleRefactoringSupportProvider`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleRefactoringSupportProvider.java) by subclassing [`RefactoringSupportProvider`](%gh-ic%/platform/refactoring/src/com/intellij/lang/refactoring/RefactoringSupportProvider.java) Create [`SimpleRefactoringSupportProvider`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleRefactoringSupportProvider.java) by subclassing [`RefactoringSupportProvider`](%gh-ic%/platform/refactoring/src/com/intellij/lang/refactoring/RefactoringSupportProvider.java)
As long as an element is a `SimpleProperty` it is allowed to be refactored: As long as an element is a `SimpleProperty` it is allowed to be refactored:
```java ```java

View File

@ -1,6 +1,6 @@
# 21. Spell Checking <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> # 21. Spell Checking
<link-summary>Sample implementation of spellchecking strategy allowing to analyze spell correctness in Simple language elements.</link-summary> <link-summary>Sample implementation of spellchecking strategy allowing to analyze spell correctness in Simple language elements.</link-summary>
@ -10,7 +10,7 @@
**Reference**: [](spell_checking.md) **Reference**: [](spell_checking.md)
**Code**: [`SimpleSpellcheckingStrategy`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleSpellcheckingStrategy.java) **Code**: [`SimpleSpellcheckingStrategy`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleSpellcheckingStrategy.java)
</tldr> </tldr>
@ -18,7 +18,7 @@ Spell checking allows users to see spelling errors while editing code.
## Define a SimpleSpellcheckingStrategy ## Define a SimpleSpellcheckingStrategy
The [`SimpleSpellcheckingStrategy`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleSpellcheckingStrategy.java) extends The [`SimpleSpellcheckingStrategy`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleSpellcheckingStrategy.java) extends
[`SpellcheckingStrategy`](%gh-ic%/spellchecker/src/com/intellij/spellchecker/tokenizer/SpellcheckingStrategy.java) [`SpellcheckingStrategy`](%gh-ic%/spellchecker/src/com/intellij/spellchecker/tokenizer/SpellcheckingStrategy.java)
```java ```java

View File

@ -8,7 +8,7 @@
**Reference**: [](navbar.md) **Reference**: [](navbar.md)
**Code**: [`SimpleStructureAwareNavbar`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleStructureAwareNavbar.java) **Code**: [`SimpleStructureAwareNavbar`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleStructureAwareNavbar.java)
</tldr> </tldr>
@ -21,7 +21,7 @@ For example, in Java this is used to display the class and method in which the c
## Define a Structure-Aware Navbar ## Define a Structure-Aware Navbar
The [`SimpleStructureAwareNavbar`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleStructureAwareNavbar.java) implements The [`SimpleStructureAwareNavbar`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleStructureAwareNavbar.java) implements
[`StructureAwareNavBarModelExtension`](%gh-ic%/platform/lang-impl/src/com/intellij/ide/navigationToolbar/StructureAwareNavBarModelExtension.kt). [`StructureAwareNavBarModelExtension`](%gh-ic%/platform/lang-impl/src/com/intellij/ide/navigationToolbar/StructureAwareNavBarModelExtension.kt).
```java ```java

View File

@ -1,6 +1,6 @@
# 14. Structure View Factory <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> # 14. Structure View Factory
<link-summary>Sample implementation of structure view factory adding a Simple language file structure in the Structure tool window.</link-summary> <link-summary>Sample implementation of structure view factory adding a Simple language file structure in the Structure tool window.</link-summary>
@ -8,9 +8,9 @@
**Reference**: [](structure_view.md) **Reference**: [](structure_view.md)
**Code**: [`SimpleStructureViewFactory`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleStructureViewFactory.java), **Code**: [`SimpleStructureViewFactory`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleStructureViewFactory.java),
[`SimpleStructureViewModel`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleStructureViewModel.java), [`SimpleStructureViewModel`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleStructureViewModel.java),
[`SimpleStructureViewElement`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleStructureViewElement.java) [`SimpleStructureViewElement`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleStructureViewElement.java)
</tldr> </tldr>
@ -21,7 +21,7 @@ Creating a structure view factory allows showing the structure of any file in th
## Define a Structure View Factory ## Define a Structure View Factory
The [`SimpleStructureViewFactory`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleStructureViewFactory.java) The [`SimpleStructureViewFactory`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleStructureViewFactory.java)
implements [`PsiStructureViewFactory`](%gh-ic%/platform/editor-ui-api/src/com/intellij/lang/PsiStructureViewFactory.java). implements [`PsiStructureViewFactory`](%gh-ic%/platform/editor-ui-api/src/com/intellij/lang/PsiStructureViewFactory.java).
The `getStructureViewBuilder()` implementation reuses the IntelliJ Platform class [`TreeBasedStructureViewBuilder`](%gh-ic%/platform/editor-ui-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java). The `getStructureViewBuilder()` implementation reuses the IntelliJ Platform class [`TreeBasedStructureViewBuilder`](%gh-ic%/platform/editor-ui-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java).
At this point the project will not compile until `SimpleStructureViewModel` is [implemented below](#define-a-structure-view-model). At this point the project will not compile until `SimpleStructureViewModel` is [implemented below](#define-a-structure-view-model).
@ -32,7 +32,7 @@ At this point the project will not compile until `SimpleStructureViewModel` is [
## Define a Structure View Model ## Define a Structure View Model
The [`SimpleStructureViewModel`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleStructureViewModel.java) is created by implementing [`StructureViewModel`](%gh-ic%/platform/editor-ui-api/src/com/intellij/ide/structureView/StructureViewModel.java), which defines the model for data displayed in the standard structure view. The [`SimpleStructureViewModel`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleStructureViewModel.java) is created by implementing [`StructureViewModel`](%gh-ic%/platform/editor-ui-api/src/com/intellij/ide/structureView/StructureViewModel.java), which defines the model for data displayed in the standard structure view.
It also extends [`StructureViewModelBase`](%gh-ic%/platform/editor-ui-api/src/com/intellij/ide/structureView/StructureViewModelBase.java), an implementation that links the model to a text editor. It also extends [`StructureViewModelBase`](%gh-ic%/platform/editor-ui-api/src/com/intellij/ide/structureView/StructureViewModelBase.java), an implementation that links the model to a text editor.
```java ```java
@ -41,7 +41,7 @@ It also extends [`StructureViewModelBase`](%gh-ic%/platform/editor-ui-api/src/co
## Define a Structure View Element ## Define a Structure View Element
The [`SimpleStructureViewElement`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleStructureViewElement.java) The [`SimpleStructureViewElement`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleStructureViewElement.java)
implements [`StructureViewTreeElement`](%gh-ic%/platform/editor-ui-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java) and [`SortableTreeElement`](%gh-ic%/platform/editor-ui-api/src/com/intellij/ide/util/treeView/smartTree/SortableTreeElement.java). implements [`StructureViewTreeElement`](%gh-ic%/platform/editor-ui-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java) and [`SortableTreeElement`](%gh-ic%/platform/editor-ui-api/src/com/intellij/ide/util/treeView/smartTree/SortableTreeElement.java).
The `StructureViewTreeElement` represents an element in the Structure View tree model. The `StructureViewTreeElement` represents an element in the Structure View tree model.
The `SortableTreeElement` represents an item in a smart tree that allows using text other than the presentable text as a key for alphabetic sorting. The `SortableTreeElement` represents an item in a smart tree that allows using text other than the presentable text as a key for alphabetic sorting.

View File

@ -1,6 +1,6 @@
# 5. Syntax Highlighter and Color Settings Page <!-- Copyright 2000-2024 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<!-- Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. --> # 5. Syntax Highlighter and Color Settings Page
<link-summary>Sample implementation of a syntax highlighter and color settings page allowing to edit Simple language syntax element colors.</link-summary> <link-summary>Sample implementation of a syntax highlighter and color settings page allowing to edit Simple language syntax element colors.</link-summary>
@ -8,9 +8,9 @@
**Reference**: [](syntax_highlighting_and_error_highlighting.md) **Reference**: [](syntax_highlighting_and_error_highlighting.md)
**Code**: [`SimpleSyntaxHighlighter`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleSyntaxHighlighter.java), **Code**: [`SimpleSyntaxHighlighter`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleSyntaxHighlighter.java),
[`SimpleSyntaxHighlighterFactory`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleSyntaxHighlighterFactory.java), [`SimpleSyntaxHighlighterFactory`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleSyntaxHighlighterFactory.java),
[`SimpleColorSettingsPage`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleColorSettingsPage.java) [`SimpleColorSettingsPage`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleColorSettingsPage.java)
</tldr> </tldr>
@ -21,7 +21,7 @@ A plugin can also define color settings based on `ColorSettingPage` so the user
## Define a Syntax Highlighter ## Define a Syntax Highlighter
The [`SimpleSyntaxHighlighter`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleSyntaxHighlighter.java) class extends [`SyntaxHighlighterBase`](%gh-ic%/platform/editor-ui-api/src/com/intellij/openapi/fileTypes/SyntaxHighlighterBase.java). The [`SimpleSyntaxHighlighter`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleSyntaxHighlighter.java) class extends [`SyntaxHighlighterBase`](%gh-ic%/platform/editor-ui-api/src/com/intellij/openapi/fileTypes/SyntaxHighlighterBase.java).
As recommended in [Color Scheme Management](color_scheme_management.md#text-attribute-key-dependency), the Simple Language highlighting text attributes are specified as a dependency on one of standard IntelliJ Platform keys. As recommended in [Color Scheme Management](color_scheme_management.md#text-attribute-key-dependency), the Simple Language highlighting text attributes are specified as a dependency on one of standard IntelliJ Platform keys.
For the Simple Language, define only one scheme. For the Simple Language, define only one scheme.
@ -32,7 +32,7 @@ For the Simple Language, define only one scheme.
### Define a Syntax Highlighter Factory ### Define a Syntax Highlighter Factory
The factory provides a standard way for the IntelliJ Platform to instantiate the syntax highlighter for Simple Language files. The factory provides a standard way for the IntelliJ Platform to instantiate the syntax highlighter for Simple Language files.
Here, [`SimpleSyntaxHighlighterFactory`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleSyntaxHighlighterFactory.java) Here, [`SimpleSyntaxHighlighterFactory`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleSyntaxHighlighterFactory.java)
subclasses [`SyntaxHighlighterFactory`](%gh-ic%/platform/editor-ui-api/src/com/intellij/openapi/fileTypes/SyntaxHighlighterFactory.java). subclasses [`SyntaxHighlighterFactory`](%gh-ic%/platform/editor-ui-api/src/com/intellij/openapi/fileTypes/SyntaxHighlighterFactory.java).
```java ```java
@ -61,7 +61,7 @@ The colors for Simple Language Key, Separator, and Value highlighting default to
## Define a Color Settings Page ## Define a Color Settings Page
The color settings page adds the ability for users to customize color settings for the highlighting in Simple Language files. The color settings page adds the ability for users to customize color settings for the highlighting in Simple Language files.
The [`SimpleColorSettingsPage`](%gh-sdk-samples%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleColorSettingsPage.java) The [`SimpleColorSettingsPage`](%gh-sdk-samples-master%/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleColorSettingsPage.java)
implements [`ColorSettingsPage`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/options/colors/ColorSettingsPage.java). implements [`ColorSettingsPage`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/options/colors/ColorSettingsPage.java).
```java ```java

View File

@ -1,4 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# Basics of Working with the Editor # Basics of Working with the Editor
@ -13,7 +13,7 @@ This tutorial will lead you through a series of steps showing how to work with t
> For operations that require access to the PSI, please see [](psi.md). > For operations that require access to the PSI, please see [](psi.md).
The following are referenced in the tutorial: The following are referenced in the tutorial:
* The [editor_basics](%gh-sdk-samples%/editor_basics/) plugin code sample, * The [editor_basics](%gh-sdk-samples-master%/editor_basics/) plugin code sample,
* [editor-ui-api package](%gh-ic%/platform/editor-ui-api), * [editor-ui-api package](%gh-ic%/platform/editor-ui-api),
* Those not found in `editor-ui-api` package: * Those not found in `editor-ui-api` package:
* [`EditorActionManager`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionManager.java), * [`EditorActionManager`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionManager.java),

View File

@ -12,13 +12,13 @@ This tutorial describes how to access information about the caret(s) in an edito
## Editor Basics Code Sample ## Editor Basics Code Sample
In this tutorial, the [editor_basics](%gh-sdk-samples%/editor_basics) code sample is used to explore caret positions. In this tutorial, the [editor_basics](%gh-sdk-samples-master%/editor_basics) code sample is used to explore caret positions.
In particular, the **Caret Position** action added by `editor_basics` to the editor context menu is used to retrieve information about the current caret position. In particular, the **Caret Position** action added by `editor_basics` to the editor context menu is used to retrieve information about the current caret position.
A keyboard shortcut can also initiate the action. A keyboard shortcut can also initiate the action.
![Editor Basics Menu](basics.png){width="600"} ![Editor Basics Menu](basics.png){width="600"}
The source code for the Java class behind the menu action is [EditorAreaIllustration](%gh-sdk-samples%/editor_basics/src/main/java/org/intellij/sdk/editor/EditorAreaIllustration.java). The source code for the Java class behind the menu action is [EditorAreaIllustration](%gh-sdk-samples-master%/editor_basics/src/main/java/org/intellij/sdk/editor/EditorAreaIllustration.java).
The focus of discussion will be the `EditorAreaIllustration.actionPerformed()` method. The focus of discussion will be the `EditorAreaIllustration.actionPerformed()` method.
For more information about creating action classes, see the [Actions Tutorial](action_system.md), which covers the topic in depth. For more information about creating action classes, see the [Actions Tutorial](action_system.md), which covers the topic in depth.

View File

@ -7,13 +7,13 @@
The previous tutorial [Editor Coordinate Systems](coordinates_system.md) described working with caret coordinate systems in an editor window. The previous tutorial [Editor Coordinate Systems](coordinates_system.md) described working with caret coordinate systems in an editor window.
Caret position was discussed in terms of Logical Position, Visual Position, and Offset. Caret position was discussed in terms of Logical Position, Visual Position, and Offset.
This tutorial introduces the Editor Action system, which handles actions activated by keystroke events in the editor. This tutorial introduces the Editor Action system, which handles actions activated by keystroke events in the editor.
Two classes from the [editor_basics](%gh-sdk-samples%/editor_basics) code sample are used to illustrate: Two classes from the [editor_basics](%gh-sdk-samples-master%/editor_basics) code sample are used to illustrate:
* Using an IntelliJ Platform [`EditorActionHandler`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionHandler.java) to manipulate a caret. * Using an IntelliJ Platform [`EditorActionHandler`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionHandler.java) to manipulate a caret.
* Creating and registering a custom [`TypedActionHandler`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/TypedActionHandler.java) to intercept keystrokes and change the document. * Creating and registering a custom [`TypedActionHandler`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/TypedActionHandler.java) to intercept keystrokes and change the document.
## Using an IntelliJ Platform `EditorActionHandler` ## Using an IntelliJ Platform `EditorActionHandler`
In this portion of the tutorial, the [editor_basics](%gh-sdk-samples%/editor_basics) code sample is used to demonstrate cloning an existing caret. In this portion of the tutorial, the [editor_basics](%gh-sdk-samples-master%/editor_basics) code sample is used to demonstrate cloning an existing caret.
A custom action class will use `EditorActionManager` to access a specific `EditorActionHandler` for caret cloning. A custom action class will use `EditorActionManager` to access a specific `EditorActionHandler` for caret cloning.
The `editor_basics` code sample adds an **Editor Add Caret** menu item to the editor context menu: The `editor_basics` code sample adds an **Editor Add Caret** menu item to the editor context menu:
@ -21,10 +21,10 @@ The `editor_basics` code sample adds an **Editor Add Caret** menu item to the ed
### Creating the Menu Action Class ### Creating the Menu Action Class
The source code for the Java action class is [EditorHandlerIllustration](%gh-sdk-samples%/editor_basics/src/main/java/org/intellij/sdk/editor/EditorHandlerIllustration.java), a subclass of `AnAction`. The source code for the Java action class is [EditorHandlerIllustration](%gh-sdk-samples-master%/editor_basics/src/main/java/org/intellij/sdk/editor/EditorHandlerIllustration.java), a subclass of `AnAction`.
For more information about creating action classes, see the [Actions Tutorial](action_system.md), which covers the topic in depth. For more information about creating action classes, see the [Actions Tutorial](action_system.md), which covers the topic in depth.
The `EditorHandlerIllustration` action is registered in the _editor_basic_ [`plugin.xml`](%gh-sdk-samples%/editor_basics/src/main/resources/META-INF/plugin.xml) file. The `EditorHandlerIllustration` action is registered in the _editor_basic_ [`plugin.xml`](%gh-sdk-samples-master%/editor_basics/src/main/resources/META-INF/plugin.xml) file.
Note that this action class is registered to appear on the Editor context menu. Note that this action class is registered to appear on the Editor context menu.
```xml ```xml

View File

@ -1,4 +1,4 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> <!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# 1. Working with Text # 1. Working with Text
@ -10,7 +10,7 @@ Using information about the caret, replace selected text in a document with a st
The approach in this tutorial relies heavily on creating and registering actions. The approach in this tutorial relies heavily on creating and registering actions.
To review the fundamentals of creating and registering actions, refer to the [Actions Tutorial](action_system.md). To review the fundamentals of creating and registering actions, refer to the [Actions Tutorial](action_system.md).
Multiple examples are used from the [editor_basics](%gh-sdk-samples%/editor_basics) plugin code sample from the IntelliJ Platform SDK. Multiple examples are used from the [editor_basics](%gh-sdk-samples-master%/editor_basics) plugin code sample from the IntelliJ Platform SDK.
It may be helpful to open that project in an IntelliJ Platform-based IDE, build the project, run it, select some text in the editor, and invoke the **Editor Replace Text** menu item on the editor context menu. It may be helpful to open that project in an IntelliJ Platform-based IDE, build the project, run it, select some text in the editor, and invoke the **Editor Replace Text** menu item on the editor context menu.
![Editor Basics Menu](basics.png){width="600"} ![Editor Basics Menu](basics.png){width="600"}
@ -18,9 +18,9 @@ It may be helpful to open that project in an IntelliJ Platform-based IDE, build
## Creating a New Menu Action ## Creating a New Menu Action
In this example, we access the `Editor` from an action. In this example, we access the `Editor` from an action.
The source code for the Java class in this example is [EditorIllustrationAction](%gh-sdk-samples%/editor_basics/src/main/java/org/intellij/sdk/editor/EditorIllustrationAction.java). The source code for the Java class in this example is [EditorIllustrationAction](%gh-sdk-samples-master%/editor_basics/src/main/java/org/intellij/sdk/editor/EditorIllustrationAction.java).
To register the action, we must add the corresponding elements to the [`<actions>`](plugin_configuration_file.md#idea-plugin__actions) section of the plugin configuration file [plugin.xml](%gh-sdk-samples%/editor_basics/src/main/resources/META-INF/plugin.xml). To register the action, we must add the corresponding elements to the [`<actions>`](plugin_configuration_file.md#idea-plugin__actions) section of the plugin configuration file [plugin.xml](%gh-sdk-samples-master%/editor_basics/src/main/resources/META-INF/plugin.xml).
For more information, refer to the [Registering Actions](working_with_custom_actions.md#registering-a-custom-action) section of the Actions Tutorial. For more information, refer to the [Registering Actions](working_with_custom_actions.md#registering-a-custom-action) section of the Actions Tutorial.
The `EditorIllustrationAction` action is registered in the group `EditorPopupMenu` so it will be available from the context menu when focus is on the editor: The `EditorIllustrationAction` action is registered in the group `EditorPopupMenu` so it will be available from the context menu when focus is on the editor:

View File

@ -5,7 +5,7 @@
<link-summary>Tutorial on implementing custom framework types.</link-summary> <link-summary>Tutorial on implementing custom framework types.</link-summary>
The following tutorial shows how to support a custom framework type for a project and make this framework type embedded in a [project wizard](project_wizard.md) as a UI component. The following tutorial shows how to support a custom framework type for a project and make this framework type embedded in a [project wizard](project_wizard.md) as a UI component.
The examples in this tutorial rely heavily on the [framework_basics](%gh-sdk-samples%/framework_basics) code sample. The examples in this tutorial rely heavily on the [framework_basics](%gh-sdk-samples-master%/framework_basics) code sample.
> Note that this feature requires a [dependency](plugin_dependencies.md) on [the Java plugin](idea.md#java). > Note that this feature requires a [dependency](plugin_dependencies.md) on [the Java plugin](idea.md#java).
> >
@ -13,7 +13,7 @@ The examples in this tutorial rely heavily on the [framework_basics](%gh-sdk-sam
## Creating a New Framework ## Creating a New Framework
In oder to make a custom framework available and configurable for a project the [`FrameworkTypeEx`](%gh-ic%/java/idea-ui/src/com/intellij/framework/FrameworkTypeEx.java) class needs to be extended, in this example to make the [DemoFramework](%gh-sdk-samples%/framework_basics/src/main/java/org/intellij/sdk/framework/DemoFramework.java) class. In oder to make a custom framework available and configurable for a project the [`FrameworkTypeEx`](%gh-ic%/java/idea-ui/src/com/intellij/framework/FrameworkTypeEx.java) class needs to be extended, in this example to make the [DemoFramework](%gh-sdk-samples-master%/framework_basics/src/main/java/org/intellij/sdk/framework/DemoFramework.java) class.
```java ```java
final class DemoFramework extends FrameworkTypeEx { final class DemoFramework extends FrameworkTypeEx {
@ -22,7 +22,7 @@ final class DemoFramework extends FrameworkTypeEx {
## Registering Framework ## Registering Framework
The newly created framework class should be registered as an extension point by adding `com.intellij.framework.type` extension in [`plugin.xml`](%gh-sdk-samples%/framework_basics/src/main/resources/META-INF/plugin.xml) configuration file: The newly created framework class should be registered as an extension point by adding `com.intellij.framework.type` extension in [`plugin.xml`](%gh-sdk-samples-master%/framework_basics/src/main/resources/META-INF/plugin.xml) configuration file:
```xml ```xml
<extensions defaultExtensionNs="com.intellij"> <extensions defaultExtensionNs="com.intellij">

View File

@ -1,6 +1,6 @@
# Creating New Functions for Live Templates <!-- Copyright 2000-2024 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<!-- Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. --> # Creating New Functions for Live Templates
<link-summary>Adding new functions for use in Live Templates.</link-summary> <link-summary>Adding new functions for use in Live Templates.</link-summary>
@ -9,7 +9,7 @@ However, sometimes the Predefined Functions are not enough.
This tutorial illustrates how to add custom functions to an IntelliJ Platform plugin and make them available for use by Live Templates. This tutorial illustrates how to add custom functions to an IntelliJ Platform plugin and make them available for use by Live Templates.
As an example, a function is created to convert a selection to Title Case. As an example, a function is created to convert a selection to Title Case.
Refer to the SDK code sample [`live_templates`](%gh-sdk-samples%/live_templates). Refer to the SDK code sample [`live_templates`](%gh-sdk-samples-master%/live_templates).
## Implementing a New Function ## Implementing a New Function
@ -28,7 +28,7 @@ Three `TitleCaseMacro` methods are of particular interest:
## Adding a Live Template ## Adding a Live Template
Using the procedures previously discussed for [Template Creation](template_support.md#template-creation) and [Export the Live Template](template_support.md#export-the-live-template), add a Live Template to the [Markdown.xml](%gh-sdk-samples%/live_templates/src/main/resources/liveTemplates) file for the plugin. Using the procedures previously discussed for [Template Creation](template_support.md#template-creation) and [Export the Live Template](template_support.md#export-the-live-template), add a Live Template to the [Markdown.xml](%gh-sdk-samples-master%/live_templates/src/main/resources/liveTemplates) file for the plugin.
The XML representation of an example Live Template using the new `titleCase` function is listed below. The XML representation of an example Live Template using the new `titleCase` function is listed below.
There is only one variable, `TITLE`. There is only one variable, `TITLE`.

View File

@ -8,7 +8,7 @@ This tutorial illustrates how to add default Custom Live Templates to an Intelli
In addition, the tutorial discusses how to export existing Live Templates, and bundle them within a plugin. In addition, the tutorial discusses how to export existing Live Templates, and bundle them within a plugin.
Any Live Template that can be created and exported can be added to a plugin by following the Template Creation, Export, and Extension Point Registration processes. Any Live Template that can be created and exported can be added to a plugin by following the Template Creation, Export, and Extension Point Registration processes.
This tutorial uses the SDK code sample [`live_templates`](%gh-sdk-samples%/live_templates). This tutorial uses the SDK code sample [`live_templates`](%gh-sdk-samples-master%/live_templates).
## Template Creation ## Template Creation
@ -61,7 +61,7 @@ The display `description` can also provide localized variants by specifying
`key` and `resource-bundle` attributes instead (code insight is available in 2020.3 and later). `key` and `resource-bundle` attributes instead (code insight is available in 2020.3 and later).
A quick fix to extract the localized key is available since 2024.2. A quick fix to extract the localized key is available since 2024.2.
Copy this file into the [plugin's resources folder](%gh-sdk-samples%/live_templates/src/main/resources/liveTemplates). Copy this file into the [plugin's resources folder](%gh-sdk-samples-master%/live_templates/src/main/resources/liveTemplates).
## Implement `TemplateContextType` ## Implement `TemplateContextType`

View File

@ -8,7 +8,7 @@ IntelliJ Platform provides a set of standard module types.
However, an application might need a module of a type that isn't supported yet. However, an application might need a module of a type that isn't supported yet.
This tutorial shows how to register a new module type and link it to the project creation procedure and the UI. This tutorial shows how to register a new module type and link it to the project creation procedure and the UI.
The source code for the [`module`](%gh-sdk-samples%/module) and [`project_wizard`](%gh-sdk-samples%/project_wizard) code samples is used throughout this tutorial. The source code for the [`module`](%gh-sdk-samples-master%/module) and [`project_wizard`](%gh-sdk-samples-master%/project_wizard) code samples is used throughout this tutorial.
## Pre-Requirements ## Pre-Requirements

View File

@ -13,7 +13,7 @@
This step-by-step guide shows how to register and implement a simple [run configuration](run_configurations.md). This step-by-step guide shows how to register and implement a simple [run configuration](run_configurations.md).
Run configurations are used to run internal and external processes from within IntelliJ Platform based products. Run configurations are used to run internal and external processes from within IntelliJ Platform based products.
The full implementation is available in the [code samples](%gh-sdk-samples%/run_configuration). The full implementation is available in the [code samples](%gh-sdk-samples-master%/run_configuration).
## Pre-Requirements ## Pre-Requirements
@ -30,7 +30,7 @@ Implement [`ConfigurationType`](%gh-ic%/platform/execution/src/com/intellij/exec
## Register the `ConfigurationType` ## Register the `ConfigurationType`
Register implemented configuration type in `com.intellij.configurationType` extension point in the [plugin.xml](%gh-sdk-samples%/run_configuration/src/main/resources/META-INF/plugin.xml): Register implemented configuration type in `com.intellij.configurationType` extension point in the [plugin.xml](%gh-sdk-samples-master%/run_configuration/src/main/resources/META-INF/plugin.xml):
```xml ```xml
<extensions defaultExtensionNs="com.intellij"> <extensions defaultExtensionNs="com.intellij">

View File

@ -10,11 +10,11 @@ Custom Settings are displayed and function just like those native to the IDE.
## Overview of Custom Settings Implementation ## Overview of Custom Settings Implementation
Using the SDK code sample [`settings`](%gh-sdk-samples%/settings), this tutorial illustrates the steps to create custom Application-level Settings. Using the SDK code sample [`settings`](%gh-sdk-samples-master%/settings), this tutorial illustrates the steps to create custom Application-level Settings.
Many IntelliJ Platform Settings implementations use fewer classes, but the `settings` code sample factors the functionality into three classes for clarity: Many IntelliJ Platform Settings implementations use fewer classes, but the `settings` code sample factors the functionality into three classes for clarity:
* The [`AppSettingsConfigurable`](%gh-sdk-samples%/settings/src/main/java/org/intellij/sdk/settings/AppSettingsConfigurable.java) is analogous to a Controller in the MVC model - it interacts with the other two Settings classes and the IntelliJ Platform, * The [`AppSettingsConfigurable`](%gh-sdk-samples-master%/settings/src/main/java/org/intellij/sdk/settings/AppSettingsConfigurable.java) is analogous to a Controller in the MVC model - it interacts with the other two Settings classes and the IntelliJ Platform,
* The [`AppSettingsState`](%gh-sdk-samples%/settings/src/main/java/org/intellij/sdk/settings/AppSettingsState.java) is like a Model because it stores the Settings persistently, * The [`AppSettingsState`](%gh-sdk-samples-master%/settings/src/main/java/org/intellij/sdk/settings/AppSettingsState.java) is like a Model because it stores the Settings persistently,
* The [`AppSettingsComponent`](%gh-sdk-samples%/settings/src/main/java/org/intellij/sdk/settings/AppSettingsComponent.java) is similar to a View because it displays and captures edits to the values of the Settings. * The [`AppSettingsComponent`](%gh-sdk-samples-master%/settings/src/main/java/org/intellij/sdk/settings/AppSettingsComponent.java) is similar to a View because it displays and captures edits to the values of the Settings.
The structure of the implementation is the same for Project Settings, but there are minor differences in the [`Configurable` implementation](settings_guide.md#constructors) and [extension point (EP) declaration](settings_guide.md#declaring-project-settings). The structure of the implementation is the same for Project Settings, but there are minor differences in the [`Configurable` implementation](settings_guide.md#constructors) and [extension point (EP) declaration](settings_guide.md#declaring-project-settings).
@ -77,7 +77,7 @@ One static convenience method has been added - `AppSettingState.getInstance()` -
## The `AppSettingsComponent` Class ## The `AppSettingsComponent` Class
The role of the [`AppSettingsComponent`](%gh-sdk-samples%/settings/src/main/java/org/intellij/sdk/settings/AppSettingsComponent.java) is to provide a `JPanel` for the custom Settings to the IDE Settings Dialog. The role of the [`AppSettingsComponent`](%gh-sdk-samples-master%/settings/src/main/java/org/intellij/sdk/settings/AppSettingsComponent.java) is to provide a `JPanel` for the custom Settings to the IDE Settings Dialog.
The `AppSettingsComponent` has-a `JPanel`, and is responsible for its lifetime. The `AppSettingsComponent` has-a `JPanel`, and is responsible for its lifetime.
The `AppSettingsComponent` is instantiated by `AppSettingsConfigurable`. The `AppSettingsComponent` is instantiated by `AppSettingsConfigurable`.
@ -96,7 +96,7 @@ The rest of the class are simple accessors and mutators to encapsulate the UI co
## The `AppSettingsConfigurable` Class ## The `AppSettingsConfigurable` Class
The methods of [`AppSettingsConfigurable`](%gh-sdk-samples%/settings/src/main/java/org/intellij/sdk/settings/AppSettingsConfigurable.java) are called by the IntelliJ Platform, and `AppSettingsConfigurable` in turn interacts with `AppSettingsComponent` and `AppSettingState`. The methods of [`AppSettingsConfigurable`](%gh-sdk-samples-master%/settings/src/main/java/org/intellij/sdk/settings/AppSettingsConfigurable.java) are called by the IntelliJ Platform, and `AppSettingsConfigurable` in turn interacts with `AppSettingsComponent` and `AppSettingState`.
### Declaring the `AppSettingsConfigurable` ### Declaring the `AppSettingsConfigurable`

View File

@ -6,7 +6,7 @@
This tutorial is meant to illustrate how the project tree structure view appearance can be modified programmatically. This tutorial is meant to illustrate how the project tree structure view appearance can be modified programmatically.
This topic describes the [treeStructureProvider](%gh-sdk-samples%/tree_structure_provider) sample plugin. This topic describes the [treeStructureProvider](%gh-sdk-samples-master%/tree_structure_provider) sample plugin.
The steps below show how to filter out and keep visible only text files and directories in the Project View Panel. The steps below show how to filter out and keep visible only text files and directories in the Project View Panel.
@ -16,7 +16,7 @@ Other use cases include:
## Register Custom `TreeStructureProvider` ## Register Custom `TreeStructureProvider`
Add new `com.intellij.treeStructureProvider` extension to the [plugin.xml](%gh-sdk-samples%/tree_structure_provider/src/main/resources/META-INF/plugin.xml) Add new `com.intellij.treeStructureProvider` extension to the [plugin.xml](%gh-sdk-samples-master%/tree_structure_provider/src/main/resources/META-INF/plugin.xml)
```xml ```xml
<extensions defaultExtensionNs="com.intellij"> <extensions defaultExtensionNs="com.intellij">

View File

@ -86,7 +86,7 @@ For detailed instructions, please refer to the [Kotlin documentation](https://ko
Adding Kotlin source files compilation support to the Gradle-based project requires adding and configuring the [Kotlin JVM Gradle plugin](https://kotlinlang.org/docs/gradle.html#targeting-the-jvm). Adding Kotlin source files compilation support to the Gradle-based project requires adding and configuring the [Kotlin JVM Gradle plugin](https://kotlinlang.org/docs/gradle.html#targeting-the-jvm).
See the <path>build.gradle.kts</path> from [kotlin_demo](%gh-sdk-samples%/kotlin_demo) sample plugin: See the <path>build.gradle.kts</path> from [kotlin_demo](%gh-sdk-samples-master%/kotlin_demo) sample plugin:
```kotlin ```kotlin
``` ```

View File

@ -114,7 +114,7 @@ Project-level topic [`ToolWindowManagerListener`](%gh-ic%/platform/platform-impl
## Sample Plugin ## Sample Plugin
To clarify how to develop plugins that create tool windows, consider the **toolWindow** sample plugin available in the [code samples](%gh-sdk-samples%/tool_window). To clarify how to develop plugins that create tool windows, consider the **toolWindow** sample plugin available in the [code samples](%gh-sdk-samples-master%/tool_window).
See [](code_samples.md) on how to set up and run the plugin. See [](code_samples.md) on how to set up and run the plugin.

2
v.list
View File

@ -10,7 +10,7 @@
<!-- Links to master/main branches **MUST** have "-master" suffix for recheck when running inspection globally --> <!-- Links to master/main branches **MUST** have "-master" suffix for recheck when running inspection globally -->
<var name="gh-sdk-samples" value="https://github.com/JetBrains/intellij-sdk-code-samples/tree/main"/> <var name="gh-sdk-samples-master" value="https://github.com/JetBrains/intellij-sdk-code-samples/tree/main"/>
<var name="gh-ic" value="https://github.com/JetBrains/intellij-community/tree/idea/%ijPlatformBuild%"/> <var name="gh-ic" value="https://github.com/JetBrains/intellij-community/tree/idea/%ijPlatformBuild%"/>
<var name="gh-ic-master" value="https://github.com/JetBrains/intellij-community/tree/master"/> <var name="gh-ic-master" value="https://github.com/JetBrains/intellij-community/tree/master"/>