Versions Compared

Key

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

...

  • File type recognition (so that NetBeans knows they belong to the new language)
  • Project type, if needed, so that the files can be built, run and debugged
  • Add editing features, including:
    • Sematic syntax highlighting
    • Formatting
    • Braces matching, automatic closing of braces
    • Error Hints/Fixes/Suggestions
    • Code completion
    • Code templates
  • Refactoring (e.g. renaming, find usages, go to, etc.) 
  • Debugging

...

Use the New File → Module Development → File Typewizard. A MIME type must be specified. This MIME type will be the key under which other services will be looked up.

See the File Type Integration Tutorial for more details on how to add File Type recognition support.

Custom project types

You may want to create a new "Project Type" for your specific language. For instance, "Rust" projects usually have a folder structure defined by the "cargo" tool.

The "NetBeans Project Type Tutorial" available at https://netbeans.apache.org/tutorials/nbm-projecttype.html is probably a good starting point.

Adding editor features

You can also add language-specific features (folding, syntax highlighting, formatting, etc.) to the NetBeans editor to make it easier for users to program in your language.

You can use either

Adding Syntax Highlighting

Syntax highlighting can be implemented either by writing a lexer module for NetBeans, or by re-using TextMate grammars.

Please see the use cases and an example grammar registration for the latter.

Formatting


Adding Code Completion and Other Editor Features

These can be done either by:

  • writing them against NetBeans APIs

...

...

  • .

Resources

  1. Cardona J.R. (2018), "Quick Start: Creating Language Tools In NetBeans IDE", DZone.
  2. Clinton J.L. (2021), Build Your Own Programming Language, Packt.
  3. Lahoda J. (2019), "LSP Client demo - (ba)sh language server", ASF.
  4. Nadeeshaan G. & Nipuna M. (2022), Language Server Protocol and Implementation: Supporting Language-Smart Editing and Programming Tools, APress.

  5. Parr T. (2010), Language Implementation Patterns, The Pragmatic Programmer.
  6. Stalla A. (2021a), "Converting from JavaCC to ANTLR", Strumenta.
  7. Stalla A. (2021b), "Go to Definition in the Language Server Protocol", Strumenta.
  8. Singh V., Basics of Compiler Design, Anniversary Edition.
  9. Tomassetti G., "The ANTLR Mega Tutorial", Strumenta.
  10. Watt D.A. & Brown D. F. (2000), Programming Language Processors in Java, Prentice Hall.

...