Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit error when missing comma #9

Closed
dragon-archer opened this issue Jan 29, 2024 · 4 comments
Closed

Emit error when missing comma #9

dragon-archer opened this issue Jan 29, 2024 · 4 comments
Assignees
Labels
duplicate This issue or pull request already exists enhancement New feature or request

Comments

@dragon-archer
Copy link

image

Currently, this extension will silently accept items without comma

image

while the builtinjson mode will show a prominent error

How about implementing this by using a simple sementic highlight or some textmate rules like:

{
    "match": "\\}\\s*\\{",
    "name": "invalid.illegal.xxx"
}

Or perhaps you'd like to wait for the official VS Code Team to support using custom textmate rules together with the builtin mode together (As I've seen in your other issues)

@RedCMD RedCMD self-assigned this Jan 29, 2024
@RedCMD RedCMD added duplicate This issue or pull request already exists enhancement New feature or request labels Jan 29, 2024
@RedCMD
Copy link
Owner

RedCMD commented Jan 29, 2024

yeah, same as in #3
I'm waiting on VSCode to allow custom extensions to enable the builtin json extension
microsoft/vscode#198025
microsoft/vscode#198583

if you want
there is code already for displaying Treesitter parse errors
you'll just need to add the import and enable the Diagnostics
it wont show what type of error, other than it being an error
(reports on false postive json errors are welcomed)

const TreeSitter_1 = require("./TreeSitter");
const tokenColorCustomizations_1 = require("./tokenColorCustomizations");

const DiagnosticCollection_1 = require("./DiagnosticCollection");
image

// initDiagnostics(context);
(0, DiagnosticCollection_1.initDiagnostics)(context);
image


and prob disable the regex errors (many false postives)

I could look into making it a config option to enable/disable error reporting
tho I'll prob have it disabled by default for now

@RedCMD
Copy link
Owner

RedCMD commented Jan 29, 2024

or the other way is manually enabling the builtin json-language-features extension

\extensions\json-language-features\client\dist\node\jsonClientMain.js
just involves adding the languageId to the DocumentSelector list "jsonc","json-textmate"
image

and "activationEvents"
\extensions\json-language-features\package.js
"onLanguage:json-textmate"
image

you would also get schema support at the same time

@dragon-archer
Copy link
Author

Thanks, I turned on the builtin feature, though I think it might be better with a config option in this extension

@RedCMD
Copy link
Owner

RedCMD commented Mar 2, 2024

Now available in the full release 2.3.0 for VSCode 1.87.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants