• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript fuzzaldrin.filter函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getCompletionsForCompilerOptions

  /*
  getCompletionsForCompilerOptions(buffer,prefix,position)
  buffer: TextBuffer, current buffer
  prefix: String, completion prefix
  position: Point, current cursor position

  Returns: Promise([ghcopt])
  ghcopt: String, compiler option (starts with '-f')
  */
  public async getCompletionsForCompilerOptions(
    _buffer: TextBuffer, prefix: string, _position: Point,
  ): Promise<string[]> {
    if (!this.isActive) { throw new Error('Backend inactive') }
    const co: string[] = await this.process.backend.flags()
    return FZ.filter(co, prefix)
  }
开发者ID:mvoidex,项目名称:atom-haskell-hsdev,代码行数:16,代码来源:index.ts


示例2: getCompletionsForLanguagePragmas

  /*
  getCompletionsForLanguagePragmas(buffer,prefix,position)
  buffer: TextBuffer, current buffer
  prefix: String, completion prefix
  position: Point, current cursor position

  Returns: Promise([pragma])
  pragma: String, language option
  */
  public async getCompletionsForLanguagePragmas(
    _buffer: TextBuffer, prefix: string, _position: Point,
  ): Promise<string[]> {
    if (!this.isActive) { throw new Error('Backend inactive') }
    const ps: string[] = await this.process.backend.langs()
    return FZ.filter(ps, prefix)
  }
开发者ID:mvoidex,项目名称:atom-haskell-hsdev,代码行数:16,代码来源:index.ts


示例3: getCompletionsForClass

  /*
  getCompletionsForClass(buffer,prefix,position)
  buffer: TextBuffer, current buffer
  prefix: String, completion prefix
  position: Point, current cursor position

  Returns: Promise([symbol])
  symbol: Same as getCompletionsForSymbol, except
          symbolType is one of ['class']
  */
  public async getCompletionsForClass(
    buffer: TextBuffer, prefix: string, _position: Point,
  ): Promise<CB.ISymbol[]> {
    if (!this.isActive) { throw new Error('Backend inactive') }

    const symbols = await this.getCompletionsForBuffer(buffer, ['class'])
    return FZ.filter(symbols, prefix, { key: 'qname' })
  }
开发者ID:mvoidex,项目名称:atom-haskell-hsdev,代码行数:18,代码来源:index.ts


示例4: filterCompletions

 private filterCompletions(
     completions: CompletionList, position: SourcePosition,
     document: Document): CompletionList {
   const leadingText = this.getLeadingIdentifier(position, document);
   const filterableCompletions = completions.items.map((completion) => {
     return {
       filterText: completion.filterText || completion.label,
       completion
     };
   });
   const items =
       fuzzaldrin
           .filter(filterableCompletions, leadingText, {key: 'filterText'})
           .map((i) => i.completion);
   return {isIncomplete: true, items};
 }
开发者ID:Polymer,项目名称:tools,代码行数:16,代码来源:auto-completer.ts


示例5: createReportFromCompletionInfo

function createReportFromCompletionInfo(completionInfo: TSType.CompletionInfo, prefix: string): CodeHintsReport {
  let entries: TSType.CompletionEntry[] = completionInfo ? completionInfo.entries : [];

  if (prefix) {
    entries = fuzzaldrin.filter(entries, prefix, { key: 'name' });
  }

  entries = _.sortBy(entries, (entry: TSType.CompletionEntry) => {
    let sort = entry.sortText;
    if (prefix) {
      if (entry.name.indexOf(prefix) === 0) {
        // starts with prefix case sensitive
        sort += '0';
      } else if (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0) {
        // starts with prefix case in-sensitive
        sort += '1';
      } else {
        // other matches (fuzzy search)
        sort += '2';
      }
    }
    return sort + entry.name.toLowerCase();
  });

  const MAX_COMPLETIONS = 50;
  if (entries.length > MAX_COMPLETIONS) {
    entries = entries.slice(0, MAX_COMPLETIONS);
  }

  return {
    hints: entries.map((entry) => entry.name),
    match: prefix,
    selectInitial: true,
    handleWideResults: false
  };
}
开发者ID:zaggino,项目名称:brackets-typescript,代码行数:36,代码来源:ts-completions.ts


示例6: filter

 .map(s => filter(s, options.prefix, { key: '_search' }))
开发者ID:RichiCoder1,项目名称:omnisharp-atom,代码行数:1,代码来源:framework-provider.ts


示例7: filter

 .then(s => filter(s, search, { key: '_search' }));
开发者ID:Yantrio,项目名称:omnisharp-atom,代码行数:1,代码来源:completion-provider.ts


示例8: filter

import { match, filter, score } from 'fuzzaldrin';

let number = 0;
const string = '' as string;
let strings: string[] = [];
let objects: Array<{name: string, speed: number}> = [];

strings = filter(strings, string);
strings = filter(strings, string, {maxResults: number});
objects = filter(objects, string, {key: 'name'});
objects = filter(objects, string, {key: 'name', maxResults: number});

number = score(string, string);

match(string, string);

// These should be type errors! Uncomment to verify.
// objects = filter(objects, string);
// objects = filter(objects, string, {key: 'speed'});
// strings = filter(strings, string, {key: 'speed'});
开发者ID:AdaskoTheBeAsT,项目名称:DefinitelyTyped,代码行数:20,代码来源:fuzzaldrin-tests.ts


示例9:

 this.connection.onWorkspaceSymbol(async(params) => {
   const analysis =
       await this.analyzer.analyzePackage({reason: 'get workspace symbols'});
   const symbols = this.findSymbols(analysis);
   return fuzzaldrin.filter(symbols, params.query, {key: 'name'});
 });
开发者ID:MehdiRaash,项目名称:tools,代码行数:6,代码来源:definition-finder.ts


示例10: filter

 p = p.then(s => filter(s, search, { key: 'CompletionText' }));
开发者ID:SkightTeam,项目名称:omnisharp-atom,代码行数:1,代码来源:completion-provider.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript fuzzaldrin.score函数代码示例发布时间:2022-05-25
下一篇:
TypeScript fuse-test-runner.should函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap