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

Tree-sitter rolling fixes, 1.117 edition #974

Merged
8 changes: 3 additions & 5 deletions packages/language-gfm/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ exports.activate = () => {
languageScope: null
});

// Create one HTML injection layer for all block-level HTML nodes.
// A separate injection layer for each block-level HTML node.
atom.grammars.addInjectionPoint('source.gfm', {
type: 'document',
type: 'html_block',
language: () => 'html',
content(node) {
return node.descendantsOfType('html_block');
},
content: (node) => node,
includeChildren: true
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parser: 'tree-sitter-ruby'
injectionRegex: 'rb|ruby|RB|RUBY'

treeSitter:
parserSource: 'github:tree-sitter/tree-sitter-ruby#4d9ad3f010fdc47a8433adcf9ae30c8eb8475ae7'
parserSource: 'github:tree-sitter/tree-sitter-ruby#9d86f3761bb30e8dcc81e754b81d3ce91848477e'
grammar: 'tree-sitter-ruby/tree-sitter-ruby.wasm'
highlightsQuery: 'tree-sitter-ruby/highlights.scm'
localsQuery: 'tree-sitter-ruby/locals.scm'
Expand Down
Binary file not shown.
28 changes: 28 additions & 0 deletions packages/language-sass/grammars/modern-tree-sitter-scss.cson
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'SCSS'
scopeName: 'source.css.scss'
type: 'modern-tree-sitter'
# Built from the fork at savetheclocktower/tree-sitter-scss.
parser: 'tree-sitter-scss'

fileTypes: [
'scss'
'css.scss'
'css.scss.erb'
'scss.erb'
'scss.liquid'
]

injectionRegex: '^(scss|SCSS)$'

treeSitter:
parserSource: 'github:savetheclocktower/tree-sitter-scss#090d25a5fc829ce6956201cf55ab6b6eacad999c'
grammar: 'tree-sitter/tree-sitter-scss.wasm'
highlightsQuery: 'tree-sitter/highlights.scm'
foldsQuery: 'tree-sitter/folds.scm'
indentsQuery: 'tree-sitter/indents.scm'
tagsQuery: 'tree-sitter/tags.scm'

comments:
start: '//'
line: '//'
block: ['/*', '*/']
2 changes: 2 additions & 0 deletions packages/language-sass/grammars/tree-sitter/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

(block) @fold
365 changes: 365 additions & 0 deletions packages/language-sass/grammars/tree-sitter/highlights.scm

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions packages/language-sass/grammars/tree-sitter/indents.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

"{" @indent
"}" @dedent
7 changes: 7 additions & 0 deletions packages/language-sass/grammars/tree-sitter/tags.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(rule_set (selectors) @name) @definition.selector

(keyframes_statement (keyframes_name) @name) @definition.keyframes

(mixin_statement (name) @name) @definition.mixin

(function_statement (name) @name) @definition.function
Binary file not shown.
12 changes: 12 additions & 0 deletions packages/language-sass/lib/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

exports.consumeHyperlinkInjection = (hyperlink) => {
hyperlink.addInjectionPoint('source.css.scss', {
types: ['comment', 'single_line_comment']
});
};

exports.consumeTodoInjection = (todo) => {
todo.addInjectionPoint('source.css.scss', {
types: ['comment', 'single_line_comment']
});
};
15 changes: 14 additions & 1 deletion packages/language-sass/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
{
"name": "language-sass",
"version": "0.62.2",
"main": "lib/main",
"description": "Sass/SCSS language support in Atom",
"license": "MIT",
"engines": {
"atom": "*",
"node": "*"
"node": ">=12"
},
"repository": "https://github.com/pulsar-edit/pulsar",
"devDependencies": {
"dedent": "^0.7.0"
},
"consumedServices": {
"hyperlink.injection": {
"versions": {
"0.1.0": "consumeHyperlinkInjection"
}
},
"todo.injection": {
"versions": {
"0.1.0": "consumeTodoInjection"
}
}
}
}
49 changes: 49 additions & 0 deletions packages/language-sass/snippets/scss.cson
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'.source.css.scss':
'!important':
prefix: '!'
body: 'i!important${:;}$0'
'@use':
prefix: 'use'
body: "@use '${1:file}'${2: as ${3:alias}};"
'@import':
prefix: 'import'
body: '@import "$0";'
description: "An enhanced version of CSS’s “@import” rule."
descriptionMoreURL: "https://sass-lang.com/documentation/at-rules/import/"
'@include':
prefix: 'include'
body: '@include ${1:mixin}${2:($3)};$0'
description: "Include a mixin into the current context."
descriptionMoreURL: "https://sass-lang.com/documentation/at-rules/mixin/"
'@extend':
prefix: 'extend'
body: '@extend ${1}$0';
description: "Tells one selector to inherit the styles of another."
descriptionMoreURL: "https://sass-lang.com/documentation/at-rules/extend/"
'@if':
prefix: 'if'
body: """
@if ${1:conditions} {
$0
}
"""
description: "Controls whether or not its block gets evaluated."
descriptionMoreURL: "https://sass-lang.com/documentation/at-rules/control/if/"
'@mixin':
prefix: 'mixin'
body: """
@mixin ${1:name}${2:($3)} {
$0
}
"""
description: "Include a mixin."
descriptionMoreURL: "https://sass-lang.com/documentation/at-rules/mixin/"
'@function':
prefix: 'fun'
body: """
@mixin ${1:name} {
$0
}
"""
description: "Define your own function."
descriptionMoreURL: "https://sass-lang.com/documentation/at-rules/function/"
16 changes: 10 additions & 6 deletions packages/language-sass/spec/sassdoc-spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 37 additions & 22 deletions packages/language-typescript/grammars/common/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
(identifier) @variable.other.assignment.import.namespace._LANG_)

; The "*" in `export * from 'bar'`
(export_statement "*" @variable.other.assignment.export.all.js)
(export_statement "*" @variable.other.assignment.export.all._LANG_)

; The "*" in `export * as Foo from 'bar'`
(export_statement
(namespace_export "*" @variable.other.assignment.export.all.js))
(namespace_export "*" @variable.other.assignment.export.all._LANG_))

