本文整理汇总了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' })
}