From df25c554baebfcdd5a4c92ff583c08c32a29c5c3 Mon Sep 17 00:00:00 2001 From: m-g-k Date: Mon, 16 Apr 2018 14:42:29 +0100 Subject: [PATCH] Fix vscode issue with missing OutputConsole (#69) * Fix vscode issue with missing OutputConsole Signed-off-by: m-g-k * Fix tests in Travis Signed-off-by: m-g-k --- client/.gitignore | 5 ++++- client/.vscode/tasks.json | 15 +++++++++++++++ client/package.json | 4 +++- client/src/extension.ts | 10 ++++++---- client/test/extension.test.ts | 16 ++++++++-------- server/.gitignore | 4 +++- server/package.json | 9 +++++---- 7 files changed, 44 insertions(+), 19 deletions(-) diff --git a/client/.gitignore b/client/.gitignore index abb5ea0..0daf6f9 100755 --- a/client/.gitignore +++ b/client/.gitignore @@ -12,4 +12,7 @@ out server node_modules -*.vsix \ No newline at end of file +*.vsix +.nyc_output +.vscode-test +coverage \ No newline at end of file diff --git a/client/.vscode/tasks.json b/client/.vscode/tasks.json index 84c249e..d651775 100755 --- a/client/.vscode/tasks.json +++ b/client/.vscode/tasks.json @@ -46,6 +46,21 @@ "reveal": "never" }, "problemMatcher": [] + }, + { + "type": "npm", + "script": "lint", + "problemMatcher": [ + "$tsc" + ] + }, + { + "type": "npm", + "script": "lint", + "path": "server/", + "problemMatcher": [ + "$tsc" + ] } ] } \ No newline at end of file diff --git a/client/package.json b/client/package.json index 277771f..38266fa 100755 --- a/client/package.json +++ b/client/package.json @@ -309,7 +309,9 @@ "exact_paths": [ "node_modules", "out", - "server" + "server", + ".vscode-test", + "coverage" ], "file_type_method": "EXCLUDE", "file_types": [ diff --git a/client/src/extension.ts b/client/src/extension.ts index fcdb842..a08d42e 100755 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -18,13 +18,13 @@ import * as fs from 'fs'; import * as os from 'os'; import { spawn } from 'child_process'; -import { workspace, commands, Disposable, ExtensionContext, window, WorkspaceConfiguration, TextDocumentChangeEvent, TextDocumentContentChangeEvent, Range, Position, Uri, TextDocumentShowOptions, ViewColumn, extensions } from 'vscode'; +import { workspace, commands, Disposable, ExtensionContext, OutputChannel, window, WorkspaceConfiguration, TextDocumentChangeEvent, TextDocumentContentChangeEvent, Range, Position, Uri, TextDocumentShowOptions, ViewColumn, extensions } from 'vscode'; import { LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, TransportKind, NotificationType, Code2ProtocolConverter, DidChangeTextDocumentParams } from 'vscode-languageclient'; let client: LanguageClient = null; export function activate(context: ExtensionContext) { - // console.log('CLIENT activate!!!'); + // console.log('CLIENT activate!!!'); const disposable3 = workspace.onDidChangeConfiguration((params) => { // console.log(`CLIENT onDidChangeConfiguration ${JSON.stringify(params)}`); //debug @@ -33,7 +33,8 @@ export function activate(context: ExtensionContext) { context.subscriptions.push(disposable3); // The server is implemented in node - const serverModule = context.asAbsolutePath(path.join('server', 'server.js')); + const serverModule = context.asAbsolutePath(path.join('server/src', 'server.js')); + const outputChannel: OutputChannel = window.createOutputChannel('Hyperledger Composer'); // The debug options for the server const debugOptions = { execArgv: ['--nolazy', '--inspect=6009'] }; @@ -54,7 +55,8 @@ export function activate(context: ExtensionContext) { configurationSection: 'composer', // Notify the server about file changes to '.clientrc files contain in the workspace // fileEvents: workspace.createFileSystemWatcher('**/.clientrc') - } + }, + outputChannel: outputChannel }; // Create the language client and start the client. diff --git a/client/test/extension.test.ts b/client/test/extension.test.ts index 215cbc5..84867b5 100755 --- a/client/test/extension.test.ts +++ b/client/test/extension.test.ts @@ -30,21 +30,21 @@ suite('Extension Tests', () => { const uri = vscode.Uri.file(path.join(rootPath, '../test/data/valid/cto/test.cto')); workspace.openTextDocument(uri).then((document) => { - const text = document.getText(); - assert.equal(document.languageId, 'composer'); - assert.ok(document.lineCount === 41); + const text = document.getText(); + assert.equal(document.languageId, 'composer'); + assert.ok(document.lineCount === 41); }); }); test('activate should return an acl file when open an acl file', () => { - const uri = vscode.Uri.file(path.join(rootPath, '../test/data/valid/acl/permissions.acl')); + const uri = vscode.Uri.file(path.join(rootPath, '../test/data/valid/acl/permissions.acl')); - workspace.openTextDocument(uri).then((document) => { - const text = document.getText(); - assert.equal(document.languageId, 'composer-acl'); - assert.ok(document.lineCount === 34); + workspace.openTextDocument(uri).then((document) => { + const text = document.getText(); + assert.equal(document.languageId, 'composer-acl'); + assert.ok(document.lineCount === 48); }); }); }); diff --git a/server/.gitignore b/server/.gitignore index 29f9bd8..bce97d5 100755 --- a/server/.gitignore +++ b/server/.gitignore @@ -11,4 +11,6 @@ # limitations under the License. out -node_modules \ No newline at end of file +node_modules +.nyc_output +coverage \ No newline at end of file diff --git a/server/package.json b/server/package.json index e68dd28..2a2664e 100755 --- a/server/package.json +++ b/server/package.json @@ -13,21 +13,22 @@ "url": "https://github.com/hyperledger/composer-vscode-plugin" }, "dependencies": { - "composer-common": "latest", + "composer-common": "0.19.1", "vscode-languageserver": "3.3.0", "vscode-uri": "1.0.1" }, "devDependencies": { "@types/mocha": "^2.2.33", - "@types/node": "^6.0.52", + "@types/node": "^6.0.106", "chai": "^4.1.2", - "mocha": "^5.0.0", + "mocha": "^5.1.0", "nyc": "^11.4.1", "source-map-support": "^0.5.3", "ts-node": "^4.1.0", "tslint": "^5.9.1", "tslint-loader": "^3.5.3", - "typescript": "^2.6.2" + "typescript": "^2.6.2", + "license-check-and-add": "^2.3.1" }, "scripts": { "install:server": "installServerIntoExtension ../client ./package.json ./tsconfig.json",