Skip to content

Commit d1e6d94

Browse files
authored
Merge pull request #553 from usethesource/update-example-extension
Update example folder to package language servers as VS Code extensions
2 parents 3c5ff77 + a09da1b commit d1e6d94

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

examples/pico-dsl-extension/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ node_modules
22
package-lock.json
33
dist/
44
bin/
5-
lib/
5+
lib/
6+
*.vsix

examples/pico-dsl-extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@
5656
"webpack-cli": "^4.10.0"
5757
},
5858
"dependencies": {
59-
"@usethesource/rascal-vscode-dsl-lsp-server": "0.5.8"
59+
"@usethesource/rascal-vscode-dsl-lsp-server": "0.12.0"
6060
}
6161
}

examples/pico-dsl-extension/src/extension.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
import * as vscode from 'vscode';
2-
import { ParameterizedLanguageServer, VSCodeUriResolverServer, LanguageParameter } from '@usethesource/rascal-vscode-dsl-runtime';
2+
import { ParameterizedLanguageServer, VSCodeUriResolverServer, LanguageParameter } from '@usethesource/rascal-vscode-dsl-lsp-server';
33
import { join } from 'path';
44

55
export function activate(context: vscode.ExtensionContext) {
66
// jar that contains the `pico-lsp` project
77
const picoLSPJar = `|jar+file://${context.extensionUri.path}/assets/jars/pico-lsp.jar!|`;
88
const language = <LanguageParameter>{
99
pathConfig: `pathConfig(srcs=[${picoLSPJar}])`,
10-
name: "Pico",
11-
extension: "pico",
12-
mainModule: "lang::pico::LanguageServer",
10+
name: "Pico",
11+
extensions: ["pico"],
12+
mainModule: "lang::pico::LanguageServer",
1313
mainFunction: "picoContributions"
1414
};
1515
console.log(language);
1616
// rascal vscode needs an instance of this class, if you register multiple languages, they can share this vfs instance
17-
const vfs = new VSCodeUriResolverServer(false);
17+
const vfs = new VSCodeUriResolverServer(false);
1818
// this starts the LSP server and connects it to rascal
19-
const lsp = new ParameterizedLanguageServer(context,
20-
vfs,
21-
calcJarPath(context),
22-
true,
19+
const lsp = new ParameterizedLanguageServer(context,
20+
vfs,
21+
calcJarPath(context),
22+
true,
2323
"pico", // vscode language ID
2424
"Pico", // vscode language Title (visible in the right bottom corner)
2525
language);

examples/pico-dsl-extension/webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ const extensionConfig = {
4848
// we copy the jars to an an easy to predict location
4949
from: path.resolve(
5050
__dirname,
51-
"node_modules/@usethesource/rascal-vscode-dsl-runtime/assets/jars/"
51+
"node_modules/@usethesource/rascal-vscode-dsl-lsp-server/assets/jars/"
5252
),
5353
to: path.resolve(__dirname, "dist/rascal-lsp/"),
5454
},
5555
],
5656
}),
5757
],
5858
};
59-
module.exports = [ extensionConfig ];
59+
module.exports = [ extensionConfig ];

examples/pico-dsl-lsp/pom.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
<dependency>
3030
<groupId>org.rascalmpl</groupId>
3131
<artifactId>rascal</artifactId>
32-
<version>0.28.3</version>
32+
<version>0.40.17</version>
3333
</dependency>
3434
<dependency>
3535
<groupId>org.rascalmpl</groupId>
3636
<artifactId>rascal-lsp</artifactId>
37-
<version>2.12.1</version>
37+
<version>2.21.0</version>
3838
<exclusions>
3939
<exclusion>
4040
<groupId>org.rascalmpl</groupId>
@@ -96,4 +96,3 @@
9696
</plugins>
9797
</build>
9898
</project>
99-

examples/pico-dsl-lsp/src/main/rascal/lang/pico/LanguageServer.rsc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import IO;
1010
// a minimal implementation of a DSL in rascal
1111
// users can add support for more advanced features
1212
set[LanguageService] picoContributions() = {
13-
parser(parser(#start[Program])), // register the parser function for the Pico language
14-
outliner(picoOutliner),
15-
summarizer(picoSummarizer, providesImplementations = false)
13+
parsing(parser(#start[Program])), // register the parser function for the Pico language
14+
documentSymbol(picoOutliner),
15+
analysis(picoSummarizer, providesImplementations = false)
1616
};
1717

1818

@@ -46,7 +46,7 @@ int main() {
4646
language(
4747
pathConfig(srcs=[|project://pico-dsl-lsp/src/main/rascal|]),
4848
"Pico", // name of the language
49-
"pico", // extension
49+
{"pico"}, // extension
5050
"lang::pico::LanguageServer", // module to import
5151
"picoContributions"
5252
)

0 commit comments

Comments
 (0)