GithubHelp home page GithubHelp logo

evgeniypeshkov / syntax-highlighter Goto Github PK

View Code? Open in Web Editor NEW
206.0 9.0 44.0 1000 KB

Syntax Highlighter extension for Visual Studio Code (VSCode). Based on Tree-sitter.

Home Page: https://marketplace.visualstudio.com/items?itemName=evgeniypeshkov.syntax-highlighter

License: MIT License

TypeScript 88.40% JavaScript 11.60%
syntax-highlighter syntax-highlighting vscode vscode-extension tree-sitter syntax syntax-tree c cpp cxx

syntax-highlighter's People

Contributors

bbatliner avatar evgeniypeshkov avatar happyfacade avatar sumartoyo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

syntax-highlighter's Issues

Classify tokens according to semantic-highlighting proposal

https://github.com/microsoft/vscode-languageserver-node/blob/324d1039fef2b9622a9784c5cc49d9f6dfc11b65/protocol/src/protocol.sematicTokens.proposed.ts

export enum SemanticTokenTypes {
	comment = 'comment',
	keyword = 'keyword',
	string = 'string',
	number = 'number',
	regexp = 'regexp',
	operator = 'operator',
	namespace = 'namespace',
	type = 'type',
	struct = 'struct',
	class = 'class',
	interface = 'interface',
	enum = 'enum',
	typeParameter = 'typeParameter',
	function = 'function',
	member = 'member',
	property = 'property',
	macro = 'macro',
	variable = 'variable',
	parameter = 'parameter',
	label = 'label'
}

Make use of tree-sitter's incremental parsing

Tree-sitter supports incremental parsing, which can be accessed via tree.edit. But {Syntax Highlighter} just parse the code and generate a new tree every time. This will lost the efficiency advantage from tree-sitter.

Also, instad of rebuild every time, buildDecor should be done incrementally.

function buildDecor(doc: vscode.TextDocument) {

Conflict with Highlight extension?

I'm not sure where the issue is, but I'm trying to use another extension:
https://marketplace.visualstudio.com/items?itemName=fabiospampinato.vscode-highlight

And I want to hightlight the word TODO in a comment using this settings:

"highlight.regexes": {
        "(// ?)(TODO:?).*": {
            "filterLanguageRegex": "rust|^C.?.?",
            "decorations": [
                {},
                {
                    "fontWeight": "bold",
                    "overviewRulerColor": "#e5c07b",
                    "color": "#ffffff",
                },
            ],
        },
    },

I got my bold but not my colour (white), it seems to be overridden by syntax-highlighter

Is there a way to define an order in the highlighters?

It used to work with the default syntax highlighter

[Language request] Rust

Thank you for this plugin.

However I'm only using Rust on VSCode :)

Can we please have support for Rust?

[Lua] Highlighting improvements?

'self' is not an operator, 'self' has been flagged as operator which looks weird overall. In theming it's variable.language.

In this case 'func' shouldn't have the function color, only Sub should because thats our Function and 'func' inside function should have the same color as outside because it's the same reference.

Also you can see that arg1 is colored like a variable, but it should have it's own color so it's not mixed with other variables. In theming it's variable.language.arguments.

Anything that can be done?

Highlighting desn't work after 0.2.6 update

!!!Attention!!!

This release changes names of some syntax terms.
I apologize to all users, who has already tuned colors, for this inconvenience.
Please rename {Syntax Highlighter} colors in settings.json the following way:

  • "syntax.namespace" -> "syntax.scope"
  • "syntax.keyword_constant" -> "syntax.constant"
  • "syntax.keyword_directive" -> "syntax.directive"
  • "syntax.keyword_control" -> "syntax.control"
  • "syntax.keyword_operator" -> "syntax.operator"
  • "syntax.storage_modifier" -> "syntax.modifier"

Basically, this is not an issue. I've posted it myself to warn about these changes.
I will close it in several days when most users update their settings.

Mapping for Noctis

Hi, Noctis is the top trending / popular set of themes for VS Code at the moment.
They list the following colors in their palettes:

  • Strings
  • Interpolated Strings
  • Comments
  • Function Calls
  • Method Calls
  • Code that needs to stand out
  • Numbers & Booleans
  • Keywords & Operators
  • Function & Variable Declaration, Tags & this
  • Object properties, ID selectors in CSS & Type annotations
  • Attributes, Constants
  • Variables & Parameters

What is the best mapping settings to put in workbench.colorCustomization?

[C++] "this" is a keyword

this as in

this->f();

Currently it's not highlighted. I tried to add it to the end of the list of control keywords in grammar/cpp.json:

         "\"catch\"": "control",
+        "\"this\"": "control",
 
         "\"sizeof\"": "operator",

but it's still not highlighted. What am i missing?

Language-agnostic syntax highlighter?

I'm wondering if it's possible to make this extension language-agnostic, and let those tree-sitter grammars be standalone extensions.
So that users can choose which language they want to highlight by installing the corresponding grammar.

I'm asking this because there's an experimental language that I want to highlight.
I already have the grammar up and running on the Atom editor, and I wanna port it to VS Code.
But I don't think it's a good idea to pollute everybody's editor. So it would be nice if I can separate the syntax highlighter from grammars.

About macro/struct/Enum/Union and local/global variables

@EvgeniyPeshkov Hi ,
I tried syntax-highlighter and I want to set different colors for macro/strcut/Enum/Union variables and local/global variables. Is there a way to set or change source code to add this new feature?

In addition, I found a bug, maybe you can fix it easily. Capture as below:
1

Look forward to your reply.

[Rust] structs failing to highlight properly with field attributes

Source of issue

VSCode extension

What was expected

Consistent syntax highlighting within structs that have field attributes, for the following code:

The code in question:

#[derive(StructOpt)]
#[structopt(name = "logan", about = "Match, parse, and transform your logs")]
pub struct ProgramOptions {
    /// Run the tool in debug mode. Copious amounts of information will be
    /// dumped to stderr
    #[structopt(short)]
    pub debug: bool,

    /// Pattern to search for, syntax is similar to perl regexes
    #[structopt(short, name="REGEX", parse(from_str=parse_regex))]
    pub pattern: Regex,

    /// Source of input lines, defaults to stdin
    #[structopt(
        short,
        name = "INFILE",
        default_value="-",
        parse(from_os_str=parse_istream_path)
    )]
    pub input: Box<dyn std::io::Read>,

    /// Sink for results, defaults to stdout
    #[structopt(
        short,
        name = "OUTFILE",
        default_value = "-",
        parse(from_os_str=parse_ostream_path)
    )]
    pub output: Box<dyn std::io::Write>,
}

