-
Notifications
You must be signed in to change notification settings - Fork 133
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
Support for new Python language model #3235
Conversation
{ label: ProjectLanguage.Python }, | ||
{ label: ProjectLanguage.TypeScript }, | ||
{ label: ProjectLanguage.Custom } | ||
const languagePicks: IAzureQuickPickItem<{ language: ProjectLanguage, model?: number }>[] = [ |
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 { language: ProjectLanguage, model?: number }
"type" is used in a couple places; it might benefit from a proper type definition.
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, if I see it in one more place, I promise to do so. :-)
src/commands/createNewProject/ProjectCreateStep/PythonProjectCreateStep.ts
Outdated
Show resolved
Hide resolved
src/commands/createFunction/scriptSteps/PythonFunctionCreateStep.ts
Outdated
Show resolved
Hide resolved
src/commands/createNewProject/ProjectCreateStep/PythonProjectCreateStep.ts
Outdated
Show resolved
Hide resolved
src/commands/createNewProject/ProjectCreateStep/PythonProjectCreateStep.ts
Outdated
Show resolved
Hide resolved
I like the auto open markdown feature, really cool (and tricky to implement IIRC) that it grabs the markdown file from the template and displays it rendered. I wish we could do something similar with walkthroughs, ex: spawn a walkthrough from a markdown file, or maybe a special walkthrough.json file. Could be really useful for templates, samples, etc. |
When I append a new function to a file, it's not smart about making sure the new function name is unique. Sounds like it's out of scope for the time being. But something we might revisit later. |
Yes, it is exactly things of that sort that require a robust language service in order to solve, but which take time we didn't think we had for this initial preview. Even then it's likely to result in a long tail of possible code structure to try to cover. |
It's admittedly a hack (in particular, to support VS Code's need to reopen the document on a new file) to avoid having to manage a local disk cache), but I think it will work well enough for most cases. |
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 is no way to pass an argument to change the default trigger names right now since everything is static content in the backupTemplates, right?
I was surprised by the lack of prompt steps, but I'm assuming when the template feed is actually serving the templates, that there will be a way to pass in parameters for starting names and other properties similar to the other templates?
NOTE: I left a comment in the templates.json
but it might be annoying to view due to the size of that file so I'll leave it here as well:
Alex mentioned that the
host.json
can't contain theextensionBundle
property in order to debug (and you have denoted as such in the code.) I noticed that all the templates have host.jsons that include it by default, so whenever you create a new trigger, it automatically updates thehost.json
to include the property again.
src/commands/createNewProject/ProjectCreateStep/PysteinProjectCreateStep.ts
Outdated
Show resolved
Hide resolved
src/commands/createNewProject/ProjectCreateStep/PysteinProjectCreateStep.ts
Outdated
Show resolved
Hide resolved
|
||
export class PythonScriptStep extends AzureWizardPromptStep<IPythonFunctionWizardContext> { | ||
public async prompt(wizardContext: IPythonFunctionWizardContext): Promise<void> { | ||
const entries = await vscode.workspace.fs.readDirectory(vscode.Uri.file(wizardContext.projectPath)); |
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.
AzExtFsExtra
does have a readDirectory()
command though the return types are a little bit different.
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.
Noted, though I'd prefer to use the VS Code APIs when available (and reasonably convenient). If anything, it makes it easier for the extension to support their new remote host/filesystem scenarios. (Yes, there are lots of other things that wouldn't work for Functions in those scenarios, but still...)
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.
Well, under the hood, AzExtFsExtra is using all VS Code APIs which was the whole point of this PR.
It just offers some QOL, like not having to wrap projectPath with vscode.Uri.file()
, but definitely not a ship blocker or anything.
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.
Ah, ok, I see, then forget everything I said! For some reason I thought AzExtFsExtra
was still using fs
under the hood. :-) Eh, in this particular case I find direct use of the VS Code API easier to read than using the wrapper. I could go either way.
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'm good to approve this. I kind of want to merge this sooner so we can start to get CTI doing test passes on it, but I'd understand wanting to wait for Brandon to rise from the dead to give it a thorough review. 🧟
@nturinski Agreed that this initial preview is limited in scope with respect to customization of the template (i.e. there effectively is none). To do it properly requires more than just token replacement in the added function source, as there may be other changes needed elsewhere (e.g. new imports, validation against existing function names, etc., and, in particular, when they introduce PyStein's "blueprints"). We really need a robust language service that allows source manipulation a la Roslyn, and I'm not sure we have that now (and our time frame didn't really allow it in any case). This is one reason we're trying to lean on the "inline" documentation in the function templates, to help users understand what needs to change in order to add new functions. |
@@ -19,6 +20,16 @@ import { showMarkdownPreviewFile } from '../../../utils/textUtils'; | |||
|
|||
const gettingStartedFileName = 'getting_started.md'; | |||
|
|||
async function fileExists(uri: vscode.Uri): Promise<boolean> { |
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.
You could use this to save some lines, though I will go back and add a fileExists
utility function later.
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.
You would also not have to wrap the file paths with Uri.file()
as well.
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.
Doesn't stat()
throw if the file doesn't exist?
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.
Oh, wait, never mind, I see what you mean now.
Agree that I'd like CTI taking a look and making sure I didn't horribly break the existing scenarios. @bwateratmsft did an early review of the draft PR, but I'm happy for him to tear it apart further when he's back next week (and I'm out). I can then clean up when I get back. |
I took a brief look at the changes since my review and didn't see anything that concerned me. Agree, getting it in sooner than later is a good idea so CTI can take a look. Thanks! |
Adds support for the new Python language model, where bindings are attributes within the application code rather than in separate JSON files.