本文整理匯總了TypeScript中promised-neovim-client.attach函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript attach函數的具體用法?TypeScript attach怎麽用?TypeScript attach使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了attach函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: initNvim
static async initNvim(vimState: VimState) {
const proc = spawn(Configuration.neovimPath, ['-u', 'NONE', '-N', '--embed'], {
cwd: __dirname,
});
proc.on('error', function(err) {
console.log(err);
vscode.window.showErrorMessage('Unable to setup neovim instance! Check your path.');
Configuration.enableNeovim = false;
});
vimState.nvim = await attach(proc.stdin, proc.stdout);
}
示例2: initialize
async initialize() {
let dir = dirname(vscode.window.activeTextEditor!.document.uri.fsPath);
if (!existsSync(dir)) {
dir = __dirname;
}
this.process = spawn(configuration.neovimPath, ['-u', 'NONE', '-N', '--embed'], {
cwd: dir,
});
this.process.on('error', err => {
Logger.error(err.message, `Neovim: Error spawning neovim. Error=${err.message}.`);
configuration.enableNeovim = false;
});
this.nvim = await attach(this.process.stdin, this.process.stdout);
}
示例3: startNeovim
private async startNeovim() {
let dir = dirname(vscode.window.activeTextEditor!.document.uri.fsPath);
if (!(await util.promisify(exists)(dir))) {
dir = __dirname;
}
this.process = spawn(configuration.neovimPath, ['-u', 'NONE', '-N', '--embed'], {
cwd: dir,
});
this.process.on('error', err => {
logger.error(`Neovim: Error spawning neovim. Error=${err.message}.`);
configuration.enableNeovim = false;
});
return attach(this.process.stdin, this.process.stdout);
}