What was observed:

The attribute markers seem to trip up the highlighter, with it failing to highlight the field attributes after the 2nd item, here's some screenshots where I progressively delete the markers. The final one seems to "expected"

Original issue

image

Test 1: Delete the last decorator, the same issue moves 1 field up

image

Test 2: This seems to be working as expected.

image

[C++] __attribute__ highlighting

There seem to be some inconsistencies that appear when __attribute__ is used on a struct:

struct __attribute__((packed)) struct1_t {
	static constexpr int A 	= 1;
	static constexpr int B	= 2;
	static constexpr int C	= 3;
};

struct struct2_t {
    static constexpr int A 	= 1;
	static constexpr int B	= 2;
	static constexpr int C	= 3;
};

image

The static modifiers are highlighted differently - do you know why?

[C/C++] . and -> and :: as punctuation

I think it makes sense to tag . and -> as punctuation. Comma (,) is an operator in C++ too, but no one highlighting it because it doesn't make sense to assign color to every ,. By extension it doesn't make a lot of sense to highlight every .. Since -> essentially does the same thing as . but on pointers instead of references, for consistency reasons it also should go to punctuation IMO.

Example code:

this->x
(this)->x
(*this).x

For C++ it also would be nice to move :: to punctuation because it looks weird in something like this:

const std::string s = "yo";

Alternatively all such "questionable" operators might go into their own category like syntax.punctuation.operator or syntax.operator.punctuation. Alas styles in this extension do not work hierarchically, e.g. syntax.operator won't assign color to syntax.operator.punctuation, so syntax.operator.punctuation is kind of misleading name. Another name might be something like syntax.access, idk really.

Here is the patch for moving ., -> and :: to punctuation:

diff --git a/grammars/c.json b/grammars/c.json
index 39da5af..a299197 100644
--- a/grammars/c.json
+++ b/grammars/c.json
@@ -49,8 +49,6 @@
         "\"typedef\"": "control",
 
         "\"sizeof\"": "operator",
-        "\".\"": "operator",
-        "\"->\"": "operator",
         "\"*\"": "operator",
         "\"-\"": "operator",
         "\"+\"": "operator",
@@ -98,6 +96,8 @@
         "preproc_directive": "directive",
         "preproc_arg": "directive",
 
+        "\".\"": "punctuation",
+        "\"->\"": "punctuation",
         "\";\"": "punctuation",
         "\"[\"": "punctuation",
         "\"]\"": "punctuation",