; The "*" in `export * as Foo from 'bar'`
(export_statement
(namespace_export
(identifier) @variable.other.assignment.export.alias.js))
(identifier) @variable.other.assignment.export.alias._LANG_))

; The "Foo" in `export { Foo }`
(export_specifier
Expand All @@ -51,7 +51,7 @@
; =========

(this) @variable.language.this._LANG_
(super) @variable.language.super._LANG_._LANG_x
(super) @variable.language.super._LANG_

(required_parameter
pattern: (identifier) @variable.parameter.with-default._LANG_
Expand Down Expand Up @@ -345,7 +345,7 @@

"=>" @storage.type.arrow._LANG_

; TODO: If I allow scopes like `storage.type.string._LANG_`, I will make a lot of
; TODO: If I allow scopes like `storage.type.string.ts`, I will make a lot of
; text look like strings by accident. This really needs to be fixed in syntax
; themes.
;
Expand Down Expand Up @@ -764,10 +764,10 @@
) @meta.embedded.line.interpolation._LANG_

(string
(escape_sequence) @constant.character.escape.js)
(escape_sequence) @constant.character.escape._LANG_)

(template_string
(escape_sequence) @constant.character.escape.js)
(escape_sequence) @constant.character.escape._LANG_)


; CONSTANTS
Expand Down Expand Up @@ -817,16 +817,16 @@
; REGEX
; =====

(regex) @string.regexp.js
(regex) @string.regexp._LANG_
(regex
"/" @punctuation.definition.string.begin.js
"/" @punctuation.definition.string.begin._LANG_
(#is? test.first))

(regex
"/" @punctuation.definition.string.end.js
"/" @punctuation.definition.string.end._LANG_
(#is? test.last))

(regex_flags) @keyword.other.js
(regex_flags) @keyword.other._LANG_


; OPERATORS
Expand All @@ -837,26 +837,28 @@

"=" @keyword.operator.assignment._LANG_
(non_null_expression "!" @keyword.operator.non-null._LANG_)
(unary_expression"!" @keyword.operator.unary._LANG_)
(unary_expression "!" @keyword.operator.unary._LANG_)

[
"&&="
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"||="
"??="
"+="
"-="
"*="
"**="
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"/="
"%="
"^="
"&="
"|="
"<<="
">>="
">>>="
"&="
"^="
"|="
"??="
"||="
] @keyword.operator.assignment.compound._LANG_

(binary_expression
["+" "-" "*" "/" "%"] @keyword.operator.arithmetic._LANG_)
["/" "+" "-" "*" "**" "%"] @keyword.operator.arithmetic._LANG_)

(unary_expression ["+" "-"] @keyword.operator.unary._LANG_)

Expand All @@ -866,15 +868,14 @@
"==="
"!="
"!=="
">="
"<="
">"
"<"
] @keyword.operator.comparison._LANG_
)

["++" "--"] @keyword.operator.increment._LANG_

(binary_expression
[">=" "<=" ">" "<"] @keyword.operator.relational._LANG_)

[
"&&"
"||"
Expand Down Expand Up @@ -902,6 +903,20 @@
"." @keyword.operator.accessor._LANG_
"?." @keyword.operator.accessor.optional-chaining._LANG_

; Optional chaining is illegal…
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure of the factuality of this comment, perhaps

Suggested change
; Optional chaining is illegal…
; Optional chaining should be illegal…

/s (as in, just kidding!)


Ah, I understand now, from reading the corresponding comment fragments below! So, there are specific contexts in which optional chaining is illegal. Got it. Definitely never mind this, then...


; …on the left-hand side of an assignment.
(assignment_expression
left: (_) @_IGNORE_
(#set! prohibitsOptionalChaining true))

; …within a `new` expression.
(new_expression
constructor: (_) @_IGNORE_
(#set! prohibitsOptionalChaining true))

((optional_chain) @invalid.illegal.optional-chain._LANG_
(#is? test.descendantOfNodeWithData prohibitsOptionalChaining))

(ternary_expression
["?" ":"] @keyword.operator.ternary._LANG_
Expand Down
2 changes: 1 addition & 1 deletion src/wasm-tree-sitter-language-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -4501,7 +4501,7 @@ class NodeRangeSet {
getNodeSpec(node, getChildren) {
let { startIndex, endIndex, startPosition, endPosition, id } = node;
let result = { startIndex, endIndex, startPosition, endPosition, id };
if (node.children && getChildren) {
if (getChildren && node.childCount > 0) {
result.children = [];
for (let child of node.children) {
result.children.push(this.getNodeSpec(child, false));
Expand Down
Loading