當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。