diff --git a/grammars/cpp.json b/grammars/cpp.json
index 4c2d39a..10b1f2a 100644
--- a/grammars/cpp.json
+++ b/grammars/cpp.json
@@ -69,8 +69,6 @@
         "\"sizeof\"": "operator",
         "\"new\"": "operator",
         "\"delete\"": "operator",
-        "\".\"": "operator",
-        "\"->\"": "operator",
         "\"*\"": "operator",
         "\"-\"": "operator",
         "\"+\"": "operator",
@@ -105,7 +103,6 @@
         "\"^=\"": "operator",
         "\"|=\"": "operator",
         "\"?\"": "operator",
-        "\"::\"": "operator",
 
         "\"#if\"": "directive",
         "\"#ifdef\"": "directive",
@@ -117,6 +114,9 @@
         "\"#include\"": "directive",
         "preproc_directive": "directive",
 
+        "\".\"": "punctuation",
+        "\"->\"": "punctuation",
+        "\"::\"": "punctuation",
         "\";\"": "punctuation",
         "\":\"": "punctuation",
         "\",\"": "punctuation",

What do you think?

The highlighter doesn't work

Hello!
I tried to use this extension to highlight my Go files on latest VSCode but it didn't work. I followed the guide and set workbench.colorCustomizations, there was nothing changed.
QQ图片20190805130149

I have no idea what's wrong, any advice?

[C++] Exceptions

Example code:

#include <stdexcept>
#include <iostream>

int main() {
	const std::string message = "sup";

	try {
		throw std::runtime_error(message);
	}
	catch (const std::exception &e) {
		std::cout << e.what() << std::endl;
	}

	return 0;
}

Screenshot:

image

Note that

  1. throw is not a keyword
  2. message in std::runtime_error(message) is highlighted in cyan for some reason (i have cyan assigned to syntax.type)
  3. :: in std::runtime_error is highlighted differently from :: in std::string or std::cout

Is this related to upstream tree-sitter or to this extension?

I've also tried to add throw to keywords:

         "\"try\"": "control",
+        "\"throw\"": "control",
         "\"catch\"": "control",

but this doesn't help.

Any ideas?

[Rust] enum variants should be coloured as type

image

As discussed previously, enum's variant in Rust should be coloured as type.
Here Ok and Err are variants of Result.
But any variant should be seen a type in Rust.
I don't know if tree-sitter distinguish them though.

TextMate color override

I'm not sure what to call this, so let me explain. In certain cases (see #22), tree-sitter-cpp is unable to parse elements and the tree gets corrupted, as well as the resulting highlighting:

image

I'm wondering if it's possible to defer some of the highlighting to TextMate. A color customization rule like this correctly highlights the namespace keywords, but they get recolored, albeit incorrectly, by this extension:

{
    "scope": "storage.type.namespace",
    "settings": {
        "foreground": "#F92672",
        "fontStyle": ""
    }
},

I don't think this is possible given the nature of the extension (it applies after the TextMate highlighting), but I figured I'd ask.

build failed

npm install --target=6.1.2 --runtime=electron --disturl=https://atom.io/download/electron

> [email protected] postinstall /Users/bitbegin/Desktop/syntax-highlighter
> node ./scripts/build.js

Compiling c parser
Compiling cpp parser
Compiling go parser
Compiling javascript parser
Compiling lua parser
Compiling php parser
Compiling python parser
Compiling ruby parser
Compiling rust parser
Compiling shellscript parser
Compiling typescript parser
Compiling typescriptreact parser
Failed to build wasm for ruby: Command failed: node_modules/.bin/tree-sitter build-wasm node_modules/tree-sitter-ruby
events.js:298
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -13,
  code: 'EACCES',
  syscall: 'spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  path: '/Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  spawnargs: [ 'build-wasm', 'node_modules/tree-sitter-ruby' ]
}

Failed to build wasm for python: Command failed: node_modules/.bin/tree-sitter build-wasm node_modules/tree-sitter-python
events.js:298
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -13,
  code: 'EACCES',
  syscall: 'spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  path: '/Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  spawnargs: [ 'build-wasm', 'node_modules/tree-sitter-python' ]
}

Failed to build wasm for lua: Command failed: node_modules/.bin/tree-sitter build-wasm node_modules/tree-sitter-lua
events.js:298
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -13,
  code: 'EACCES',
  syscall: 'spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  path: '/Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  spawnargs: [ 'build-wasm', 'node_modules/tree-sitter-lua' ]
}

