Skip to content

Commit e9232b0

Browse files
An-Tucristianoc
authored andcommitted
Fix findBuildBinary naming and fix comments
1 parent be1e3d0 commit e9232b0

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

server/src/server.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ let codeActionsFromDiagnostics: codeActions.filesCodeActions = {};
6565
// will be properly defined later depending on the mode (stdio/node-rpc)
6666
let send: (msg: p.Message) => void = (_) => {};
6767

68-
let findBinary = (projectRootPath: p.DocumentUri) =>
68+
let findBuildBinary = (projectRootPath: p.DocumentUri) =>
6969
extensionConfiguration.binaryPath === null
70-
? utils.findNodeBuildOfProjectRoot(projectRootPath)
71-
: utils.findBinaryFromConfig(extensionConfiguration.binaryPath);
70+
? utils.findBuildBinaryFromProjectRoot(projectRootPath)
71+
: utils.findBuildBinaryFromConfig(extensionConfiguration.binaryPath);
7272

7373
interface CreateInterfaceRequestParams {
7474
uri: string;
@@ -240,7 +240,7 @@ let openedFile = (fileUri: string, fileContent: string) => {
240240
// TODO: sometime stale .bsb.lock dangling. bsb -w knows .bsb.lock is
241241
// stale. Use that logic
242242
// TODO: close watcher when lang-server shuts down
243-
if (findBinary(projectRootPath) != null) {
243+
if (findBuildBinary(projectRootPath) != null) {
244244
let payload: clientSentBuildAction = {
245245
title: c.startBuildAction,
246246
projectRootPath: projectRootPath,
@@ -1077,7 +1077,7 @@ function onMessage(msg: p.Message) {
10771077
// TODO: close watcher when lang-server shuts down. However, by Node's
10781078
// default, these subprocesses are automatically killed when this
10791079
// language-server process exits
1080-
let found = findBinary(projectRootPath);
1080+
let found = findBuildBinary(projectRootPath);
10811081
if (found != null) {
10821082
let bsbProcess = utils.runBuildWatcherUsingValidBuildPath(
10831083
found.buildPath,

server/src/utils.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ let findBscBinFromConfig = (
8383
return null;
8484
};
8585

86+
// The function is to check that the build binary file exists
87+
// and also determine what exactly the user is using ReScript or BuckleScript.
8688
// TODO: this doesn't handle file:/// scheme
87-
let findBinaryBase = ({
89+
let findBuildBinaryBase = ({
8890
rescriptPath,
8991
bsbPath,
9092
}: {
@@ -99,14 +101,14 @@ let findBinaryBase = ({
99101
return null;
100102
};
101103

102-
export let findBinaryFromConfig = (pathToBinFromConfig: p.DocumentUri) =>
103-
findBinaryBase({
104-
rescriptPath: path.join(pathToBinFromConfig, c.rescriptBinName),
105-
bsbPath: path.join(pathToBinFromConfig, c.bsbBinName),
104+
export let findBuildBinaryFromConfig = (pathToBinaryDirFromConfig: p.DocumentUri) =>
105+
findBuildBinaryBase({
106+
rescriptPath: path.join(pathToBinaryDirFromConfig, c.rescriptBinName),
107+
bsbPath: path.join(pathToBinaryDirFromConfig, c.bsbBinName),
106108
});
107109

108-
export let findNodeBuildOfProjectRoot = (projectRootPath: p.DocumentUri) =>
109-
findBinaryBase({
110+
export let findBuildBinaryFromProjectRoot = (projectRootPath: p.DocumentUri) =>
111+
findBuildBinaryBase({
110112
rescriptPath: path.join(projectRootPath, c.rescriptNodePartialPath),
111113
bsbPath: path.join(projectRootPath, c.bsbNodePartialPath),
112114
});

0 commit comments

Comments
 (0)