Skip to content

Commit

Permalink
Unify some naming names
Browse files Browse the repository at this point in the history
  • Loading branch information
RedCMD committed Apr 10, 2024
1 parent eef237f commit cd710f3
Show file tree
Hide file tree
Showing 10 changed files with 6,835 additions and 6,982 deletions.
4 changes: 2 additions & 2 deletions out/DocumentHighlightProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exports.DocumentHighlightProvider = {
(include (value (ruleName)) @include)
(include (value !scopeName (self) @self))
(include (value (base) @base))
(name_scope (value (scope) @scope))
(name (value (scope) @scope))
`;
const cursorCapture = (0, TreeSitter_1.queryNode)(jsonTree.rootNode, cursorQuery, point);
if (!cursorCapture) {
Expand Down Expand Up @@ -74,7 +74,7 @@ exports.DocumentHighlightProvider = {
}
break;
case 'scope':
query = `(name_scope (value (scope) @scope (#eq? @scope "${cursorText}")))`;
query = `(name (value (scope) @scope (#eq? @scope "${cursorText}")))`;
break;
default:
return;
Expand Down
6 changes: 3 additions & 3 deletions out/DocumentSymbolProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ exports.SymbolKind = {
'begin': vscode.SymbolKind.String,
'end': vscode.SymbolKind.String,
'while': vscode.SymbolKind.String,
'scopeName': vscode.SymbolKind.String,
'name_scope': vscode.SymbolKind.String,
'scopeName': vscode.SymbolKind.Variable,
'name': vscode.SymbolKind.String,
'name_display': vscode.SymbolKind.String,
'version': vscode.SymbolKind.String,
'schema': vscode.SymbolKind.String,
'fileTypes': vscode.SymbolKind.String,
Expand Down Expand Up @@ -139,7 +139,7 @@ function newDocumentSymbol(node) {
case 'capture':
text = node.firstNamedChild.text;
break;
case 'name_scope':
case 'name':
text = 'name';
break;
case 'value':
Expand Down
2 changes: 1 addition & 1 deletion out/web/extension.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/DocumentHighlightProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const DocumentHighlightProvider: vscode.DocumentHighlightProvider = {
(include (value (ruleName)) @include)
(include (value !scopeName (self) @self))
(include (value (base) @base))
(name_scope (value (scope) @scope))
(name (value (scope) @scope))
`;
const cursorCapture = queryNode(jsonTree.rootNode, cursorQuery, point);
if (!cursorCapture) {
Expand Down Expand Up @@ -79,7 +79,7 @@ export const DocumentHighlightProvider: vscode.DocumentHighlightProvider = {
}
break;
case 'scope':
query = `(name_scope (value (scope) @scope (#eq? @scope "${cursorText}")))`;
query = `(name (value (scope) @scope (#eq? @scope "${cursorText}")))`;
break;
default:
return;
Expand Down
6 changes: 3 additions & 3 deletions src/DocumentSymbolProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ export const SymbolKind: _object_ = {
'end': vscode.SymbolKind.String,
'while': vscode.SymbolKind.String,

'scopeName': vscode.SymbolKind.String,
'name_scope': vscode.SymbolKind.String,
'scopeName': vscode.SymbolKind.Variable,
'name': vscode.SymbolKind.String,
'name_display': vscode.SymbolKind.String,

'version': vscode.SymbolKind.String,
'schema': vscode.SymbolKind.String,
Expand Down Expand Up @@ -163,7 +163,7 @@ function newDocumentSymbol(node: SyntaxNode): vscode.DocumentSymbol {
case 'capture':
text = node.firstNamedChild.text;
break;
case 'name_scope':
case 'name':
text = 'name';
break;
case 'value':
Expand Down
37 changes: 19 additions & 18 deletions src/tree-sitter/tree-sitter-json/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = grammar({
$.version,
$.schema,
$.scopeName,
$.name,
$.name_display,
$.information_for_contributors,
$.fileTypes,
$.firstLineMatch,
Expand Down Expand Up @@ -66,7 +66,7 @@ module.exports = grammar({
_pattern: $ => object($,
choice(
$.include,
$.name_scope,
$.name,
$.contentName,
field(
'match',
Expand Down Expand Up @@ -188,31 +188,32 @@ module.exports = grammar({
"scopeName",
string($),
),
name: $ => pair($,
name_display: $ => pair($,
"name",
string($),
),
name_scope: $ => pair($,
name: $ => pair($,
"name",
string($,
alias(
choice(
repeat1(
choice(
$._scope,
/ +/,
),
$._name_scopes,
),
contentName: $ => pair($,
"contentName",
$._name_scopes,
),
_name_scopes: $ => string($,
alias(
choice(
repeat1(
choice(
$._scope,
/ +/,
),
$._forceStringNode,
),
$.value,
$._forceStringNode,
),
$.value,
),
),
contentName: $ => pair($,
"contentName",
string($),
),
_scope: $ => field(
"scope",
alias(
Expand Down
127 changes: 52 additions & 75 deletions src/tree-sitter/tree-sitter-json/src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
{
"type": "SYMBOL",
"name": "name"
"name": "name_display"
},
{
"type": "SYMBOL",
Expand Down Expand Up @@ -140,7 +140,7 @@
},
{
"type": "SYMBOL",
"name": "name"
"name": "name_display"
},
{
"type": "SYMBOL",
Expand Down Expand Up @@ -569,7 +569,7 @@
},
{
"type": "SYMBOL",
"name": "name_scope"
"name": "name"
},
{
"type": "SYMBOL",
Expand Down Expand Up @@ -689,7 +689,7 @@
},
{
"type": "SYMBOL",
"name": "name_scope"
"name": "name"
},
{
"type": "SYMBOL",
Expand Down Expand Up @@ -1098,7 +1098,7 @@
}
]
},
"name": {
"name_display": {
"type": "SEQ",
"members": [
{
Expand Down Expand Up @@ -1178,7 +1178,7 @@
}
]
},
"name_scope": {
"name": {
"type": "SEQ",
"members": [
{
Expand Down Expand Up @@ -1226,47 +1226,8 @@
}
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "\""
},
{
"type": "ALIAS",
"content": {
"type": "CHOICE",
"members": [
{
"type": "REPEAT1",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_scope"
},
{
"type": "PATTERN",
"value": " +"
}
]
}
},
{
"type": "SYMBOL",
"name": "_forceStringNode"
}
]
},
"named": true,
"value": "value"
},
{
"type": "STRING",
"value": "\""
}
]
"type": "SYMBOL",
"name": "_name_scopes"
}
]
},
Expand Down Expand Up @@ -1318,35 +1279,51 @@
}
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "\""
},
{
"type": "ALIAS",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_string"
},
{
"type": "SYMBOL",
"name": "_forceStringNode"
}
]
"type": "SYMBOL",
"name": "_name_scopes"
}
]
},
"_name_scopes": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "\""
},
{
"type": "ALIAS",
"content": {
"type": "CHOICE",
"members": [
{
"type": "REPEAT1",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_scope"
},
{
"type": "PATTERN",
"value": " +"
}
]
}
},
"named": true,
"value": "value"
},
{
"type": "STRING",
"value": "\""
}
]
{
"type": "SYMBOL",
"name": "_forceStringNode"
}
]
},
"named": true,
"value": "value"
},
{
"type": "STRING",
"value": "\""
}
]
},
Expand Down
10 changes: 5 additions & 5 deletions src/tree-sitter/tree-sitter-json/src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
"named": true
},
{
"type": "name_scope",
"type": "name",
"named": true
},
{
Expand Down Expand Up @@ -846,7 +846,7 @@
"named": true
},
{
"type": "name",
"type": "name_display",
"named": true
},
{
Expand Down Expand Up @@ -929,7 +929,7 @@
}
},
{
"type": "name_scope",
"type": "name_display",
"named": true,
"fields": {
"key": {
Expand Down Expand Up @@ -1081,7 +1081,7 @@
"named": true
},
{
"type": "name_scope",
"type": "name",
"named": true
},
{
Expand Down Expand Up @@ -1239,7 +1239,7 @@
"named": true
},
{
"type": "name_scope",
"type": "name",
"named": true
},
{
Expand Down
Loading

0 comments on commit cd710f3

Please sign in to comment.