diff --git a/package.json b/package.json index c82c5d3..20db77d 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ { "language": "renpy", "scopeName": "source.renpy", - "path": "./syntaxes/renpy.tmLanguage.json" + "path": "./syntaxes/renpy.tmLanguage_2.json" } ], "snippets": [ diff --git a/src/semantics.ts b/src/semantics.ts index 1f13738..8cd80d5 100644 --- a/src/semantics.ts +++ b/src/semantics.ts @@ -9,7 +9,7 @@ import { stripWorkspaceFromFile } from "./workspace"; export function getSemanticTokens(document: TextDocument, legend: SemanticTokensLegend): SemanticTokens { const tokensBuilder = new SemanticTokensBuilder(legend); const rxKeywordList = /\s*(screen|label|transform|def|class)\s+/; - const rxParameterList = /\s*(screen|label|transform|def|class)\s+([a-zA-Z_]\w+)\s*\((.*)\)\s*:|\s*(label)\s+([a-zA-Z0-9_.]+)\s*:|^(init)\s+([-\d]+\s+)*python\s+in\s+(\w+):|^(python)\s+early\s+in\s+(\w+):|\s*(class)\s+([a-zA-Z0-9_]+)\s*/s; + const rxParameterList = /\s*(screen|label|transform|class)\s+([a-zA-Z_]\w*)\s*\((.*)\)\s*:|\s*(label)\s+([a-zA-Z_]\w*)\s*:|^(init)\s+([-\d]+\s+)*python\s+in\s+(\w+):|^(python)\s+early\s+in\s+(\w+):|\s*(class)\s+([a-zA-Z_]\w*)\s*:|\s*(def)\s+([a-zA-Z_]\w*)\s*\((.*)\)\s*(->\s*[a-zA-Z_]\w*\s*)?:/s; const rxVariableDefines = /^\s*(default|define)\s+([a-zA-Z]+[a-zA-Z0-9_]*)\s*=\s*(.*)/; const rxPersistentDefines = /^\s*(default|define)\s+persistent\.([a-zA-Z]+[a-zA-Z0-9_]*)\s*=\s*(.*)/; const filename = stripWorkspaceFromFile(document.uri.path); @@ -87,11 +87,6 @@ export function getSemanticTokens(document: TextDocument, legend: SemanticTokens length = m.split('=')[0].trimRight().length; } const range = new Range(i, start + offset, i, start + length); - if (m.substring(offset, length) === 'self' || m.substring(offset, length) === 'cls') { - tokensBuilder.push(range, 'keyword'); - } else { - tokensBuilder.push(range, 'parameter', ['declaration']); - } parent_args.push(line.substring(start + offset, length - offset)); parent_defaults[m.substring(offset, length)] = new Navigation("parameter", m.substring(offset, length), filename, i + 1, "", m.trim(), "", start + offset); // create a Navigation dictionary entry for this token range