-
Notifications
You must be signed in to change notification settings - Fork 58
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
Use fs api to check if string is a directory. #1080
Conversation
Ping @zth |
server/src/utils.ts
Outdated
const isDir = path.extname(source) === ""; | ||
const dirStat = fs.statSync(source); | ||
const isDir = dirStat.isDirectory(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, this is in a hot path where we shouldn't use fs
functions (which is why this fn looks the way it looks now). So we need to figure out another way to do this, outside of the hot path. OTOH maybe it could be aggressively cached in some sane way (unlikely), or moved outside of the hot path entirely to some sort of setup function somewhere. Would need to be explored.
@@ -268,7 +268,7 @@ let openedFile = (fileUri: string, fileContent: string) => { | |||
filesDiagnostics: {}, | |||
namespaceName: | |||
namespaceName.kind === "success" ? namespaceName.result : null, | |||
rescriptVersion: utils.findReScriptVersion(projectRootPath), | |||
rescriptVersion: utils.findReScriptVersionForProjectRoot(projectRootPath), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the root of the problem really.
Here my project is called ronnies.be
, which is mistaken for a file.
At this point, we know it is a folder, so we can shortcut things I think.
@nojaf ready for a new review...? |
@zth yup, go for it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me! Although I have not tested it.
Works like a charm in the prerelease channel! |
I found out why the incremental build wasn't working yesterday.
Turns out I have a dot in my project folder name, this was mistaken for a file.
That file is not part of the project, thus the rescript version could not be found for the root.