Repository: stateful/vscode-runme
Pull request #716 (2023-07-24 21:12:34)

Shebang UX tweaks
Getting it ready for pre-release.


Patch:
diff --git a/examples/README.md b/examples/README.md
index a4af62d0..35b2e446 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -47,12 +47,22 @@ node ./scripts/stdin.js
 
 ## Formatted Code Blocks
 
-You can also inline TypeScript or JavaScript:
+You can also execute JavaScript inline:
 
 ```js
-function attach() {
-    document.body.innerHTML += 'Hello world!'
+(function({ message }) {
+    console.log(message)
+})({ message: 'Running javascript that outputs this message' })
+```
+
+Or typescript:
+
+```typescript
+function unnest({ message }: { message: string }): void {
+    console.log(message)
 }
+
+unnest({ message: 'Running typescript that outputs this message' })
 ```
 
 ## Environment Variables
@@ -146,7 +156,7 @@ config:
 
 Non-shell scripts can also access environment variables, and are run from the current working directory:
 
-```sh
+```sh { interactive=false }
 export YOUR_NAME=enter your name
 ```
 
diff --git a/src/client/components/configuration/annotations.ts b/src/client/components/configuration/annotations.ts
index 34aa19b1..97c78abb 100644
--- a/src/client/components/configuration/annotations.ts
+++ b/src/client/components/configuration/annotations.ts
@@ -146,9 +146,8 @@ export class Annotations extends LitElement {
       docs: 'https://docs.runme.dev/configuration#cell-options',
     },
     interpreter: {
-      description: 'Script shebang line',
-      // FIXME: update docs link
-      docs: '',
+      description: 'Inserted into shebang (aka #!) line',
+      docs: 'https://docs.runme.dev/configuration#cell-options',
     },
     category: {
       description: 'Execute this code cell within a category.',
diff --git a/src/extension/runner.ts b/src/extension/runner.ts
index 86c52714..c17aa3e4 100644
--- a/src/extension/runner.ts
+++ b/src/extension/runner.ts
@@ -413,14 +413,18 @@ export class GrpcRunnerProgramSession implements IRunnerProgramSession {
     this.session.responses.onError((error) => {
       if (error instanceof RpcError) {
         if (error.message.includes('invalid LanguageId')) {
-          window.showErrorMessage(
+          // todo(sebastian): provide "Configure" button to trigger foldout
+          window.showWarningMessage(
             // eslint-disable-next-line max-len
-            'Unable to automatically execute cell. To execute this cell, set the "interpreter" field in the configuration foldout!'
+            'Not every language is automatically executable. You can set the "interpreter" field in the "Configure" foldout to define how this cell executes.'
           )
         }
 
         if (error.message.includes('invalid ProgramName')) {
-          window.showErrorMessage(`Unable to locate interpreter "${this.opts.programName}"`)
+          window.showErrorMessage(
+            // eslint-disable-next-line max-len
+            `Unable to locate interpreter "${this.opts.programName}" specified in shebang (aka #!). Please check the cell's "Configure" foldout.`
+          )
         }
 
         console.error(


Test patch:
diff --git a/tests/extension/runner.test.ts b/tests/extension/runner.test.ts
index 26337fd4..a18ca3e8 100644
--- a/tests/extension/runner.test.ts
+++ b/tests/extension/runner.test.ts
@@ -569,9 +569,9 @@ suite('grpc Runner', () => {
       const { duplex } = await createNewSession()
 
       duplex._onError.fire(new RpcError('invalid LanguageId'))
-      expect(window.showErrorMessage).toBeCalledTimes(1)
+      expect(window.showWarningMessage).toBeCalledTimes(1)
 
-      vi.mocked(window.showErrorMessage).mockClear()
+      vi.mocked(window.showWarningMessage).mockClear()
 
       duplex._onError.fire(new RpcError('invalid ProgramName'))
       expect(window.showErrorMessage).toBeCalledTimes(1)