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