|
1 | | -import last from "lodash/last" |
2 | 1 | import { makeAutosuggest, getPathForPosition } from "./autosuggest-helpers/core" |
3 | 2 | import { getSnippetsForPath } from "./autosuggest-helpers/snippet-helpers" |
4 | | -import { getKeywordsForPath, getContextType } from "./autosuggest-helpers/keyword-helpers" |
5 | | -import { buildSuggestions, parseDomain } from "./autosuggest-helpers/hub-ref-helpers.hub.js" |
| 3 | +import { getKeywordsForPath } from "./autosuggest-helpers/keyword-helpers" |
6 | 4 | import keywordMap from "./autosuggest-helpers/keyword-map" |
7 | 5 | import snippets from "./autosuggest-helpers/snippets" |
8 | 6 |
|
@@ -35,31 +33,7 @@ export default function(editor, { fetchDomainSuggestions }, { langTools, AST, sp |
35 | 33 | } |
36 | 34 | } |
37 | 35 |
|
38 | | - let HubRefCompleter = { |
39 | | - getCompletions: function(editor, session, pos, prefix, callback) { |
40 | | - editor.completer.autoSelect = true |
41 | | - |
42 | | - let editorValue = session.getValue() |
43 | | - |
44 | | - let path = getPathForPosition({ pos, prefix, editorValue, AST }) |
45 | | - |
46 | | - if(last(path) === "$ref") { |
47 | | - let type = getContextType(path) |
48 | | - fetchDomainSuggestions(path, prefix, type) |
49 | | - .then(res => { |
50 | | - let suggestions = res.apis.reduce( function( prev, rawDomain, i ){ |
51 | | - var domain = parseDomain( rawDomain, i ) |
52 | | - return buildSuggestions( domain, i, type).concat( prev ) |
53 | | - }, [] ) |
54 | | - callback(null, suggestions) |
55 | | - }) |
56 | | - } else { |
57 | | - callback(null, []) |
58 | | - } |
59 | | - } |
60 | | - } |
61 | | - |
62 | 36 | return makeAutosuggest({ |
63 | | - completers: [SnippetCompleter, KeywordCompleter, HubRefCompleter] |
| 37 | + completers: [SnippetCompleter, KeywordCompleter] |
64 | 38 | })(editor, {fetchDomainSuggestions}, { langTools, AST, specObject }) |
65 | 39 | } |
0 commit comments