1.0.1 • Published 6 years ago
singleton-tsserver v1.0.1
singleton-tsserver
单实例的 tsserver
针对同样的参数,只启动一个 tsserver 实例
用法
const ClusterTsServerProcess = require('singleton-tsserver');
const options = {
  tsServerPath: '<tsServerPath>',
  args: [
    '--useInferredProjectPerProjectRoot',
    '--enableTelemetry',
    '--noGetErrOnBackgroundUpdate',
    '--validateDefaultNpmLocation',
  ],
};
const proc = new ClusterTsServerProcess(options);
proc.stdout.on('data', data => {
  console.log(data.toString());
});
proc.write({
  seq: 0,
  type: 'request',
  command: 'configure',
  arguments: {
    hostInfo: 'vscode',
    preferences: {
      providePrefixAndSuffixTextForRename: true,
      allowRenameOfImportPath: true,
    },
  },
});