-
Notifications
You must be signed in to change notification settings - Fork 19
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
Enable always using the latest nightly Dafny release #196
Changes from 4 commits
e91ad82
0a0efba
8b20c36
a2e0698
04ec886
72eda90
bbe1dee
8ca1935
56c34b5
4093e10
910bbce
83d6743
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -32,7 +32,13 @@ async function getConfiguredVersion(): Promise<string> { | |||||
|
||||||
let getConfiguredTagAndVersionCache: [string, string]; | ||||||
async function getConfiguredTagAndVersion(): Promise<[string, string]> { | ||||||
return getConfiguredTagAndVersionCache ?? (getConfiguredTagAndVersionCache = await getConfiguredTagAndVersionUncached()); | ||||||
if(getConfiguredTagAndVersionCache === undefined) { | ||||||
const result = await getConfiguredTagAndVersionUncached(); | ||||||
if(getConfiguredTagAndVersionCache === undefined) { | ||||||
getConfiguredTagAndVersionCache = result; | ||||||
} | ||||||
} | ||||||
return getConfiguredTagAndVersionCache; | ||||||
} | ||||||
|
||||||
async function getConfiguredTagAndVersionUncached(): Promise<[string, string]> { | ||||||
|
@@ -44,9 +50,14 @@ async function getConfiguredTagAndVersionUncached(): Promise<[string, string]> { | |||||
case LanguageServerConstants.LatestNightly: { | ||||||
const result: any = await (await fetch('https://api.github.com/repos/dafny-lang/dafny/releases/tags/nightly')).json(); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of curiosity, will this be cleaner in the future if we start fetching the dlls from nuget instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like the LSP server to be one of the commands in the Dafny CLI, so you would need to install the nightly build of the CLI dotnet tool. Maybe |
||||||
if(result.name !== undefined) { | ||||||
const version = result.name.substring(6); | ||||||
return [ 'nightly', version ]; | ||||||
const name: string = result.name; | ||||||
const versionPrefix = 'Dafny '; | ||||||
if(name.startsWith(versionPrefix)) { | ||||||
const version = name.substring(versionPrefix.length); | ||||||
return [ 'nightly', version ]; | ||||||
} | ||||||
} | ||||||
window.showWarningMessage('Failed to install latest nightly version of Dafny'); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we are not going to expect this message very often, could you make it more meaningful like this?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But it's always undefined in this case right? Do you mean to put There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The path condition for this to happen is:
so if result.name is undefined, we'll see So not the whole result, only the name (which we could use to help troubleshooting). |
||||||
version = LanguageServerConstants.LatestVersion; | ||||||
} | ||||||
} | ||||||
|
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.
How about putting that information in the method name, then it doesn't go out of date so easily?
Do you want to rename
getConfiguredTagAndVersionUncached
togetConfiguredGitTagAndVersionUncached
?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.
Ok, yes, the fact that the tag is a git tag was important to me. Funny enough, when I was looking at the signature, I was trying to understand what the return type was without looking at the function's name, so I guessed it based on the function's content.