Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleted X-UA-Compatible meta tag #21

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
110e14b
Temporarily remove the node version check
bryphe Mar 12, 2019
7a1607f
Remove stdio disabling
bryphe Mar 12, 2019
13cf908
Disable pre-commit hook
bryphe Mar 12, 2019
c0cef79
Add new deps, stub out tests
bryphe Mar 12, 2019
581403c
Tweak build
bryphe Mar 12, 2019
88a7cab
Fix typo
bryphe Mar 12, 2019
931d106
Tweak build
bryphe Mar 12, 2019
cc1d757
Build: Get CI green (#1)
bryphe Mar 12, 2019
d63bb39
CI - Test: Extension host sends 'initialized' message via json-rpc (#2)
bryphe Mar 14, 2019
7b4a651
Initial extension activation (#3)
bryphe Mar 19, 2019
d9b3c57
Clean up tests (#4)
bryphe Mar 19, 2019
f46d93a
Test: Validate command execution works as expected (#5)
bryphe Mar 19, 2019
cfb6026
Test: Add case for document open / close (#6)
bryphe Mar 20, 2019
38781b5
Add a test case for document change event (#7)
bryphe Mar 20, 2019
051b81f
Publish 'vscode-exthost' package (#8)
bryphe Mar 22, 2019
ac90bfe
Dependency: Remove SQLite dependency (#11)
bryphe Apr 17, 2019
cfc065d
Test Case: Basic LSP sample (#10)
bryphe Apr 17, 2019
14b22f7
Test Case: Activation Events (#12)
bryphe Apr 17, 2019
e0e81bc
use string undefined
sandy081 Mar 12, 2019
a25f426
Fixes for newer jest
bryphe Nov 13, 2019
325f3fd
Completions: Initial test case (#13)
bryphe Nov 13, 2019
251aabc
Script
bryphe Nov 13, 2019
c66cb9a
Exercise failure case with textDocumentPosition, and fix in test (#16)
bryphe Nov 29, 2019
08bb9e9
Bugfix - TypeScript support: Disable proposed extensions api (#17)
bryphe Nov 30, 2019
ec6827e
Test - API - Workspace: Add test case for getting workspace.rootPath …
bryphe Dec 2, 2019
4ba2d4c
API - Configuration: Add test case for setting initial config / chang…
bryphe Dec 2, 2019
952a57d
1.33.4
bryphe Dec 4, 2019
febdfc8
Terminal: Bring back / enable TerminalService API (#20)
bryphe Jan 17, 2020
8ebec04
1.33.5
bryphe Jan 18, 2020
74dceb6
Deleted X-UA-Compatible meta tag
Feb 2, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ coverage/
test_data/
test-results/
yarn-error.log
_package/
3 changes: 0 additions & 3 deletions .yarnrc

This file was deleted.

219 changes: 219 additions & 0 deletions __sandbox__/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
const cp = require("child_process");
const fs = require("fs");
const path = require("path");
const rpc = require("vscode-jsonrpc");

let bootstrapForkPath = path.join(__dirname, "..", "out", "bootstrap-fork.js");

// test("extension host process gets initialized", async () => {

let run = async () => {

let childProcess = cp.spawn("node", [bootstrapForkPath, "--type=extensionHost"], {
env: {
...process.env,
"AMD_ENTRYPOINT": "vs/workbench/services/extensions/node/extensionHostProcess",
},
stdio: ["pipe", "pipe", "inherit"]
});

let connection = rpc.createMessageConnection(
new rpc.StreamMessageReader(childProcess.stdout),
new rpc.StreamMessageWriter(childProcess.stdin)
);

let promise = new Promise((c) => {

let testNotification = new rpc.NotificationType('host/msg');
connection.onNotification(testNotification, (msg) => {
console.log("INCOMING MESSAGE: " + JSON.stringify(msg));

let message = msg;
if (message.reqId > 0) {
connection.sendNotification('ext/msg', {
type: 12, /*ReplyOKJSON */
reqId: message.reqId,
payload: null,
});
}

c();
});

});
connection.listen();

let extensionPath = path.join(__dirname, "..", "test_extensions", "oni-lsp-extension", "package.json")
let testExtension = JSON.parse(fs.readFileSync(extensionPath));

testExtension.main = path.join(path.dirname(extensionPath), testExtension.main);

let extMessage = new rpc.NotificationType('ext/msg');
connection.sendNotification(extMessage, {
type: 0,
reqId: 1,
payload: {
// extensions: [],
extensions: [{
...testExtension,
identifier: "lsp-sample",
extensionLocationPath: path.dirname(extensionPath),
}],
parentPid: process.pid,
environment: {
globalStorageHomePath: require("os").tmpdir(),
},
workspace: {},
logsLocationPath: require("os").tmpdir(),
autoStart: true,
}
});

connection.sendNotification(extMessage, {
type: 4, /* RequestJSONArgs */
reqId: 2,
payload: ["ExtHostConfiguration", "$initializeConfiguration", [{
defaults: {
contents: {
suggest: {
enabled: true
},
terminal: {
integrated: {
env: {
windows: {},
linux: {},
osx: {},
}
}
}
},
keys: ["suggest.enabled", "terminal.integrated"],
overrides: [],
},
user: {},
workspace: {},
folders: {},
isComplete: true,
configurationScopes: {},

}]],
});

connection.sendNotification(extMessage, {
type: 4, /* RequestJSONArgs */
reqId: 2,
payload: ["ExtHostWorkspace", "$initializeWorkspace", [{
id: "workspace-test",
name: "workspace-test",
configuration: null,
folders: [],
}]],
});

await promise;
// setTimeout(() => {
// connection.sendNotification(extMessage, {
// type: 4,
// reqId: 3,
// payload: ["ExtHostCommands", "$executeContributedCommand", ["extension.helloWorld"]],
// });
// }, 1000);


setTimeout(() => {

console.log("SENDING MESSAGE");
connection.sendNotification(extMessage, {
type: 4,
reqId: 3,
payload: ["ExtHostTerminalService", "$createProcess", [
1, {
name: "Terminal 1",
executable: "/non-existent-item",
args: [],
},{
//scheme: "file",
//path: "/Users/bryphe"
},
20,
20
]]
});
connection.sendNotification(extMessage, {
type: 4,
reqId: 3,
payload: ["ExtHostTerminalService", "$acceptProcessInput", [
1, "git status\n"
]]
});
}, 2000);

let testModelAdded = {
uri: {
scheme: "file",
path: "D:/test1.txt",
},
lines: ["hello", "world"],
EOL: "\n",
modeId: "plaintext",
isDirty: true,
};

let update = {
removedDocuments: [],
addedDocuments: [testModelAdded],
removedEditors: [],
addedEditors: [],
newActiveEditor: null,
};


/*setTimeout(() => {
connection.sendNotification(extMessage, {
type: 4,
reqId: 3,
payload: ["ExtHostDocumentsAndEditors", "$acceptDocumentsAndEditorsDelta", [update]],
});
}, 1000);
setTimeout(() => {

let changedEvent = {
changes: [{
range: {
startLineNumber: 1,
endLineNumber: 1,
startColumn: 1,
endColumn: 6,
},
text: "GREETINGS",
}],
eol: "\n",
versionId: 100,
};

connection.sendNotification(extMessage, {
type: 4,
reqId: 4,
payload: ["ExtHostDocuments", "$acceptModelChanged", [
testModelAdded.uri,
changedEvent,
true,
]],
});
}, 2000);*/

let closePromise = new Promise((c) => {
connection.onClose(() => c());
})

// connection.sendNotification(extMessage, {
// type: 1,
// payload: null,
// });

await closePromise;
};

run();
// }, 10000);
73 changes: 73 additions & 0 deletions __tests__/Activation.Test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import * as path from "path";

import * as ExtensionHost from "./ExtensionHost";

let extensionPath = path.join(__dirname, "..", "test_extensions", "oni-api-tests", "package.json");
let activationExtensionPath = path.join(__dirname, "..", "test_extensions", "oni-activation-events-tests", "package.json");

describe("activation", () => {
test("get activation event for '*' activation type", async () => {
await ExtensionHost.withExtensionHost([extensionPath], async (api) => {
let promise = new Promise((c) => {

api.onMessage.subscribe(msg => {
const { payload } = msg;

if(payload.methodName == "$onDidActivateExtension") {
console.dir(payload);
c();
}
});

});

await api.start();

await promise;
});
});

test("activates in response to onLanguage event", async () => {
await ExtensionHost.withExtensionHost([activationExtensionPath], async (api) => {
let promise = new Promise((c) => {

api.onMessage.subscribe(msg => {
const { payload } = msg;

if(payload.methodName == "$onDidActivateExtension") {
console.dir(payload);
c();
}
});

});

await api.start();

api.sendNotification(["ExtHostExtensionService", "$activateByEvent", ["onLanguage:testlang"]]);
await promise;
});
});

test("activates in response to onLanguage event", async () => {
await ExtensionHost.withExtensionHost([activationExtensionPath], async (api) => {
let promise = new Promise((c) => {

api.onMessage.subscribe(msg => {
const { payload } = msg;

if(payload.methodName == "$onDidActivateExtension") {
console.dir(payload);
c();
}
});

});

await api.start();

api.sendNotification(["ExtHostExtensionService", "$activateByEvent", ["onCommand:extension.helloWorld"]]);
await promise;
});
});
});
32 changes: 32 additions & 0 deletions __tests__/Commands.Test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import * as path from "path";

import * as ExtensionHost from "./ExtensionHost";

let extensionPath = path.join(__dirname, "..", "test_extensions", "oni-api-tests", "package.json");

describe("commands", () => {
test("execute basic command", async () => {
await ExtensionHost.withExtensionHost([extensionPath], async (api) => {

/*
* Upon activation, we should get a notification from the extension host
* that the 'extension.helloWorld' command is available.
*/
let commandRegistrationPromise = api.waitForMessageOnce("MainThreadCommands", "$registerCommand", (args) => args.indexOf("extension.helloWorld") >= 0);

let showMessagePromise = api.waitForMessageOnce("MainThreadMessageService", "$showMessage");

await api.start();

// Wait for the 'extension.helloWorld' command to be registered...
await commandRegistrationPromise;

// ...otherwise this call will fail.
api.sendNotification(
["ExtHostCommands", "$executeContributedCommand", ["extension.helloWorld"]]
);

await showMessagePromise;
});
});
});
Loading