Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd8e1d7a

Browse files
authored
Work with the newest rescript package (#106)
Need to find the new package's name for the formatter.Fixes#104
1 parentaa1712b commitd8e1d7a

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

‎server/src/constants.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ export let bscExePartialPath = path.join(
99
process.platform,
1010
"bsc.exe"
1111
);
12+
exportletbscExeReScriptPartialPath=path.join(
13+
"node_modules",
14+
"rescript",
15+
process.platform,
16+
"bsc.exe"
17+
);
1218

1319
// can't use the native bsb since we might need the watcher -w flag, which is only in the js wrapper
1420
// export let bsbPartialPath = path.join('node_modules', 'bs-platform', process.platform, 'bsb.exe');

‎server/src/server.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ function onMessage(msg: m.Message) {
428428
if(bscExeDir===null){
429429
letparams:p.ShowMessageParams={
430430
type:p.MessageType.Error,
431-
message:`Cannot find a nearby${c.bscExePartialPath}. It's needed for formatting.`,
431+
message:`Cannot find a nearbybsc.exe in bs-platform or rescript. It's needed for formatting.`,
432432
};
433433
letresponse:m.NotificationMessage={
434434
jsonrpc:c.jsonrpcVersion,
@@ -438,7 +438,9 @@ function onMessage(msg: m.Message) {
438438
send(fakeSuccessResponse);
439439
send(response);
440440
}else{
441-
letresolvedBscExePath=path.join(bscExeDir,c.bscExePartialPath);
441+
letbscExePath1=path.join(bscExeDir,c.bscExeReScriptPartialPath);
442+
letbscExePath2=path.join(bscExeDir,c.bscExePartialPath);
443+
letresolvedBscExePath=fs.existsSync(bscExePath1) ?bscExePath1 :bscExePath2;
442444
// code will always be defined here, even though technically it can be undefined
443445
letcode=getOpenedFileContent(params.textDocument.uri);
444446
letformattedResult=utils.formatUsingValidBscExePath(

‎server/src/utils.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ export let findBscExeDirOfFile = (
4747
source:p.DocumentUri
4848
):null|p.DocumentUri=>{
4949
letdir=path.dirname(source);
50-
letbscPath=path.join(dir,c.bscExePartialPath);
51-
if(fs.existsSync(bscPath)){
50+
letbscExePath1=path.join(dir,c.bscExeReScriptPartialPath);
51+
letbscExePath2=path.join(dir,c.bscExePartialPath);
52+
if(fs.existsSync(bscExePath1)||fs.existsSync(bscExePath2)){
5253
returndir;
5354
}else{
5455
if(dir===source){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp