Fix syntax highlighting, process spawning, extensions, terminals (#22)

* Fix syntax highlighting, process spawning, extensions, terminals

* Replace colons in toISOString

* Move pathSets included in task
This commit is contained in:
Kyle Carberry
2019-01-28 11:14:06 -06:00
parent 9b1a635d63
commit b4798d1a48
31 changed files with 300 additions and 46 deletions

View File

@@ -35,6 +35,7 @@ export const handleNewSession = (connection: SendableConnection, newSession: New
]);
let process: Process;
let processTitle: string | undefined;
const env: { [key: string]: string } = {};
newSession.getEnvMap().forEach((value, key) => {
@@ -42,12 +43,31 @@ export const handleNewSession = (connection: SendableConnection, newSession: New
});
if (newSession.getTtyDimensions()) {
// Spawn with node-pty
process = nodePty.spawn(newSession.getCommand(), newSession.getArgsList(), {
const ptyProc = nodePty.spawn(newSession.getCommand(), newSession.getArgsList(), {
cols: newSession.getTtyDimensions()!.getWidth(),
rows: newSession.getTtyDimensions()!.getHeight(),
cwd: newSession.getCwd(),
env,
});
const timer = setInterval(() => {
if (ptyProc.process !== processTitle) {
processTitle = ptyProc.process;
const id = new IdentifySessionMessage();
id.setId(newSession.getId());
id.setTitle(processTitle);
const sm = new ServerMessage();
sm.setIdentifySession(id);
connection.send(sm.serializeBinary());
}
}, 200);
ptyProc.on("exit", () => {
clearTimeout(timer);
});
process = ptyProc;
processTitle = ptyProc.process;
} else {
const options = {
cwd: newSession.getCwd(),
@@ -129,6 +149,9 @@ export const handleNewSession = (connection: SendableConnection, newSession: New
const id = new IdentifySessionMessage();
id.setId(newSession.getId());
id.setPid(process.pid);
if (processTitle) {
id.setTitle(processTitle);
}
const sm = new ServerMessage();
sm.setIdentifySession(id);
connection.send(sm.serializeBinary());

View File

@@ -86,6 +86,9 @@ export class Server {
throw new Error(`unrecognized platform "${platform}"`);
}
initMsg.setOperatingSystem(operatingSystem);
if (process.env.SHELL) {
initMsg.setShell(process.env.SHELL);
}
const srvMsg = new ServerMessage();
srvMsg.setInit(initMsg);
connection.send(srvMsg.serializeBinary());