allow skipping bootstrap step and expose github actions extension build in CI on every push

This commit is contained in:
Noah Santschi-Cooney 2022-01-02 23:20:37 +00:00
parent 5747a9d9b1
commit 554777d0da
No known key found for this signature in database
GPG key ID: 3B22282472C8AE48
5 changed files with 36 additions and 16 deletions

21
.github/workflows/extension.yml vendored Normal file
View file

@ -0,0 +1,21 @@
name: Build Extension
on:
push:
branches: [ rust-rewrite ]
pull_request:
branches: [ rust-rewrite ]
jobs:
build-vscode-extension:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: npm i
- uses: HaaLeo/publish-vscode-extension@v0
id: vsce_build
with:
pat: 'sample text'
dryRun: true
- uses: actions/upload-artifact@v2
with:
name: vscode-mc-shader.vsix
path: ${{ steps.vsce_build.outputs.vsixPath }}

View file

@ -12,6 +12,7 @@ const platforms: { [key: string]: string } = {
'x64 win32': 'x86_64-windows-msvc',
'x64 linux': 'x86_64-unknown-linux-gnu',
'x64 darwin': 'x86_64-apple-darwin',
'arm64 darwin': 'aarch64-apple-darwin'
}
export class Extension {
@ -38,7 +39,11 @@ export class Extension {
this.extensionContext = context
this.state = new PersistentState(context.globalState)
if(!process.env['MCSHADER_DEBUG']) await this.bootstrap()
if(!process.env['MCSHADER_DEBUG'] && !(vscode.workspace.getConfiguration('mcglsl').get('skipBootstrap') as boolean)) {
await this.bootstrap()
} else {
log.info('skipping language server bootstrap')
}
this.registerCommand('graphDot', commands.generateGraphDot)
this.registerCommand('restart', commands.restartExtension)

View file

@ -8,7 +8,7 @@
"license": "MIT",
"icon": "logo-mini.png",
"repository": {
"url": "https://github.com/Strum355/vscode-mc-shader"
"url": "https://github.com/Strum355/mcshader-lsp"
},
"engines": {
"vscode": "^1.43.0"
@ -59,7 +59,13 @@
],
"configuration": {
"title": "Minecraft GLSL Shaders",
"properties": {}
"properties": {
"mcglsl.skipBootstrap": {
"type": "boolean",
"default": false,
"description": "[DEBUG] Enable to skip bootstrapping the language server binary from Github. Set this to use a manually provided language server binary."
}
}
}
},
"scripts": {

View file

@ -22,8 +22,6 @@ use path_slash::PathBufExt;
use anyhow::{Result, anyhow};
use chan::WaitGroup;
use regex::Regex;
use lazy_static::lazy_static;
@ -57,7 +55,6 @@ fn main() {
let mut langserver = MinecraftShaderLanguageServer {
endpoint: endpoint_output.clone(),
graph: Rc::new(RefCell::new(cache_graph)),
wait: WaitGroup::new(),
root: "".into(),
command_provider: None,
opengl_context: Rc::new(opengl::OpenGlContext::new())
@ -84,7 +81,6 @@ fn main() {
struct MinecraftShaderLanguageServer {
endpoint: Endpoint,
graph: Rc<RefCell<graph::CachedStableGraph>>,
wait: WaitGroup,
root: PathBuf,
command_provider: Option<commands::CustomCommandProvider>,
opengl_context: Rc<dyn opengl::ShaderValidator>
@ -509,7 +505,7 @@ impl MinecraftShaderLanguageServer {
impl LanguageServerHandling for MinecraftShaderLanguageServer {
fn initialize(&mut self, params: InitializeParams, completable: MethodCompletable<InitializeResult, InitializeError>) {
self.wait.add(1);
let capabilities = ServerCapabilities{
document_link_provider: Some(DocumentLinkOptions {
@ -577,10 +573,6 @@ impl LanguageServerHandling for MinecraftShaderLanguageServer {
fn workspace_change_configuration(&mut self, params: DidChangeConfigurationParams) {
//let config = params.settings.as_object().unwrap().get("mcglsl").unwrap();
eprintln!("{:?}", params.settings.as_object().unwrap());
self.wait.done();
}
fn did_open_text_document(&mut self, params: DidOpenTextDocumentParams) {
@ -628,7 +620,6 @@ impl LanguageServerHandling for MinecraftShaderLanguageServer {
}
fn hover(&mut self, _: TextDocumentPositionParams, _: LSCompletable<Hover>) {
self.wait.wait();
/* completable.complete(Ok(Hover{
contents: HoverContents::Markup(MarkupContent{
kind: MarkupKind::Markdown,

View file

@ -42,7 +42,6 @@ fn new_temp_server() -> MinecraftShaderLanguageServer {
MinecraftShaderLanguageServer {
endpoint,
graph: Rc::new(RefCell::new(graph::CachedStableGraph::new())),
wait: WaitGroup::new(),
root: "".into(),
command_provider: None,
opengl_context: Rc::new(opengl::MockShaderValidator::new()),
@ -126,8 +125,6 @@ fn test_empty_initialize() {
assert_eq!(server.graph.borrow().graph.edge_count(), 0);
assert_eq!(server.graph.borrow().graph.node_count(), 0);
assert_eq!(format!("{:?}", server.wait), "WaitGroup { count: 1 }");
server.endpoint.request_shutdown();
}