Skip to content

Commit cae2f69

Browse files
committed
VSCode improvements
1 parent 3c8ea93 commit cae2f69

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed

scripts/build.ps1

+7-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function Test-UnitTests-NetFramework() {
9696

9797
function Package-LanguageServer() {
9898
$runtimes =
99-
"win10-x64"
99+
"win-x64"
100100
#"osx-x64"
101101

102102
Write-Host "Packaging Language Server"
@@ -106,7 +106,12 @@ function Package-LanguageServer() {
106106
$outputDir = Join-Path $rootDir "src/ShaderTools.VSCode/bin/$runtime"
107107
Create-Directory $outputDir
108108
$outputBinary = "$outputDir/ShaderTools.LanguageServer.exe"
109-
$args = "warp src/ShaderTools.LanguageServer/ShaderTools.LanguageServer.csproj --output $outputBinary --verbose"
109+
$args = ""
110+
if ($config -eq "Debug") {
111+
$args = "publish --configuration $config --output $outputDir /p:PublishSingleFile=true /p:PublishTrimmed=false src/ShaderTools.LanguageServer/ShaderTools.LanguageServer.csproj"
112+
} else {
113+
$args = "warp src/ShaderTools.LanguageServer/ShaderTools.LanguageServer.csproj --output $outputBinary --verbose"
114+
}
110115
Exec-Console "dotnet" $args
111116
}
112117

src/ShaderTools.LanguageServer/ShaderTools.LanguageServer.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<OutputType>exe</OutputType>
44
<TargetFramework>netcoreapp3.0</TargetFramework>
5-
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
5+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
66
<PublishTrimmed>true</PublishTrimmed>
77
<LangVersion>latest</LangVersion>
88
</PropertyGroup>

src/ShaderTools.VSCode/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ HLSL Tools provides enhanced support for editing High Level Shading Language (HL
88

99
### System requirements
1010

11-
HLSL Tools currently only works on Windows 10 x64. There are plans to support macOS and Linux in future versions.
11+
HLSL Tools currently only works on Windows x64. There are plans to support macOS and Linux in future versions.
1212

1313
### Why use HLSL Tools?
1414

src/ShaderTools.VSCode/src/session.ts

+17-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os = require('os');
12
import path = require('path');
23
import vscode = require('vscode');
34

@@ -22,8 +23,10 @@ export class SessionManager {
2223
private statusBarItem: vscode.StatusBarItem;
2324
private registeredCommands: vscode.Disposable[] = [];
2425
private languageServerClient: LanguageClient = undefined;
26+
private platform: NodeJS.Platform;
2527

2628
constructor() {
29+
this.platform = os.platform();
2730
this.registerCommands();
2831
}
2932

@@ -66,14 +69,13 @@ export class SessionManager {
6669
}
6770

6871
private startEditorServices() {
69-
try
70-
{
72+
try {
7173
this.setSessionStatus(
7274
"Starting HLSL Tools...",
7375
SessionStatus.Initializing);
7476

75-
// TODO: Change path depending on current platform.
76-
var serverExe = path.resolve(__dirname, '../bin/win10-x64/ShaderTools.LanguageServer.exe');
77+
var serverPath = this.getServerPath();
78+
var serverExe = path.resolve(__dirname, `../bin/${serverPath}`);
7779

7880
var startArgs = [ ];
7981
//startArgs.push("--logfilepath", editorServicesLogPath);
@@ -110,13 +112,22 @@ export class SessionManager {
110112
});
111113

112114
this.languageServerClient.start();
113-
}
114-
catch (e)
115+
} catch (e)
115116
{
116117
this.setSessionFailure("The language service could not be started: ", e);
117118
}
118119
}
119120

121+
private getServerPath() {
122+
switch (this.platform) {
123+
case "win32":
124+
return "win-x64/ShaderTools.LanguageServer.exe";
125+
126+
default:
127+
throw `Platform ${this.platform} is not currently supported by HLSL Tools.`;
128+
}
129+
}
130+
120131
private restartSession() {
121132
this.stop();
122133
this.start();

0 commit comments

Comments
 (0)