Add reference for a duplicate "annotator" section to another chapter

This commit is contained in:
ice1000 2018-03-20 11:11:15 +08:00
commit e53ab25a45
5 changed files with 44 additions and 8 deletions

View File

@ -126,7 +126,7 @@
* QuickDoc
* [Intentions](tutorials/code_intentions.md)
* Analysing
* Annotator
* [Annotator](tutorials/annotator.md)
* [Inspections](tutorials/code_inspections.md)
* Profiles
* Scopes
@ -198,7 +198,6 @@
* [9. Commenter Test](tutorials/writing_tests_for_plugins/commenter_test.md)
* [10. Reference Test](tutorials/writing_tests_for_plugins/reference_test.md)
* Injected Languages
* Project Model
* Build System
* Compiler
* Debugger

View File

@ -38,11 +38,11 @@ Sdk projectSdk = ProjectRootManager.getInstance(project).getProjectSdk();
ProjectRootManager.getInstance(project).setProjectSdkName(String name);
```
See the following [code sample](https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/project_model/src/com/intellij/tutorials/project/model/ProjectSdkAction.java) to get more familiar with SDK manipulation tool set.
See the following [code sample](../../../code_samples/project_model/src/com/intellij/tutorials/project/model/ProjectSdkAction.java) to get more familiar with SDK manipulation tool set.
## Working with your own SDK
To create your own SDK, You need to create a class extends [`SdkType`](https://upsource.jetbrains.com/idea-ce/file/idea-ce-974a6ed084613aa5b0e345fbeb50de59720ab283/platform/lang-api/src/com/intellij/openapi/projectRoots/SdkType.java), leave `saveAdditionalData` blank, and register it in the `com.intellij.sdkType` extension point.
To create your own SDK, You need to create a class extends [SdkType](upsource:///platform/lang-api/src/com/intellij/openapi/projectRoots/SdkType.java), leave `saveAdditionalData` blank, and register it in the `com.intellij.sdkType` extension point.
To make your SDK settings persistant, you should override `setupSdkPaths` and save your settings by `modificator.commitChanges()`:
@ -56,8 +56,8 @@ public boolean setupSdkPaths(@NotNull Sdk sdk, @NotNull SdkModel sdkModel) {
}
```
To let user select an SDK, see [ProjectJdksEditor](https://upsource.jetbrains.com/idea-ce/file/idea-ce-8c9022ae739b82b2ee8f3355da98b9bbce2cb915/java/idea-ui/src/com/intellij/openapi/projectRoots/ui/ProjectJdksEditor.java).
To let user select an SDK, see [ProjectJdksEditor](upsource:///java/idea-ui/src/com/intellij/openapi/projectRoots/ui/ProjectJdksEditor.java).
However, it is not recommended to use "SDK" in non-IDEA IDEs. "SDK" is IntelliJ-specific and doesn't work in PyCharm, RubyMine, etc.
The most recommended way of managing your "SDK" settings is to create a [`CustomStepProjectGenerator`](https://upsource.jetbrains.com/idea-ce/file/idea-ce-8c9022ae739b82b2ee8f3355da98b9bbce2cb915/platform/lang-impl/src/com/intellij/ide/util/projectWizard/CustomStepProjectGenerator.java)
However, it is not recommended to use "SDK" in non-IDEA IDEs. "SDK" is IntelliJ-specific (as well as `ProjectJdksEditor` mentioned above) and doesn't work in PyCharm, RubyMine, etc.
The most recommended way of managing your "SDK" settings is to create a [`CustomStepProjectGenerator`](upsource:///platform/lang-impl/src/com/intellij/ide/util/projectWizard/CustomStepProjectGenerator.java)
implementation and save settings in a [`PersistentStateComponent`](http://www.jetbrains.org/intellij/sdk/docs/basics/persisting_state_of_components.html).

6
tutorials/annotator.md Normal file
View File

@ -0,0 +1,6 @@
---
title: Annotator
---
Syntax highlight on a complete AST is based on [`Annotator`](upsource:///platform/analysis-api/src/com/intellij/lang/annotation/Annotator.java),
described [here](custom_language_support/annotator.md).

View File

@ -64,7 +64,36 @@ repositories {
}
```
Please note that you should **not** include `kotlin-runtime` and `kotlin-stdlib` jars with your plugin because Kotlin guarantees backward- and forward- binary compatibility.
Please note that you should **not** include `kotlin-runtime` and `kotlin-stdlib` jars with your plugin because Kotlin guarantees backward- and forward- binary compatibility.
### 3.1. Use Kotlin to write gradle script
After gradle 4.4, gradle starts supporting `build.gradle.kts`, an alternative to `build.gradle` written in Kotlin.
It's not yet very well-documented but there're many good resources for learning how to write build scripts for an IntelliJ plugin with Kotlin script, like [intellij-rust](https://github.com/intellij-rust/intellij-rust/blob/master/build.gradle.kts), [julia-intellij](https://github.com/ice1000/julia-intellij/blob/master/build.gradle.kts), [covscript-intellij](https://github.com/covscript/covscript-intellij/blob/master/build.gradle.kts) or [zig-intellij](https://github.com/ice1000/zig-intellij/blob/master/build.gradle.kts).
`build.gradle.kts` basically look like:
```kotlin
group = "com.your.company.name"
version = "0.1-SNAPSHOT"
buildscript {
repositories { mavenCentral() }
dependencies { classpath(kotlin("gradle-plugin", "1.2.30")) }
}
plugins {
id("org.jetbrains.intellij") version "0.2.18"
kotlin("jvm") version "1.2.30"
}
intellij {
updateSinceUntilBuild = false
instrumentCode = true
version = "2017.3"
}
```
## 4. UI in Kotlin

View File

@ -11,6 +11,8 @@ Create an empty plugin project,
see
[Creating a Plugin Project](/basics/getting_started/creating_plugin_project.md).
**Attention: "module" is IntelliJ-specific.**
## 1. Register a New Module Type
Add a new *moduleType* extension in the