-
Notifications
You must be signed in to change notification settings - Fork 108
Support functions in View()
#8262
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
Changes from all commits
cd51b49
ac4c9b2
46da06d
80ace2f
337607d
6264530
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 |
---|---|---|
|
@@ -281,14 +281,14 @@ export class ExtHostMethods implements extHostProtocol.ExtHostMethodsShape { | |
} | ||
|
||
async createDocument(contents: string, languageId: string): Promise<null> { | ||
|
||
const uri = await this.documents.createDocumentData({ | ||
content: contents, language: languageId | ||
content: contents, | ||
language: languageId, | ||
}); | ||
const documentData = await this.documents.ensureDocumentData(uri); | ||
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. This is just a small cleanup to use |
||
|
||
const opts: TextEditorOpenOptions = { preview: true }; | ||
this.documents.ensureDocumentData(uri).then(documentData => { | ||
this.editors.showTextDocument(documentData.document, opts); | ||
}); | ||
await this.editors.showTextDocument(documentData.document, opts); | ||
|
||
// TODO: Return a document ID | ||
return null; | ||
|
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 do you think about including the URI and error in the document body, or showing it in a notification, so it's easier to diagnose without digging into logs?
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 thought about that but I worried about making this less user friendly. The main question is whether this should be considered a regular UI message or an exceptional one that warrants presenting debug info to the user.
It would probably be fine to do the latter for now, but if we ever have vdocs representing transient objects with good lifecycle management (vdoc goes out of scope with the object they represent), then this error message would be a normal part of the user experience.
I plan to reuse this mechanism for the fallback vdocs of the debugger. Currently they are managed via DAP and a big downside is that the names of these editors don't have a
.R
extension and Positron doesn't activate R language support in these editors. By usingark:
URIs pointing to documents fully managed by Ark, we'll have better control. Unlike the documents created byView()
, these documents will be cleaned up, when the debugging session ends. So users might start seeing this message more regularly (not entirely sure, maybe that will only be the case if we notify the frontend provider that the document has been updated).