Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Commit

Permalink
Fix vscode issue with missing OutputConsole (#69)
Browse files Browse the repository at this point in the history
* Fix vscode issue with missing OutputConsole

Signed-off-by: m-g-k <mgk@uk.ibm.com>

* Fix tests in Travis

Signed-off-by: m-g-k <mgk@uk.ibm.com>
  • Loading branch information
m-g-k authored and mbwhite committed Apr 16, 2018
1 parent c77f01a commit df25c55
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 19 deletions.
5 changes: 4 additions & 1 deletion client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
out
server
node_modules
*.vsix
*.vsix
.nyc_output
.vscode-test
coverage
15 changes: 15 additions & 0 deletions client/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@
"reveal": "never"
},
"problemMatcher": []
},
{
"type": "npm",
"script": "lint",
"problemMatcher": [
"$tsc"
]
},
{
"type": "npm",
"script": "lint",
"path": "server/",
"problemMatcher": [
"$tsc"
]
}
]
}
4 changes: 3 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@
"exact_paths": [
"node_modules",
"out",
"server"
"server",
".vscode-test",
"coverage"
],
"file_type_method": "EXCLUDE",
"file_types": [
Expand Down
10 changes: 6 additions & 4 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'] };
Expand All @@ -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.
Expand Down
16 changes: 8 additions & 8 deletions client/test/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});
4 changes: 3 additions & 1 deletion server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@
# limitations under the License.

out
node_modules
node_modules
.nyc_output
coverage
9 changes: 5 additions & 4 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit df25c55

Please sign in to comment.