Skip to content

Commit

Permalink
fix: Auto-select WebAssembly image on platforms without native support (
Browse files Browse the repository at this point in the history
fixes #283)
  • Loading branch information
slavek-kucera authored Aug 29, 2023
1 parent c3a888e commit bcf91c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions clients/vscode-hlasmplugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Program to processor group mapping precedence
- The language server may crash while accessing content of virtual files
- "Diagnostics suppressed" informational message may be incorrectly generated
- Auto-select WebAssembly image on platforms without native support

## [1.9.0](https://github.com/eclipse-che4z/che-che4z-lsp-for-hlasm/compare/1.8.0...1.9.0) (2023-08-03)

Expand Down
14 changes: 13 additions & 1 deletion clients/vscode-hlasmplugin/src/serverFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ import { getConfig } from './eventsHandler'

export type ServerVariant = "tcp" | "native" | "wasm";

const supportedNativePlatforms: Readonly<{ [key: string]: string }> = Object.freeze({
'win32.x64': 'win32',
'linux.x64': 'linux',
'darwin.x64': 'darwin',
'darwin.arm64': 'darwin',
});

/**
* factory to create server options
* also stores port used for DAP
Expand All @@ -32,7 +39,12 @@ export class ServerFactory {
}

async create(method: ServerVariant): Promise<vscodelc.ServerOptions> {
const langServerFolder = process.platform;
const langServerFolder = supportedNativePlatforms[process.platform + '.' + process.arch];
if (!langServerFolder) {
if (method !== 'wasm')
console.log('Unsupported platform detected, switching to wasm');
method = 'wasm';
}
if (method === 'tcp') {
const lspPort = await this.getPort();

Expand Down

0 comments on commit bcf91c9

Please sign in to comment.