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


TypeScript TextBuffer.backwardsScanInRange方法代码示例

本文整理汇总了TypeScript中atom.TextBuffer.backwardsScanInRange方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TextBuffer.backwardsScanInRange方法的具体用法?TypeScript TextBuffer.backwardsScanInRange怎么用?TypeScript TextBuffer.backwardsScanInRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在atom.TextBuffer的用法示例。


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

示例1: getCompletionsForSymbolInModule

  /*
  getCompletionsForSymbolInModule(buffer,prefix,position,{module})
  Used in import hiding/list completions

  buffer: TextBuffer, current buffer
  prefix: String, completion prefix
  position: Point, current cursor position
  module: String, module name (optional). If undefined, function
          will attempt to infer module name from position and buffer.

  Returns: Promise([symbol])
  symbol: Object, symbol in given module
    name: String, symbol name
    typeSignature: String, type signature
    symbolType: String, one of ['type', 'class', 'function']
  */
  public async getCompletionsForSymbolInModule(
    buffer: TextBuffer, prefix: string, position: Point,
    opts?: { module: string },
  ): Promise<CB.ISymbol[]> {
    if (!this.isActive) { throw new Error('Backend inactive') }
    let moduleName = opts ? opts.module : undefined
    if (!moduleName) {
      const lineRange = new Range([0, position.row], position)
      buffer.backwardsScanInRange(
        /^import\s+([\w.]+)/,
        lineRange, ({ match }) => moduleName = match[1],
      )
    }

    return [] // TODO: Implement
    // tslint:enable: no-null-keyword
    // return FZ.filter(symbols, prefix, { key: 'name' })
  }
开发者ID:mvoidex,项目名称:atom-haskell-hsdev,代码行数:34,代码来源:index.ts


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