Hi,

If you want to create a new plugin/module that would add a new language
support using LSP, these are the things to consider I believe:
-create a new NB module
-create a new "File Type" (i.e. something that will recognize extensions
and provide icon and actions for files with the extension). This will also
include a "DataObject". There is a wizard for it, and a tutorial:
https://platform.netbeans.org/tutorials/nbm-filetype.html
-if syntax highlighting should be done using a TextMate grammar, add a
dependency on "TextMate Lexer" module, and inside your DataObject do
GrammarRegistration, see e.g. here:
https://github.com/apache/netbeans/blob/2b9979d61e58b57083994617eb19618f7e66f617/webcommon/typescript.editor/src/org/netbeans/modules/typescript/editor/TypeScriptDataObjectDataObject.java#L107
-to start a LSP Server, add a dependency on "LSP Client" module, and
implement LanguageServerProvider, see e.g. here:
https://github.com/apache/netbeans/blob/master/webcommon/typescript.editor/src/org/netbeans/modules/typescript/editor/TypeScriptLSP.java
this may be very simple, like basically:
Process p = ... //start your server here
return LanguageServerDescription.create(p.getInputStream(), p.
getOutputStream(), p);

Or more complex, depending on how much set-up is needed for the server.

-the real tricky part is if a new project type is needed. If the files
written in the new language appear in some existing project (like
TypeScript may appear in the "HTML5 Application" project), then things are
simple.

Note there is also Tools/Options/Editor/Language Servers, and it is
possible to register a server there manually, for your current IDE.

Jan


On Thu, Dec 3, 2020 at 6:03 AM Rahul Khandelwal <[email protected]>
wrote:

> Hi All,
>
> I am trying to add a new language support for netbeans using LSP.
> Are there any resources for that?
>
> Regards,
> Rahul Khandelwal
>

Reply via email to