Repository navigation
Conversation
…into language-configuration-support
…into language-configuration-support
jtulach
left a comment
There was a problem hiding this comment.
- reusing VSCode configuration files is certainly good idea
- few comments/brainstorming ideas inline
| javac.release=17 | ||
| javac.compilerargs=-Xlint -Xlint:-serial | ||
| javadoc.arch=${basedir}/arch.xml | ||
| javadoc.apichanges=${basedir}/apichanges.xml |
There was a problem hiding this comment.
I am always glad, when a module with an API offers apichanges.xml and they are actually used. It helps to run ant javadoc and read thru the result.
| editor.lib,\ | ||
| editor,\ | ||
| lib.uihandler,\ | ||
| lsp.client,\ |
There was a problem hiding this comment.
I cannot find lsp.client at https://bits.netbeans.org/dev/javadoc/ right now. I assume this change is going to fix it.
There was a problem hiding this comment.
That's the intent of the change.
| * | ||
| * <p>Each method is a factory suitable for use as a layer | ||
| * {@code instanceCreate} target and should be registered under the | ||
| * {@code Editors/<mime-type>}/...} folder or an appropriate sub-folder. |
There was a problem hiding this comment.
The wording here, gives me some idea, but explicit examples to copy would be more helpful. Maybe I find them near each individual method?
| * <p>Requires the {@code mimeType} attribute (String) on the registration | ||
| * file. If absent, {@code text/plain} is used as a fallback. | ||
| * | ||
| * <p>Sample registration: |
| </run-dependency> | ||
| </dependency> | ||
| <dependency> | ||
| <code-name-base>org.netbeans.libs.jackson</code-name-base> |
There was a problem hiding this comment.
I can already see:
ide/c.google.gsonlibs.json_simple
I assume both the existing libraries could parse the JSON as well. What's your motivation to add Jackson?
There was a problem hiding this comment.
So, unfortunately, the real-world language configurations (at least the C/C++ one) contain things like comments:
https://github.com/microsoft/vscode/blob/1306698e328e5e531f5e632301d30020aa994eff/extensions/cpp/language-configuration.json#L110
or trailing commas in object definitions:
https://github.com/microsoft/vscode/blob/1306698e328e5e531f5e632301d30020aa994eff/extensions/cpp/language-configuration.json#L106
Given the goal here is to be able to use the unmodified language configuration files, we need a parser that can tolerate both of these, and I believe Gson cannot be configured to tolerate the trailing commas, and the simple json does not tolerate the comments (although I admit I didn't know about the simple json). Jackson can be configured to tolerate both of these misbehaviors.
There was a problem hiding this comment.
I can see the module was already in the enterprise cluster:
nbbuild/netbeans/LICENSE:enterprise/modules/ext/jackson/jackson-annotations-2.17.2.jar Apache-2.0
nbbuild/netbeans/LICENSE:enterprise/modules/ext/jackson/jackson-core-2.17.2.jar Apache-2.0
nbbuild/netbeans/LICENSE:enterprise/modules/ext/jackson/jackson-databind-2.17.2.jar Apache-2.0
nbbuild/netbeans/LICENSE:enterprise/modules/ext/jackson/jackson-dataformat-cbor-2.17.2.jar Apache-2.0
nbbuild/netbeans/LICENSE:enterprise/modules/ext/jackson/jackson-dataformat-yaml-2.17.2.jar Apache-2.0
nbbuild/netbeans/LICENSE:enterprise/modules/ext/jackson/jackson-datatype-jsr310-2.17.2.jar Apache-2.0
nbbuild/netbeans/LICENSE:enterprise/modules/ext/jackson/jackson-module-jaxb-annotations-2.17.2.jar Apache-2.0
moving it to ide causes no harm...
| ) | ||
| }) | ||
| @GrammarRegistration(grammar="resources/c.tmLanguage.json", mimeType=MIMETypes.C) | ||
| @LanguageConfigurationRegistration(languageConfiguration="resources/language-configuration.json", mimeType=MIMETypes.C) |
| <fileset> | ||
| <file>src/org/netbeans/modules/cpplite/editor/file/resources/language-configuration.json</file> | ||
| <license ref="MIT-vscode" /> | ||
| <comment type="COMMENT_UNSUPPORTED">Source: https://github.com/microsoft/vscode/blob/main/extensions/cpp/language-configuration.json</comment> |
There was a problem hiding this comment.
- Do we have such a file also for Kotlin?
- e.g. could it accompany or replace
There was a problem hiding this comment.
- What's the relation between TextMate grammar and this language configuration?
- Couldn't both these files be consumed by
@GrammarRegistration? - e.g. add an optional
languageConfigurationattribute to@GrammarRegistration?
There was a problem hiding this comment.
In theory, the language configuration and grammars are independent (after all, they are two independent files). I admit that in practice, it is hard to image a language configuration for a language with a non-Textmate lexer lexer, so, in practice, these are likely to be used together.
I am, however, not convinced that putting "language configuration" into "GrammarRegistration" is appropriate: the language configuration is not really a grammar, and it is certainly not a place where I would look for the registration of the language configuration.
| * | ||
| * @return language configuration | ||
| */ | ||
| public String languageConfiguration(); |
There was a problem hiding this comment.
- Wouldn't merging this attribute into @GrammarRegistration be easier to use?
…eFeatures.java Co-authored-by: Jaroslav Tulach <jst@seznam.cz>
… into language-configuration-support
VS Code has various configuration files; one of the is
language-configuration.json(see https://code.visualstudio.com/api/language-extensions/language-configuration-guide; e.g.: https://github.com/microsoft/vscode/blob/main/extensions/cpp/language-configuration.json). This allows to configure the Toggle comment action, brace matching, some aspects of typing completion, indentation, etc.The idea in this PR is to start with a support for this configuration. Currently, toggle comment, brace matching and typing completion are (somewhat) supported.
The file can either be specified using API (demonstrated for C/C++), or manually in
Tools/Options/Editor/Language Servers.Note javadoc is partially written by qwen3.8, see: 1f05b50
^Add meaningful description above
Click to collapse/expand PR instructions
By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -
LLMs, Commit messages and PR description:
git log) that all commits have a valid name and email address for you in the Author field.Assisted-by: MODEL_NAME MODEL_VERSIONline appended to the commit message.Assisted-byline from above)If you're a first time contributor, see the Contributing guidelines for more information.
If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.
PR approval and merge checklist:
If this PR targets the delivery branch: don't merge. (full wiki article)