-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1807 from microsoft/connor4312/wasm-14
feat: prompt to install extension on wasm step
- Loading branch information
Showing
21 changed files
with
836 additions
and
213 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/*--------------------------------------------------------- | ||
* Copyright (C) Microsoft Corporation. All rights reserved. | ||
*--------------------------------------------------------*/ | ||
|
||
export const IDwarfModuleProvider = Symbol('IDwarfModuleProvider'); | ||
|
||
export interface IDwarfModuleProvider { | ||
/** | ||
* Loads the dwarf module if it exists. | ||
*/ | ||
load(): Promise<typeof import('@vscode/dwarf-debugging') | undefined>; | ||
|
||
/** | ||
* Prompts the user to install the dwarf module (called if the module is | ||
* not installed.) | ||
*/ | ||
prompt(): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/*--------------------------------------------------------- | ||
* Copyright (C) Microsoft Corporation. All rights reserved. | ||
*--------------------------------------------------------*/ | ||
|
||
import type * as dwf from '@vscode/dwarf-debugging'; | ||
import * as l10n from '@vscode/l10n'; | ||
import { inject, injectable } from 'inversify'; | ||
import Dap from '../../dap/api'; | ||
import { IDapApi } from '../../dap/connection'; | ||
import { IDwarfModuleProvider } from './dwarfModuleProvider'; | ||
|
||
const name = '@vscode/dwarf-debugging'; | ||
|
||
@injectable() | ||
export class DwarfModuleProvider implements IDwarfModuleProvider { | ||
private didPrompt = false; | ||
|
||
constructor(@inject(IDapApi) private readonly dap: Dap.Api) {} | ||
|
||
public async load(): Promise<typeof dwf | undefined> { | ||
try { | ||
return await import(name); | ||
} catch { | ||
return undefined; | ||
} | ||
} | ||
|
||
public prompt() { | ||
if (!this.didPrompt) { | ||
this.didPrompt = true; | ||
this.dap.output({ | ||
output: l10n.t( | ||
'You may install the `{}` module via npm for enhanced WebAssembly debugging', | ||
name, | ||
), | ||
category: 'console', | ||
}); | ||
} | ||
} | ||
} |
Oops, something went wrong.