-
Notifications
You must be signed in to change notification settings - Fork 3
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
Update version prompt if l2 binary below v1.5.1 #11
Conversation
- Added utils so next dev can use the teminal functionalities.
- Using getShowLama2Term() in generateCodeSnippet.ts and executeCurrentFile.ts
src/checkL2Version.ts
Outdated
exec("l2 --version", (error, stdout, stderr) => { | ||
const versionOutput = stdout.trim(); | ||
const versionMatch = versionOutput.match(/v(\d+\.\d+\.\d+)/); | ||
if (versionMatch && versionMatch.length === 2) { |
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.
Why length === 2
? We can use capture group to get a triple for (major, minor, patch) as well directly, I think.
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.
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.
Damn never knew so many kinds are there
src/checkL2Version.ts
Outdated
}); | ||
} | ||
|
||
function compareL2Versions(currentVersion: string, latestVersion: string) { |
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.
I recommend using a library suggested in this SO Answer. Our semver definition is simple now, but there are more changes possible. Best to simply use standardized library for it.
Should be as simple as:
semver.gte('3.4.8', '3.4.7') //true
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.
If we're using this library, then ignore the previous comment about regex*.
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.
Yeah using this
Just curious - have we already integrated the variable suggestion logic (from both |
src/extension.ts
Outdated
@@ -34,6 +35,9 @@ export function activate(context: vscode.ExtensionContext) { | |||
context.subscriptions.push(generateCodeSnippetDisposable); | |||
console.log(">>> generateCodeSnippetDisposable is now active!"); | |||
|
|||
// Automatically check L2 version on extension activation | |||
checkL2Version(); |
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.
So if version is too old, what happens to the variable suggestion? Is it totally dead in older versions?
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.
No in the older version what we were doing is searching the le.env file in front end and suggesting it. So it won't be a problem.
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.
What I am saying is something else.
Say, the extension frontend updates, but the l2 version is still old, what happens?
Remember - VSCode automatically updates extensions quite quickly (I think)
Yes its integrated to main but havent released it yet |
src/checkL2Version.ts
Outdated
const LAMA2_TERM_NAME = "AutoLama2"; | ||
const UPDATE_MSG = "Support for environment variables."; | ||
|
||
export function checkL2Version() { | ||
export async function getL2VersionAndUpdatePrompt(minVersionToCheck: string) { |
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.
Which function call within this requires async
? I don't see any await
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.
Removed this, it wasn't needed
}); | ||
return normalizedVersion; | ||
} else { | ||
throw new Error("Invalid version format: " + l2Version); |
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.
Shall we report to the user - that the version is unknown and probably the extension will not work in full?
We can have a button "Download" to direct them to website.
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.
Added this
return normalizedVersion; | ||
} else { | ||
throw new Error("Invalid version format: " + l2Version); | ||
} | ||
} catch (e: any) { | ||
console.log("Problem while checking for version -> ", e); |
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.
We should surface this as a warning - I think.
Especially - what happens when there is no binary in the path?
I think the user ought to know that something is wrong, and that action is needed.
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.
Yeah added
LGTM |
What type of MR is this?
Description
l2 -u
, prompt will come as a warning + description + button .Mobile & Desktop Screenshots/Recordings
If there is no l2binary installed
If l2binary is less than v1.5.1
Important code file to start Code Review from
Check l2Version.ts
Added tests?
Are there any post-deployment tasks we need to perform?