Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You will need Apache NetBeans source code. Please download or clone it from here and build it.

1. File Type Recognition

The first thing to do is for NetBeans to be able to recognize the file type. E.g. if you are adding support for the kotlin programming language you would like NetBeans editor to be able to recognize .kt source files.

...

See Adding New Language Support.

2. Custom project types

See Adding New Language Support.

3. Semantic Syntax highlighting and braces matching

See the File Type Integration Tutorial for more details on how to add File Type recognition support. A DataObject file will be created with a number of annotations.

Important Note! Make sure to create your module inside your cloned Apache NetBeans source code. Your module will need some files from nbbuild folder.

Take a look at java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/KtDataObject.java and rust/rust.sources/src/org/netbeans/modules/rust/sources/rs/RustFileDataObject.java as examples of DataObjects.

Hint! To open a source file easily, click on Window → Favorites and navigate to the source file (e.g. a .kt file if you are adding support for kotlin, or a .rs source file for Rust)

2. Syntax highlighting

Without syntax highlighting, NetBeans opens the source file as a text file. To add syntax highlighting to your source file, follow the instructions provided in LSP Client demo - (ba)sh language server tutorial.

...

If you open your source file in NetBeans, as described in the previous chapter, you should be able to see the various parts of the language (e.g. keywords) to be coloured as defined in the TextMate grammar file. Braces matching is also there. Take a look at java/kotlin.editor/src/org/netbeans/modules/kotlin/editor/KtDataObject.java as an example.

...

4. 5.

...

Code Completion and Navigation

To add support for language-specific features like code completion, navigation, etc. you need the help of a Language Protocol Server.  Again, follow the instructions provided in LSP Client demo - (ba)sh language server tutorial.

...

Open the source file again and try code completion, navigation (e.g. jump to definition, peek definition), find all references, symbol search etc.

4. Custom project types

You may want to create a new "Project Type" for your specific language. More explicitly, when you click on File → New Project, you can customize the New Project wizard dialog to create a new project for your language. For instance, "Rust" projects usually have a folder structure defined by the "cargo" tool. rust/rust.project.api module allows the user to create a new cargo project.

The NetBeans Project Type Tutorial is a good starting point.

5. Configuring the language support

NetBeans IDE provides the Options window (menu Tools Options or NetBeans Preferences on MacOS) that allows the user to customize it. You can provide any customizations for your language support in the Options window, too. E.g. you could allow the user to provide the path to the Kotlin compiler. See e.g. rust/rust.cargo module that allows the user to provide the path to cargo for Rust projects.

The NetBeans Options Window Module Tutorial explains how you could do that.

6. Refactoring

7.  Error Hints/Fixes/Suggestions

8. Debugging

---------

Other support you may need to provide:

...

6. Types and documentation on hover

7. Code formatting

8. Configuration

See Adding New Language Support.

9. Refactoring


10. Error

...

squiggles and apply suggestions from errors

...

11. Debugging

12. Snippets

13. Build tasks

...


NetBeans Specific Resources

...