Failed to build wasm for javascript: Command failed: node_modules/.bin/tree-sitter build-wasm node_modules/tree-sitter-javascript
events.js:298
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -13,
  code: 'EACCES',
  syscall: 'spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  path: '/Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  spawnargs: [ 'build-wasm', 'node_modules/tree-sitter-javascript' ]
}

Failed to build wasm for go: Command failed: node_modules/.bin/tree-sitter build-wasm node_modules/tree-sitter-go
events.js:298
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -13,
  code: 'EACCES',
  syscall: 'spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  path: '/Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  spawnargs: [ 'build-wasm', 'node_modules/tree-sitter-go' ]
}

Failed to build wasm for cpp: Command failed: node_modules/.bin/tree-sitter build-wasm node_modules/tree-sitter-cpp
events.js:298
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -13,
  code: 'EACCES',
  syscall: 'spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  path: '/Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  spawnargs: [ 'build-wasm', 'node_modules/tree-sitter-cpp' ]
}

Failed to build wasm for c: Command failed: node_modules/.bin/tree-sitter build-wasm node_modules/tree-sitter-c
events.js:298
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -13,
  code: 'EACCES',
  syscall: 'spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  path: '/Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  spawnargs: [ 'build-wasm', 'node_modules/tree-sitter-c' ]
}

Failed to build wasm for php: Command failed: node_modules/.bin/tree-sitter build-wasm node_modules/tree-sitter-php
events.js:298
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -13,
  code: 'EACCES',
  syscall: 'spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  path: '/Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  spawnargs: [ 'build-wasm', 'node_modules/tree-sitter-php' ]
}

Failed to build wasm for shellscript: Command failed: node_modules/.bin/tree-sitter build-wasm node_modules/tree-sitter-bash
events.js:298
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -13,
  code: 'EACCES',
  syscall: 'spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  path: '/Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  spawnargs: [ 'build-wasm', 'node_modules/tree-sitter-bash' ]
}

Failed to build wasm for typescript: Command failed: node_modules/.bin/tree-sitter build-wasm node_modules/tree-sitter-typescript/typescript
events.js:298
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -13,
  code: 'EACCES',
  syscall: 'spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  path: '/Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  spawnargs: [ 'build-wasm', 'node_modules/tree-sitter-typescript/typescript' ]
}

Failed to build wasm for rust: Command failed: node_modules/.bin/tree-sitter build-wasm node_modules/tree-sitter-rust
events.js:298
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -13,
  code: 'EACCES',
  syscall: 'spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  path: '/Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  spawnargs: [ 'build-wasm', 'node_modules/tree-sitter-rust' ]
}

Failed to build wasm for typescriptreact: Command failed: node_modules/.bin/tree-sitter build-wasm node_modules/tree-sitter-typescript/tsx
events.js:298
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -13,
  code: 'EACCES',
  syscall: 'spawn /Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  path: '/Users/bitbegin/Desktop/syntax-highlighter/node_modules/tree-sitter-cli/tree-sitter',
  spawnargs: [ 'build-wasm', 'node_modules/tree-sitter-typescript/tsx' ]
}

audited 610 packages in 3.455s
found 0 vulnerabilities

Bash syntax problem in test expressions

Hello,

With Syntax Highlighter 0.4.4. I have the following colouration which I think is wrong:

When the extension is enabled: we can see that the string is no longer coloured with the string color: it makes it harder to read (which is not what the extension is trying to do :)):
synhighlite_on

Without the extension, this is correct:
synhighlite_off

The extension behave well for this kind of expression:

if [[ -n "${ZETA_BASH_GITEX_CONF}" && ( "${options[refresh]}" == 'yes' || ! -f "${ZETA_BASH_GITEX_CONF}" ) ]];

The quoted 'yes' make it works.

