From 09919527771f9d19410af0a4522b8c1f97c1f2e1 Mon Sep 17 00:00:00 2001 From: Martin Azpillaga Aldalur Date: Wed, 11 Oct 2023 19:46:38 +0200 Subject: [PATCH] contribute configurations in generated package definition --- examples/rpg | 2 +- .../languageserver/LanguageServerPlugin.kt | 32 +++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/examples/rpg b/examples/rpg index 81ae485..18c2006 160000 --- a/examples/rpg +++ b/examples/rpg @@ -1 +1 @@ -Subproject commit 81ae48508dd1e8a21f6c5f84ee7c1370b2067a99 +Subproject commit 18c2006af3bb2fd6f112e3088a775413c8f22310 diff --git a/plugin/src/main/kotlin/com/strumenta/languageserver/LanguageServerPlugin.kt b/plugin/src/main/kotlin/com/strumenta/languageserver/LanguageServerPlugin.kt index a101f1f..c471e38 100644 --- a/plugin/src/main/kotlin/com/strumenta/languageserver/LanguageServerPlugin.kt +++ b/plugin/src/main/kotlin/com/strumenta/languageserver/LanguageServerPlugin.kt @@ -62,8 +62,10 @@ class LanguageServerPlugin : Plugin { extension.fileExtensions = mutableListOf(".$language") extension.editor = "code" extension.serverJarPath = Paths.get(project.projectDir.toString(), "build", "libs", "$language.jar") - extension.examplesPath = Paths.get(project.projectDir.toString(), "examples") + extension.examplesPath = Paths.get(project.rootDir.toString(), "examples") + extension.textmateGrammarPath = Paths.get(project.projectDir.toString(), "src", "main", "resources", "grammar.tmLanguage") + extension.textmateGrammarScope = "main" extension.logoPath = Paths.get(project.projectDir.toString(), "src", "main", "resources", "logo.png") extension.fileIconPath = Paths.get(project.projectDir.toString(), "src", "main", "resources", "fileIcon.png") extension.languageClientPath = Paths.get(project.projectDir.toString(), "src", "main", "resources", "client.js") @@ -130,6 +132,7 @@ class LanguageServerPlugin : Plugin { } else { var grammars = "" if (Files.exists(extension.textmateGrammarPath)) { + println(extension.textmateGrammarPath.toString()) grammars = """ , "grammars": @@ -162,7 +165,32 @@ class LanguageServerPlugin : Plugin { "languages": [ {"id": "$language", "extensions": ["${extension.fileExtensions.joinToString("\", \"")}"]$fileIcon} - ]$grammars + ], + "configuration": { + "title": "${language.capitalized()}", + "properties": { + "$language.showParsingErrors": { + "type": "boolean", + "default": true, + "description": "Show parsing errors produced by ANTLR." + }, + "$language.includeErrorNodeFoundIssues": { + "type": "boolean", + "default": false, + "description": "Show the ANTLR issues that start with 'Error node found', usually duplicates." + }, + "$language.showASTWarnings": { + "type": "boolean", + "default": false, + "description": "Show warnings for ast inconsistencies." + }, + "$language.showLeafPositions": { + "type": "boolean", + "default": false, + "description": "Show all leaves' positions." + } + } + }$grammars }, "engines": {"vscode": "^1.52.0"}, "activationEvents": ["onLanguage:$language"],