Skip to content

Commit c6949ea

Browse files
authored
In memory file system (microsoft#801)
If we want to enable users to click a link and land on vscode.dev with code passed in the URL, we'll need some type of in memory file system for it. This is an outline for that. For now, I've wired it in with a simple command to open all our sample algorithms in a kind of sandbox (so you can play around with them, change, debug, etc. all without being backed by files on a disk or a repo. Any changes are lost when you close it). It does look like you're expected to vendor in your own in-memory file system implementation, even though this is a common feature. (I'm discussing with the VS Code team to confirm, and have the question at https://stackoverflow.com/questions/77312576/in-memory-file-system-for-vs-code-extension ). I'll update if there's a simpler approach.
1 parent 70b107c commit c6949ea

12 files changed

+517
-1
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
* text eol=lf
2+
*.png binary

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ __pycache__/
44
.DS_Store
55
.vscode/*
66
.vscode-test-web/
7+
*.pem
78
!.vscode/*.shared.json
89
!.vscode/extensions.json
910
/fuzz/target

vscode/package.json

+86-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
"description": "Q# Language Support",
55
"version": "0.0.0",
66
"publisher": "quantum",
7+
"icon": "resources/qdk.png",
8+
"galleryBanner": {
9+
"color": "#252526",
10+
"theme": "dark"
11+
},
712
"type": "commonjs",
813
"engines": {
914
"vscode": "^1.77.0"
@@ -18,9 +23,75 @@
1823
"onNotebook:jupyter-notebook",
1924
"onDebug",
2025
"onDebugResolve:qsharp",
21-
"onDebugDynamicConfigurations:qsharp"
26+
"onDebugDynamicConfigurations:qsharp",
27+
"onFileSystem:qsharp-vfs"
2228
],
2329
"contributes": {
30+
"walkthroughs": [
31+
{
32+
"id": "qsharp-vscode.welcome",
33+
"title": "The Azure Quantum Development Kit",
34+
"description": "Getting started with the Azure Quantum Development Kit in VS Code",
35+
"steps": [
36+
{
37+
"id": "qsharp-vscode.welcome.editor",
38+
"title": "Welcome to the Azure Quantum Development Kit",
39+
"description": "The Azure Quantum Development Kit (QDK) is an open-source SDK that you can use to write quantum programs and execute them on quantum hardware. This walkthrough will show you how to get started with the Azure Quantum Development Kit in VS Code.\n\nThe QDK gives you rich editor support for writing quantum programs in the Q# language, such as error checking, signature help, completion lists, safely renaming identifiers, and much more.",
40+
"media": {
41+
"image": "resources/intellisense.png",
42+
"altText": "Intellisense"
43+
}
44+
},
45+
{
46+
"id": "qsharp-vscode.welcome.debug",
47+
"title": "Debug Q# code",
48+
"description": "With your Q# code open in the editor, use the F5 shortcut or the top right icons in the code edtior to run or debug the code.",
49+
"media": {
50+
"image": "resources/debug.png",
51+
"altText": "Debug"
52+
}
53+
},
54+
{
55+
"id": "qsharp-vscode.welcome.simulator",
56+
"title": "Run quantum simulations",
57+
"description": "You can run quantum simulations directly in VS Code and see the program output in the integrated terminal.",
58+
"media": {
59+
"image": "resources/console.png",
60+
"altText": "Console"
61+
}
62+
},
63+
{
64+
"id": "qsharp-vscode.welcome.submit",
65+
"title": "Run on Azure Quantum",
66+
"description": "If you have an Azure subscription, you can connect to your Azure Quantum workspace and submit your Q# program directly to quantum hardware",
67+
"media": {
68+
"image": "resources/submit.png",
69+
"altText": "Submit to Azure"
70+
}
71+
},
72+
{
73+
"id": "qsharp-vscode.welcome.starters",
74+
"title": "Starting points",
75+
"description": "Expore Q# safely by opening files in the [Q# playground](command:qsharp-vscode.openPlayground), or work in Python by [creating a Jupyter Notebook](command:qsharp-vscode.createNotebook) from a template",
76+
"media": {
77+
"image": "resources/notebook.png",
78+
"altText": "Jupyter Notebooks"
79+
}
80+
}
81+
]
82+
}
83+
],
84+
"webOpener": {
85+
"scheme": "qsharp-vfs",
86+
"runCommands": [
87+
{
88+
"command": "qsharp-vscode.webOpener",
89+
"args": [
90+
"$url"
91+
]
92+
}
93+
]
94+
},
2495
"configuration": {
2596
"title": "Q#",
2697
"properties": {
@@ -88,6 +159,10 @@
88159
{
89160
"command": "qsharp-vscode.setTargetProfile",
90161
"when": "resourceLangId == qsharp"
162+
},
163+
{
164+
"command": "qsharp-vscode.webOpener",
165+
"when": "false"
91166
}
92167
],
93168
"view/title": [
@@ -143,6 +218,11 @@
143218
}
144219
],
145220
"commands": [
221+
{
222+
"command": "qsharp-vscode.webOpener",
223+
"title": "Internal web opener",
224+
"category": "Q#"
225+
},
146226
{
147227
"command": "qsharp-vscode.debugEditorContents",
148228
"title": "Debug Q# file",
@@ -212,6 +292,11 @@
212292
"command": "qsharp-vscode.createNotebook",
213293
"category": "Q#",
214294
"title": "Create an Azure Quantum notebook"
295+
},
296+
{
297+
"command": "qsharp-vscode.openPlayground",
298+
"category": "Q#",
299+
"title": "Open Q# playground"
215300
}
216301
],
217302
"breakpoints": [

vscode/resources/console.png

93 KB
Loading

vscode/resources/debug.png

101 KB
Loading

vscode/resources/intellisense.png

152 KB
Loading

vscode/resources/notebook.png

132 KB
Loading

vscode/resources/qdk.png

26.5 KB
Loading

vscode/resources/qdk.svg

+8
Loading

vscode/resources/submit.png

128 KB
Loading

vscode/src/extension.ts

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { initCodegen } from "./qirGeneration.js";
3030
import { activateTargetProfileStatusBarItem } from "./statusbar.js";
3131
import { createSignatureHelpProvider } from "./signature.js";
3232
import { createRenameProvider } from "./rename.js";
33+
import { initFileSystem } from "./memfs.js";
3334

3435
export async function activate(context: vscode.ExtensionContext) {
3536
initializeLogger();
@@ -57,6 +58,7 @@ export async function activate(context: vscode.ExtensionContext) {
5758
initCodegen(context);
5859
activateDebugger(context);
5960
registerCreateNotebookCommand(context);
61+
initFileSystem(context);
6062

6163
log.info("Q# extension activated.");
6264
}

0 commit comments

Comments
 (0)