Another problem is with number (I'm using FiraCode, the != is displayed as unicode ≠ but it is only a ligature, should not be the problem here):

image

The first 0 is colored blue, the second is colored gray (or something like that) while I would expect them to use the same color..

I also have a crash after extended use (>30 minutes I think?) but as I played with the Enable/Disable, I no longer have the crash trace... And this is a separate problem anyway.

VSCodium information:

  • Version: 1.45.1 (user setup)
  • Commit: 5763d909d5f12fe19f215cbfdd29a91c0fa9208a
  • Date: 2020-05-15T10:23:54.161Z
  • Electron: 7.2.4
  • Chrome: 78.0.3904.130
  • Node.js: 12.8.1
  • V8: 7.8.279.23-electron.0
  • OS: Windows_NT x64 10.0.18363

How to make open "<" tag and close ">" tag of same color

Hello
this extension looks powerful, but the default behavior of having open/close tags of different colors, looks pretty confusing

In the following screenshot you see a PHP file that will output some HTML and so we have "<?" php tags and "<" html tags , and nevertheless the html tag is purple in the open tag and gray in the closing tag

I don't find the setting to fix that,

can you kindly explain how to make the two tags of same color?

this is the confusing effect

tags

Thank you

[All] Missing refresh?

I'm using auto formatter on save and sometime I got this kind of artefacts:

image
(look at get_connection bottom right of the screenshot)
And this one happened when I refactored the name of a variable

[Rust] Type as namespace

Hi!
I'll open one ticket per issue to keep the discussions targeted :) Hope you don't mind.

In the previous ticket, I didn't pay attention to one thing I've noticed this morning while testing the new version:
image

WebEvent is properly coloured as a type on its declaration, but not when using the variants in the match statement.

Same thing here:
image

HexView is a struct (a type) and is coloured as a namespace.

Overrides Rainbow Brackets

Rainbow Brackets by 2gua colors pairs of e.g. parenthesis, which helps immensely with finding errors in nesting. And it looks pretty. When Syntax Highlighter is enabled it seems to override the stylesheet for brackets, clobbering the entire purpose of the other extension.

This happens with C/C++ but not with Python code, with and without Microsoft's C/C++ extension.

Removing

        "\";\"": "punctuation",
        "\":\"": "punctuation",
        "\",\"": "punctuation",
        "\"[\"": "punctuation",
        "\"]\"": "punctuation",
        "\"{\"": "punctuation",
        "\"}\"": "punctuation",
        "\"(\"": "punctuation",
        "\")\"": "punctuation"

from grammars/cpp.json seems to fix the problem.

🎨 Diffrent `Syntax Highlighting` for each language... Is that possible?

@EvgeniyPeshkov

✌️ Привет!
🔌 Интереснре расширение.

As an example, I'll take the IDE called «NotePad++».
See screenshots below:

image

Now I put here some code, then I switch to other languages...

C#

image

JavaScript

image

AutoHotkey

image

C++

image

CSS

image

HTML

image

Different syntax, color, style, font, weight, brackets... etc.
But in your cool extension I see the same shit with all languages. Please help! 🙏


P.S. ··· read carefully this manual. Is this link valid? It's directing me to GitHub's home page. "Build:". Please provide the relevant link!

  1. Clone or download extension from GitHub.

Спасибо уважаемый! 🍻👍

Support for ERB?

I can try to help too if someone can guide me how to write language specs for this extension.

[C++] Virtual function oddities

I can't explain what's going on here: the highlighting changes vastly despite the function signatures being nearly identical. The presence of the virtual keyword seems to play an effect. In this example, the first function has incorrect/inconsistent highlighting, and the second is highlighted as expected.

image

Language Request: Shellscript/bash

Hello,

I would like to vouch for the inclusion of shellscript/bash support, as VSCode uses Textamate's outdated and very crude grammar.

Thanks for your awesome work on C++.

[C++] Macro and namespace oddities

When using macros to define namespaces, some weird things happen:

#define OPEN_BRACE namespace a {
#define CLOSE_BRACE }

OPEN_BRACE

namespace b { namespace c { namespace d {

CLOSE_BRACE // d
CLOSE_BRACE // c
} // b
} // a

image

The first namespace keyword is highlighted differently than the others. Additionally, the two macros at the end are highlighted differently. Do you know why?

Thanks for your work on this extension! It works the best of any I've tried so far.

Screenshots please

Please post some screenshots of examples of highlighted syntax. From what I recall of syntax-highlighter, it is much more intelligent than simple token based parsers and should produce a much nicer (and more consistent) highlights. It'll be nice to be able to quickly view that.

I'm thinking of showing this extension to my students and it will be nice for them to see if it is worth installing (most of them are comfortable with programming yet)

[C/C++] Member access highlighting

This is a question.

Is member access highlighting something tree-sitter can do? Like this:

image

Note that z, y, x and w are highlighted in blue.

Example code:

b_ptr->z->y.x->w = 12.5f - 11 + 10.0;

support for bold and italics customization

Being able to set not just the color but also the italics or bold behavior of certain syntax terms would be great. If this is already possible it would be great if it could be added to the documentation, as I do not currently see any way to do this.

Highlight escape sequences in strings

Is it possible to highlight escape sequences in strings differently than the rest of the string? E.g., like this:

Screenshot 2020-10-22 at 17 37 21

I tried setting constant.character.escape, but this did not make a difference as far as I can tell.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.