当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript vscode-languageserver-protocol.Disposable类代码示例

本文整理汇总了TypeScript中vscode-languageserver-protocol.Disposable的典型用法代码示例。如果您正苦于以下问题:TypeScript Disposable类的具体用法?TypeScript Disposable怎么用?TypeScript Disposable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Disposable类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: watchFile

export function watchFile(filepath: string, onChange: () => void): Disposable {
  let callback = debounce(onChange, 100)
  try {
    let watcher = fs.watch(filepath, {
      persistent: true,
      recursive: false,
      encoding: 'utf8'
    }, () => {
      callback()
    })
    return Disposable.create(() => {
      watcher.close()
    })
  } catch (e) {
    return Disposable.create(() => {
      // noop
    })
  }
}
开发者ID:illarionvk,项目名称:dotfiles,代码行数:19,代码来源:index.ts

示例2: register

 public register(selector: DocumentSelector, provider: DefinitionProvider): Disposable {
   let item: ProviderItem<DefinitionProvider> = {
     id: uuid(),
     selector,
     provider
   }
   this.providers.add(item)
   return Disposable.create(() => {
     this.providers.delete(item)
   })
 }
开发者ID:demelev,项目名称:coc.nvim,代码行数:11,代码来源:definitionManager.ts

示例3: register

 public register(selector: DocumentSelector, provider: SelectionRangeProvider): Disposable {
   let item = {
     id: uuid(),
     selector,
     provider
   }
   this.providers.add(item)
   return Disposable.create(() => {
     this.providers.delete(item)
   })
 }
开发者ID:illarionvk,项目名称:dotfiles,代码行数:11,代码来源:rangeManager.ts

示例4: register

 public register(selector: DocumentSelector, provider: CodeActionProvider, clientId: string, codeActionKinds?: CodeActionKind[]): Disposable {
   let item: ProviderItem<CodeActionProvider> = {
     id: uuid(),
     selector,
     provider,
     kinds: codeActionKinds,
     clientId
   }
   this.providers.add(item)
   return Disposable.create(() => {
     this.providers.delete(item)
   })
 }
开发者ID:demelev,项目名称:coc.nvim,代码行数:13,代码来源:codeActionmanager.ts

示例5: register

 public register(selector: DocumentSelector,
   provider: DocumentFormattingEditProvider,
   priority = 0): Disposable {
   let item: ProviderItem<DocumentFormattingEditProvider> = {
     id: uuid(),
     selector,
     priority,
     provider
   }
   this.providers.add(item)
   return Disposable.create(() => {
     this.providers.delete(item)
   })
 }
开发者ID:demelev,项目名称:coc.nvim,代码行数:14,代码来源:formatManager.ts

示例6: register

 public register(selector: DocumentSelector, provider: SignatureHelpProvider, triggerCharacters?: string[]): Disposable {
   let characters = triggerCharacters.reduce((p, c) => {
     return p.concat(c.split(/\s*/g))
   }, [] as string[])
   let item: ProviderItem<SignatureHelpProvider> = {
     id: uuid(),
     selector,
     provider,
     triggerCharacters: characters
   }
   this.providers.add(item)
   return Disposable.create(() => {
     this.providers.delete(item)
   })
 }
开发者ID:illarionvk,项目名称:dotfiles,代码行数:15,代码来源:signatureManager.ts

示例7: regist

export function regist(sourceMap: Map<string, ISource>): Disposable {
  sourceMap.set('buffer', new Buffer())
  return Disposable.create(() => {
    sourceMap.delete('buffer')
  })
}
开发者ID:demelev,项目名称:coc.nvim,代码行数:6,代码来源:buffer.ts

示例8: regist

export function regist(sourceMap: Map<string, ISource>): Disposable {
  sourceMap.set('file', new File())
  return Disposable.create(() => {
    sourceMap.delete('file')
  })
}
开发者ID:demelev,项目名称:coc.nvim,代码行数:6,代码来源:file.ts

示例9: regist

export function regist(sourceMap: Map<string, ISource>): Disposable {
  sourceMap.set('around', new Around())
  return Disposable.create(() => {
    sourceMap.delete('around')
  })
}
开发者ID:demelev,项目名称:coc.nvim,代码行数:6,代码来源:around.ts

示例10: dispose

 public dispose(): void {
   this.disposable.dispose()
 }
开发者ID:illarionvk,项目名称:dotfiles,代码行数:3,代码来源:configuration.ts


注:本文中的vscode-languageserver-protocol.Disposable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。