diff --git a/vs-code-extension/client/src/extension.ts b/vs-code-extension/client/src/extension.ts index e41a8a91..ff7e9226 100644 --- a/vs-code-extension/client/src/extension.ts +++ b/vs-code-extension/client/src/extension.ts @@ -12,7 +12,6 @@ import { getConfigurationMap, getConfigurationValueFor, resetConfigurations, set import { appendPath, getCobolCheckRunArgumentsBasedOnCurrentFile, getCobolProgramPathForGivenContext, getCurrentProgramName, getFileName, getTextFromFile, getRootFolder, getSourceFolderContextPath, runCobolCheck, getIsInsideTestSuiteDirectory1, getOS, getFileSeperatorForOS } from './services/CobolCheckLauncher'; import { startCutLanguageClientServer, stopCutLanguageClientServer } from './services/cutLanguageClientServerSetup'; -import { ResultWebView } from './services/ResultWebView'; import { handleCobolCheckOut } from './Helpers/ExtensionHelper'; import path = require('path'); import { getContentFromFilesystem, MarkdownTestData, TestCase, testData, TestFile, TestHeading } from "./services/TestTree"; @@ -28,15 +27,11 @@ let currentPlatform = getOS(); export async function activate(context: ExtensionContext) { startCutLanguageClientServer(context); - const provider = new ResultWebView(context.extensionUri); const ctrl = vscode.tests.createTestController('CobolCheckController', 'Cobol Check'); context.subscriptions.push(ctrl); const fileChangedEmitter = new vscode.EventEmitter(); - context.subscriptions.push( - vscode.window.registerWebviewViewProvider(ResultWebView.viewType, provider)); - let runCobolCheck_Cmd = vscode.commands.registerCommand('cobolcheck.run', () => { //Setting loader vscode.window.withProgress({location: vscode.ProgressLocation.Notification, cancellable: true, title: 'Cobol Check running:'}, diff --git a/vs-code-extension/client/src/services/ResultWebView.ts b/vs-code-extension/client/src/services/ResultWebView.ts deleted file mode 100644 index ffb23106..00000000 --- a/vs-code-extension/client/src/services/ResultWebView.ts +++ /dev/null @@ -1,96 +0,0 @@ -import * as vscode from 'vscode'; - -export class ResultWebView implements vscode.WebviewViewProvider { - - public static readonly viewType = 'cobolcheck-result'; - - private _view?: vscode.WebviewView; - - constructor( - private readonly _extensionUri: vscode.Uri, - ) { } - - public resolveWebviewView( - webviewView: vscode.WebviewView, - context: vscode.WebviewViewResolveContext, - _token: vscode.CancellationToken, - ) { - this._view = webviewView; - - webviewView.webview.options = { - // Allow scripts in the webview - enableScripts: true, - - localResourceRoots: [ - this._extensionUri - ] - }; - - webviewView.webview.html = this._getHtmlForWebview(webviewView.webview); - - webviewView.webview.onDidReceiveMessage( async data => { - switch (data.type) { - case 'command': - { - let success = await vscode.commands.executeCommand(data.value); - break; - } - } - }); - } - - public showTestResult(testResult : string) { - if (this._view) { - this._view.show?.(true); // `show` is not implemented in 1.49 but is for 1.50 insiders - let splittedString = testResult.split("================================================="); - if (splittedString.length > 0) - this._view.webview.postMessage({ type: 'test-result', value: splittedString[0] }); - } - } - - private _getHtmlForWebview(webview: vscode.Webview) { - // Get the local path to main script run in the webview, then convert it to a uri we can use in the webview. - const scriptUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'media', 'main.js')); - - // Do the same for the stylesheet. - const styleResetUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'media', 'reset.css')); - const styleVSCodeUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'media', 'vscode.css')); - const styleMainUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'media', 'main.css')); - - // Use a nonce to only allow a specific script to be run. - const nonce = this.getNonce(); - - return ` - - - - - - - - - - - Result - - - - - - - `; - } - - private getNonce() { - let text = ''; - const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; - for (let i = 0; i < 32; i++) { - text += possible.charAt(Math.floor(Math.random() * possible.length)); - } - return text; - } -} \ No newline at end of file diff --git a/vs-code-extension/package.json b/vs-code-extension/package.json index 4db144af..08d65c20 100644 --- a/vs-code-extension/package.json +++ b/vs-code-extension/package.json @@ -18,26 +18,7 @@ ], "main": "./client/out/extension", "contributes": { - "viewsContainers": { - "activitybar": [ - { - "id": "cobol-check", - "title": "Cobol Check", - "icon": "images/cobol-check-logo-white-small.png" - } - ] - }, - "views": { - "cobol-check": [ - { - "type": "webview", - "id": "cobolcheck-result", - "name": "Results" - } - ] - }, - "languages": [ - { + "languages": [ { "id": "cut", "aliases": [ "COBOL unit test",