Skip to content

Commit

Permalink
fix: double check correct .rng files are extracted from lemminx vespa…
Browse files Browse the repository at this point in the history
… jar
  • Loading branch information
Mangern committed Oct 25, 2024
1 parent 0cc4427 commit f2c64f0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
],
"extensions": [
".sd",
".profile",
".yql"
".profile"
],
"configuration": "./language-configuration.json"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export function activate(context: vscode.ExtensionContext) {
})));


context.subscriptions.push(vscode.commands.registerCommand("vespaSchemaLS.commands.findSchemaDefinition", async (fileName) => {
context.subscriptions.push(vscode.commands.registerCommand("vespaSchemaLS.commands.schema.findSchemaDefinition", async (fileName) => {
if (schemaClient === null) {
return null;
}
Expand All @@ -161,7 +161,7 @@ export function activate(context: vscode.ExtensionContext) {
}));

// This command exists to setup schema language server workspace in case the first opened document is an xml file (which not handled by schema language server)
context.subscriptions.push(vscode.commands.registerCommand("vespaSchemaLS.commands.setupWorkspace", async (fileURI) => {
context.subscriptions.push(vscode.commands.registerCommand("vespaSchemaLS.commands.schema.setupWorkspace", async (fileURI) => {
if (schemaClient === null) {
return;
}
Expand All @@ -175,7 +175,7 @@ export function activate(context: vscode.ExtensionContext) {
}
}));

context.subscriptions.push(vscode.commands.registerCommand("vespaSchemaLS.commands.hasSetupWorkspace", async () => {
context.subscriptions.push(vscode.commands.registerCommand("vespaSchemaLS.commands.schema.hasSetupWorkspace", async () => {
if (schemaClient === null) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ public static void unpackRNGFiles(Path serverPath) throws IOException {
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
if (!entry.isDirectory() && entry.getName().endsWith(".rng")) {
if (!entry.isDirectory() && entry.getName().endsWith(".rng") && entry.getName().startsWith("resources/schema")) {
Path writePath = serverPath.resolve(entry.getName());
try (InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(entry.getName())) {
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String content = reader.lines().collect(Collectors.joining(System.lineSeparator()));
Files.write(writePath, content.getBytes(), StandardOpenOption.CREATE);
} catch (Exception ex) {
// Ignore: unwanted .rng file
}
}
}
Expand Down

0 comments on commit f2c64f0

Please sign in to comment.