diff --git a/topics/tutorials/build_system/gradle_prerequisites.md b/topics/tutorials/build_system/gradle_prerequisites.md index b100660c1..f446cfc0e 100644 --- a/topics/tutorials/build_system/gradle_prerequisites.md +++ b/topics/tutorials/build_system/gradle_prerequisites.md @@ -180,12 +180,10 @@ See the [Creating Actions](working_with_custom_actions.md) tutorial for step-by- ### Executing the Plugin Open the Gradle tool window and search for the `runIde` task: -* If it’s not in the list, hit the [Refresh](https://www.jetbrains.com/help/idea/jetgradle-tool-window.html#1eeec055) button at the top of the Gradle window. +* If it’s not in the list, hit the [Refresh](https://www.jetbrains.com/help/idea/jetgradle-tool-window.html#1eeec055) button at the top of the Gradle tool window. * Or [Create a new Gradle Run Configuration](https://www.jetbrains.com/help/idea/create-run-debug-configuration-gradle-tasks.html). ![Gradle Tool Window](gradle_tasks_in_tool_window.png){width="398"} Double-click on the _runIde_ task to execute it. See the IntelliJ IDEA help for more information about [Working with Gradle tasks](https://www.jetbrains.com/help/idea/gradle.html#96bba6c3). - -Finally, when `my_gradle_plugin` launches in the IDE development instance, there should be a new menu under the **Tools** menu. diff --git a/topics/tutorials/custom_language_support/annotator.md b/topics/tutorials/custom_language_support/annotator.md index 7aaf08d53..f2dc42577 100644 --- a/topics/tutorials/custom_language_support/annotator.md +++ b/topics/tutorials/custom_language_support/annotator.md @@ -1,6 +1,6 @@ [//]: # (title: 7. Annotator) - + An `Annotator` helps highlight and annotate any code based on specific rules. This section adds annotation functionality to support the Simple Language in the context of Java code. @@ -60,6 +60,9 @@ Using the `com.intellij.annotator` extension point in the plugin configuration f ``` ## Run the Project + +Run the plugin by using the Gradle [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). + As a test, define the following Java file containing a Simple Language `prefix:value` pair: ```java diff --git a/topics/tutorials/custom_language_support/code_style_settings.md b/topics/tutorials/custom_language_support/code_style_settings.md index 38edad1a6..6d9c7106b 100644 --- a/topics/tutorials/custom_language_support/code_style_settings.md +++ b/topics/tutorials/custom_language_support/code_style_settings.md @@ -1,6 +1,6 @@ [//]: # (title: 16. Code Style Settings) - + Code style settings enable defining formatting options. A code style settings provider creates an instance of the settings and also creates an options page in settings/preferences. @@ -50,6 +50,8 @@ The `SimpleLanguageCodeStyleSettingsProvider` implementation is registered with ``` ## Run the Project +Run the plugin by using the Gradle [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). + In the IDE Development Instance, open the Simple Language code formatting page: **Preferences/Settings \| Editor \| Code Style \| Simple**. ![Code Style Settings](code_style_settings.png) \ No newline at end of file diff --git a/topics/tutorials/custom_language_support/commenter.md b/topics/tutorials/custom_language_support/commenter.md index ae61c51a6..82bd3495d 100644 --- a/topics/tutorials/custom_language_support/commenter.md +++ b/topics/tutorials/custom_language_support/commenter.md @@ -1,6 +1,6 @@ [//]: # (title: 17. Commenter) - + A commenter enables the user to comment-out a line of code at the cursor or selected code automatically. The [`Commenter`](upsource:///platform/core-api/src/com/intellij/lang/Commenter.java) defines support for **Code \| Comment with Line Comment** and **Code \| Comment with Block Comment** actions. @@ -22,6 +22,8 @@ The `SimpleCommenter` implementation is registered in the plugin configuration f ``` ## Run the Project +Run the plugin by using the Gradle [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). + Open the example Simple Language [properties file ](lexer_and_parser_definition.md#run-the-project) in the IDE Development Instance. Place the cursor at the `website` line. Select **Code \| Comment with Line Comment**. diff --git a/topics/tutorials/custom_language_support/completion_contributor.md b/topics/tutorials/custom_language_support/completion_contributor.md index e13540df2..aa949fe29 100644 --- a/topics/tutorials/custom_language_support/completion_contributor.md +++ b/topics/tutorials/custom_language_support/completion_contributor.md @@ -26,7 +26,9 @@ The `SimpleCompletionContributor` implementation is registered in the plugin con ``` ## Run the Project -Run the `simple_language_plugin` in a Development Instance and open the [`test.simple`](lexer_and_parser_definition.md#run-the-project) file. +Run the plugin by using the Gradle [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). + +Open the [`test.simple`](lexer_and_parser_definition.md#run-the-project) file. Erase the property "English" and invoke [Basic Code Completion](https://www.jetbrains.com/help/idea/auto-completing-code.html#invoke-basic-completion). The choice "Hello" is shown: diff --git a/topics/tutorials/custom_language_support/find_usages_provider.md b/topics/tutorials/custom_language_support/find_usages_provider.md index 96bd5d685..e19221de8 100644 --- a/topics/tutorials/custom_language_support/find_usages_provider.md +++ b/topics/tutorials/custom_language_support/find_usages_provider.md @@ -1,6 +1,6 @@ [//]: # (title: 11. Find Usages Provider) - + A `FindUsagesProvider` uses a word scanner to build an index of words in every file. A scanner breaks the text into words and defines the context for each word. @@ -27,7 +27,8 @@ The `SimpleFindUsagesProvider` implementation is registered with the IntelliJ Pl ``` ## Run the Project -Rebuild the project, and run `simple_language_plugin` in a Development Instance. +Run the plugin by using the Gradle [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). + The IDE now supports [Find Usages](https://www.jetbrains.com/help/idea/find-highlight-usages.html) for any property with a reference: ![Find Usages](find_usages.png) \ No newline at end of file diff --git a/topics/tutorials/custom_language_support/folding_builder.md b/topics/tutorials/custom_language_support/folding_builder.md index f03519b86..81ba673ce 100644 --- a/topics/tutorials/custom_language_support/folding_builder.md +++ b/topics/tutorials/custom_language_support/folding_builder.md @@ -1,6 +1,6 @@ [//]: # (title: 12. Folding Builder) - + A folding builder identifies the folding regions in the code. In this step of the tutorial, the folding builder is used to identify folding regions and replace the regions with specific text. @@ -37,8 +37,9 @@ The `SimpleFoldingBuilder` implementation is registered with the IntelliJ Platfo ``` ## Run the Project -Rebuild the project, and run `simple_language_plugin` in a Development Instance. -Now when a Java file is opened in the Editor, it shows the property's value instead of the key. +Run the plugin by using the Gradle [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). + +Now when a Java file is opened in the editor, it shows the property's value instead of the key. This is because `SimpleFoldingBuilder.isCollapsedByDefault()` always returns `true`. Try using **Code \| Folding \| Expand All** to show the key rather than the value. diff --git a/topics/tutorials/custom_language_support/formatter.md b/topics/tutorials/custom_language_support/formatter.md index c5a0e14f2..03e91bd10 100644 --- a/topics/tutorials/custom_language_support/formatter.md +++ b/topics/tutorials/custom_language_support/formatter.md @@ -1,6 +1,6 @@ [//]: # (title: 15. Formatter) - + The IntelliJ Platform includes a powerful framework for implementing formatting for custom languages. A formatter enables reformatting code automatically based on code style settings. @@ -39,6 +39,9 @@ The `SimpleFormattingModelBuilder` implementation is registered with the Intelli ``` ## Run the Project +Run the plugin by using the Gradle [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). + +Open the example Simple Language [properties file ](lexer_and_parser_definition.md#run-the-project) in the IDE Development Instance. Add some extra spaces around the `=` separator between `language` and `English`. Reformat the code by selecting **Code \| Show Reformat File Dialog** and choose **Run**. diff --git a/topics/tutorials/custom_language_support/go_to_symbol_contributor.md b/topics/tutorials/custom_language_support/go_to_symbol_contributor.md index c08a444cc..837f0f3b8 100644 --- a/topics/tutorials/custom_language_support/go_to_symbol_contributor.md +++ b/topics/tutorials/custom_language_support/go_to_symbol_contributor.md @@ -1,6 +1,6 @@ [//]: # (title: 13. Go To Symbol Contributor) - + A _Go to Symbol Contributor_ helps the user to navigate to any PSI element by its name. @@ -66,7 +66,8 @@ The `SimpleChooseByNameContributor` implementation is registered with the Intell ``` ## Run the Project -Rebuild the project, and run `simple_language_plugin` in a Development Instance. +Run the plugin by using the Gradle [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). + The IDE now supports navigating to a property definition by name pattern via **Navigate \| Symbol** action. ![Go To Symbol](go_to_symbol.png){width="800"} \ No newline at end of file diff --git a/topics/tutorials/custom_language_support/language_and_filetype.md b/topics/tutorials/custom_language_support/language_and_filetype.md index 9df8f294f..ec42a2e4a 100644 --- a/topics/tutorials/custom_language_support/language_and_filetype.md +++ b/topics/tutorials/custom_language_support/language_and_filetype.md @@ -1,6 +1,6 @@ [//]: # (title: 2. Language and File Type) - + The IntelliJ Platform determines file type by examining the name of a file. Each language has [Language](upsource:///platform/core-api/src/com/intellij/lang/Language.java) and [LanguageFileType](upsource:///platform/core-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java) objects defining the language. @@ -67,7 +67,7 @@ The `SimpleFileTypeFactory` is registered using the `com.intellij.openapi.fileTy ## Run the Project -Run your project by using the [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin) in Gradle-based projects or [using the Plugin Run/Debug configuration](running_and_debugging_a_plugin.md) in DevKit-based projects. +Run the plugin by using the Gradle [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). Create an empty file with the extension `*.simple`, and IntelliJ IDEA automatically associates it with our language. Note the appearance of the Simple Language file icon next to the `test.simple` file in the **Project Tool Window**, and the editor tab for the file. diff --git a/topics/tutorials/custom_language_support/lexer_and_parser_definition.md b/topics/tutorials/custom_language_support/lexer_and_parser_definition.md index 40920cc3b..e4ee99868 100644 --- a/topics/tutorials/custom_language_support/lexer_and_parser_definition.md +++ b/topics/tutorials/custom_language_support/lexer_and_parser_definition.md @@ -1,6 +1,6 @@ [//]: # (title: 4. Lexer and Parser Definition) - + The lexical analyzer defines how the contents of a file are broken into tokens, which is the basis for supporting custom language features. The easiest way to create a lexer is to use [JFlex](https://jflex.de/). @@ -79,7 +79,10 @@ For example, see `simple_language_plugin/src/main/resources/META-INF/plugin.xml` ``` ## Run the Project -With the `simple_language_plugin` loaded in a Development Instance, create a `test.simple` properties file with the following content: + +Run the plugin by using the Gradle [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). + +Create a `test.simple` properties file with the following content: ```text # You are reading the ".properties" entry. diff --git a/topics/tutorials/custom_language_support/line_marker_provider.md b/topics/tutorials/custom_language_support/line_marker_provider.md index 4b97a772e..a9cc67d7a 100644 --- a/topics/tutorials/custom_language_support/line_marker_provider.md +++ b/topics/tutorials/custom_language_support/line_marker_provider.md @@ -76,7 +76,9 @@ The `SimpleLineMarkerProvider` implementation is registered with the IntelliJ Pl ``` ## Run the Project -Run the `simple_language_plugin` in a Development Instance and open the [Test file](annotator.md#run-the-project). +Run the plugin by using the Gradle [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). + +Open the Java [Test file](annotator.md#run-the-project). Now the icon appears next to line 3 on the gutter. A user can click on the icon to navigate to the property definition. diff --git a/topics/tutorials/custom_language_support/quick_fix.md b/topics/tutorials/custom_language_support/quick_fix.md index dbf1ddeeb..090ae8389 100644 --- a/topics/tutorials/custom_language_support/quick_fix.md +++ b/topics/tutorials/custom_language_support/quick_fix.md @@ -1,6 +1,6 @@ [//]: # (title: 18. Quick Fix) - + A quick fix for a custom language supports the IntelliJ Platform-based IDE feature [Intention Actions](https://www.jetbrains.com/help/idea/intention-actions.html#apply-intention-actions). For the Simple Language, this tutorial adds a quick fix that helps to define an unresolved property from its usage. @@ -34,7 +34,8 @@ This method call registers the `SimpleCreatePropertyQuickFix` as the Intention A {src="simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleAnnotator.java"} ## Run the Project -Open the test [Java file](annotator.md#run-the-project) in an IDE Development Instance running the `simple_language_plugin`. +Run the project by using the Gradle [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). +Open the test [Java file](annotator.md#run-the-project). To test `SimpleCreatePropertyQuickFix`, change `simple:website` to `simple:website.url`. The key `website.url` is highlighted by `SimpleAnnotator` as an invalid key, as shown below. diff --git a/topics/tutorials/custom_language_support/reference_contributor.md b/topics/tutorials/custom_language_support/reference_contributor.md index 3898ca09a..ac72353e0 100644 --- a/topics/tutorials/custom_language_support/reference_contributor.md +++ b/topics/tutorials/custom_language_support/reference_contributor.md @@ -1,6 +1,6 @@ [//]: # (title: 10. Reference Contributor) - + The references functionality is one of the most important parts in the implementation of custom language support. Resolving references means the ability to go from the usage of an element to its declaration, completion, rename refactoring, find usages, etc. @@ -128,7 +128,8 @@ The `SimpleReferenceContributor` implementation is registered with the IntelliJ ``` ## Run the Project with the Reference Contributor -Rebuild the project, and run `simple_language_plugin` in a Development Instance. +Run the project by using the Gradle [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). + The IDE now resolves the property and provides [completion](https://www.jetbrains.com/help/idea/auto-completing-code.html#basic_completion) suggestions: ![Reference Contributor](reference_contributor.png){width="800"} @@ -157,7 +158,8 @@ The `SimpleRefactoringSupportProvider` implementation is registered with the Int ``` ## Run the Project -Rebuild the project, and run `simple_language_plugin` in a Development Instance. +Run the project by using the Gradle [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). + The IDE now supports [refactoring](https://www.jetbrains.com/help/idea/rename-refactorings.html) suggestions: ![In Place Rename](in_place_rename.png){width="800"} \ No newline at end of file diff --git a/topics/tutorials/custom_language_support/structure_view_factory.md b/topics/tutorials/custom_language_support/structure_view_factory.md index 5288dbdc3..15de932d6 100644 --- a/topics/tutorials/custom_language_support/structure_view_factory.md +++ b/topics/tutorials/custom_language_support/structure_view_factory.md @@ -1,6 +1,6 @@ [//]: # (title: 14. Structure View Factory) - + The structure view can be customized for a specific file type. Creating a structure view factory allows showing the structure of any file in a _Structure_ Tool Window for easy navigation between items in the current editor. @@ -44,7 +44,8 @@ The `SimpleStructureViewFactory` implementation is registered with the IntelliJ ``` ## Run the Project -Rebuild the project, and run `simple_language_plugin` in a Development Instance. +Run the project by using the Gradle [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). + Open the `test.simple` file and choose **View \| Tool Windows \| Structure**. The IDE now supports a structure view of the Simple Language: diff --git a/topics/tutorials/custom_language_support/syntax_highlighter_and_color_settings_page.md b/topics/tutorials/custom_language_support/syntax_highlighter_and_color_settings_page.md index 7180e064c..7c1a68468 100644 --- a/topics/tutorials/custom_language_support/syntax_highlighter_and_color_settings_page.md +++ b/topics/tutorials/custom_language_support/syntax_highlighter_and_color_settings_page.md @@ -1,6 +1,6 @@ [//]: # (title: 5. Syntax Highlighter and Color Settings Page) - + The first level of syntax highlighting is based on the lexer output, and is provided by `SyntaxHighlighter`. A plugin can also define color settings based on `ColorSettingPage` so the user can configure highlight colors. @@ -59,6 +59,8 @@ Register the Simple Language color settings page with the IntelliJ Platform in t ``` ### Run the Project +Run the project by using the Gradle [runIde task](gradle_prerequisites.md#running-a-simple-gradle-based-intellij-platform-plugin). + In the IDE Development Instance, open the Simple Language highlight settings page: **Preferences/Settings \| Editor \| Color Scheme \| Simple**. Each color initially inherits from a _Language Defaults_ value.