Skip to content

Fix alpine lemminx server #1016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"binaryServerDownloadUrl": {
"linux": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-linux.zip",
"alpine": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-alpine.zip",
"osx-x86_64": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-osx-x86_64.zip",
"osx-aarch_64": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-osx-aarch_64.zip",
"win32": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-win32.zip"
Expand Down
15 changes: 13 additions & 2 deletions src/server/binary/binaryServerStarter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,24 @@ function getBinaryEnvironment(): any {
return process.env;
}

/**
* Returns the platform of the current operating system.
* If the OS is Alpine Linux, it returns 'alpine'.
* Otherwise, it returns the platform string provided by the 'os' module.
*
* @returns The platform of the current operating system.
*/
function getPlatform (): NodeJS.Platform | 'alpine' {
return fs.existsSync('/etc/alpine-release') ? 'alpine' : os.platform();
}

/**
* Returns the name of the server binary file for the current OS and architecture
*
* @return the name of the server binary file for the current OS and architecture
*/
function getServerBinaryNameWithoutExtension(): string {
switch (os.platform()) {
switch (getPlatform()) {
case 'darwin':
switch (os.arch()) {
case 'arm64':
Expand All @@ -221,7 +232,7 @@ function getServerBinaryNameWithoutExtension(): string {
return 'lemminx-osx-x86_64';
}
default:
return `lemminx-${os.platform}`;
return `lemminx-${getPlatform()}`;
}
}

Expand Down
Loading