最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

visual studio code - Passing data to a VSCode extension running in an instance that was started on demand with serve-web - Stack

matteradmin6PV0评论

I'm spinning up VSCode serve-web instances on demand. Each includes an extension (which I've written) that connect to a central signalr endpoint. Not every browser tab gets a new vscode instance, so two browser tabs may use the same vscode serve-web instance.
To give each editor in a browser tab a unique id, it is not enough to pass a generated id to the vscode serve-web instance and since it may serve more than one browser tab.
The api has the vscode.env.sessionId variable which would work as a unique id but it still falls short because by the time I have access to it (i.e. the editor is opened in a tab), I won't be able to reliably match the new instance to the original on demand request. (I'm currently just assuming it is the newest signalr connection.)

I hope the following makes my problem a bit easier to understand:

To try and solve this problem, I added another query parameter to the editor url (i.e. &EditorId=<NewGuid>) and tried to get that parameter in the extension. But I've had no luck accessing that information in the extension.

Is it possible to get the EditorId query parameter in a vscode extension, or achieve the same by other means?

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far