Skip to content

Commit 554777d

Browse files
committed
allow skipping bootstrap step and expose github actions extension build in CI on every push
1 parent 5747a9d commit 554777d

File tree

5 files changed

+36
-16
lines changed

5 files changed

+36
-16
lines changed

.github/workflows/extension.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Build Extension
2+
on:
3+
push:
4+
branches: [ rust-rewrite ]
5+
pull_request:
6+
branches: [ rust-rewrite ]
7+
jobs:
8+
build-vscode-extension:
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- uses: actions/checkout@v2
12+
- run: npm i
13+
- uses: HaaLeo/publish-vscode-extension@v0
14+
id: vsce_build
15+
with:
16+
pat: 'sample text'
17+
dryRun: true
18+
- uses: actions/upload-artifact@v2
19+
with:
20+
name: vscode-mc-shader.vsix
21+
path: ${{ steps.vsce_build.outputs.vsixPath }}

client/src/extension.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const platforms: { [key: string]: string } = {
1212
'x64 win32': 'x86_64-windows-msvc',
1313
'x64 linux': 'x86_64-unknown-linux-gnu',
1414
'x64 darwin': 'x86_64-apple-darwin',
15+
'arm64 darwin': 'aarch64-apple-darwin'
1516
}
1617

1718
export class Extension {
@@ -38,7 +39,11 @@ export class Extension {
3839
this.extensionContext = context
3940
this.state = new PersistentState(context.globalState)
4041

41-
if(!process.env['MCSHADER_DEBUG']) await this.bootstrap()
42+
if(!process.env['MCSHADER_DEBUG'] && !(vscode.workspace.getConfiguration('mcglsl').get('skipBootstrap') as boolean)) {
43+
await this.bootstrap()
44+
} else {
45+
log.info('skipping language server bootstrap')
46+
}
4247

4348
this.registerCommand('graphDot', commands.generateGraphDot)
4449
this.registerCommand('restart', commands.restartExtension)

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"license": "MIT",
99
"icon": "logo-mini.png",
1010
"repository": {
11-
"url": "https://github.com/Strum355/vscode-mc-shader"
11+
"url": "https://github.com/Strum355/mcshader-lsp"
1212
},
1313
"engines": {
1414
"vscode": "^1.43.0"
@@ -59,7 +59,13 @@
5959
],
6060
"configuration": {
6161
"title": "Minecraft GLSL Shaders",
62-
"properties": {}
62+
"properties": {
63+
"mcglsl.skipBootstrap": {
64+
"type": "boolean",
65+
"default": false,
66+
"description": "[DEBUG] Enable to skip bootstrapping the language server binary from Github. Set this to use a manually provided language server binary."
67+
}
68+
}
6369
}
6470
},
6571
"scripts": {

server/src/main.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ use path_slash::PathBufExt;
2222

2323
use anyhow::{Result, anyhow};
2424

25-
use chan::WaitGroup;
26-
2725
use regex::Regex;
2826

2927
use lazy_static::lazy_static;
@@ -57,7 +55,6 @@ fn main() {
5755
let mut langserver = MinecraftShaderLanguageServer {
5856
endpoint: endpoint_output.clone(),
5957
graph: Rc::new(RefCell::new(cache_graph)),
60-
wait: WaitGroup::new(),
6158
root: "".into(),
6259
command_provider: None,
6360
opengl_context: Rc::new(opengl::OpenGlContext::new())
@@ -84,7 +81,6 @@ fn main() {
8481
struct MinecraftShaderLanguageServer {
8582
endpoint: Endpoint,
8683
graph: Rc<RefCell<graph::CachedStableGraph>>,
87-
wait: WaitGroup,
8884
root: PathBuf,
8985
command_provider: Option<commands::CustomCommandProvider>,
9086
opengl_context: Rc<dyn opengl::ShaderValidator>
@@ -509,7 +505,7 @@ impl MinecraftShaderLanguageServer {
509505

510506
impl LanguageServerHandling for MinecraftShaderLanguageServer {
511507
fn initialize(&mut self, params: InitializeParams, completable: MethodCompletable<InitializeResult, InitializeError>) {
512-
self.wait.add(1);
508+
513509

514510
let capabilities = ServerCapabilities{
515511
document_link_provider: Some(DocumentLinkOptions {
@@ -577,10 +573,6 @@ impl LanguageServerHandling for MinecraftShaderLanguageServer {
577573

578574
fn workspace_change_configuration(&mut self, params: DidChangeConfigurationParams) {
579575
//let config = params.settings.as_object().unwrap().get("mcglsl").unwrap();
580-
581-
eprintln!("{:?}", params.settings.as_object().unwrap());
582-
583-
self.wait.done();
584576
}
585577

586578
fn did_open_text_document(&mut self, params: DidOpenTextDocumentParams) {
@@ -628,7 +620,6 @@ impl LanguageServerHandling for MinecraftShaderLanguageServer {
628620
}
629621

630622
fn hover(&mut self, _: TextDocumentPositionParams, _: LSCompletable<Hover>) {
631-
self.wait.wait();
632623
/* completable.complete(Ok(Hover{
633624
contents: HoverContents::Markup(MarkupContent{
634625
kind: MarkupKind::Markdown,

server/src/test.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ fn new_temp_server() -> MinecraftShaderLanguageServer {
4242
MinecraftShaderLanguageServer {
4343
endpoint,
4444
graph: Rc::new(RefCell::new(graph::CachedStableGraph::new())),
45-
wait: WaitGroup::new(),
4645
root: "".into(),
4746
command_provider: None,
4847
opengl_context: Rc::new(opengl::MockShaderValidator::new()),
@@ -126,8 +125,6 @@ fn test_empty_initialize() {
126125
assert_eq!(server.graph.borrow().graph.edge_count(), 0);
127126
assert_eq!(server.graph.borrow().graph.node_count(), 0);
128127

129-
assert_eq!(format!("{:?}", server.wait), "WaitGroup { count: 1 }");
130-
131128
server.endpoint.request_shutdown();
132129
}
133130

0 commit comments

Comments
 (0)