本文整理汇总了TypeScript中vs/base/common/marshalling.parse函数的典型用法代码示例。如果您正苦于以下问题:TypeScript parse函数的具体用法?TypeScript parse怎么用?TypeScript parse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: function
const _uriMassage = function (part: string): string {
let data: any;
try {
data = parse(decodeURIComponent(part));
} catch (e) {
// ignore
}
if (!data) {
return part;
}
data = cloneAndChange(data, value => {
if (markdown.uris && markdown.uris[value]) {
return URI.revive(markdown.uris[value]);
} else {
return undefined;
}
});
return encodeURIComponent(JSON.stringify(data));
};
开发者ID:donaldpipowitch,项目名称:vscode,代码行数:19,代码来源:htmlContentRenderer.ts
示例2: test
test('Bug 16793:# in folder name => mirror models get out of sync', () => {
var uri1 = URI.file('C:\\C#\\file.txt');
assert.equal(parse(stringify(uri1)).toString(), uri1.toString());
});
开发者ID:CPoirot3,项目名称:vscode,代码行数:4,代码来源:uri.test.ts
示例3: _receiveOneMessage
private _receiveOneMessage(rawmsg: string): void {
if (this._isDisposed) {
console.warn('Received message after being shutdown: ', rawmsg);
return;
}
let msg = marshalling.parse(rawmsg);
if (msg.seq) {
if (!this._pendingRPCReplies.hasOwnProperty(msg.seq)) {
console.warn('Got reply to unknown seq');
return;
}
let reply = this._pendingRPCReplies[msg.seq];
delete this._pendingRPCReplies[msg.seq];
if (msg.err) {
let err = msg.err;
if (msg.err.$isError) {
err = new Error();
err.name = msg.err.name;
err.message = msg.err.message;
err.stack = msg.err.stack;
}
reply.resolveErr(err);
return;
}
reply.resolveOk(msg.res);
return;
}
if (msg.cancel) {
if (this._invokedHandlers[msg.cancel]) {
this._invokedHandlers[msg.cancel].cancel();
}
return;
}
if (msg.err) {
console.error(msg.err);
return;
}
let rpcId = msg.rpcId;
if (!this._bigHandler) {
throw new Error('got message before big handler attached!');
}
let req = msg.req;
this._invokedHandlers[req] = this._invokeHandler(rpcId, msg.method, msg.args);
this._invokedHandlers[req].then((r) => {
delete this._invokedHandlers[req];
this._multiplexor.send(MessageFactory.replyOK(req, r));
}, (err) => {
delete this._invokedHandlers[req];
this._multiplexor.send(MessageFactory.replyErr(req, err));
});
}
开发者ID:SeanKilleen,项目名称:vscode,代码行数:61,代码来源:rpcProtocol.ts
注:本文中的vs/base/common/marshalling.parse函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论