@@ -77,45 +77,9 @@ interface SnippetsContianer {
7777 [ name : string ] : SnippetDescriptor ;
7878}
7979
80-
81- // this is the structure we use to speed up the lookup by avoiding having to
82- // iterate over the object properties during the requestHandler
83- // this will take a little longer during load but I guess that is better than
84- // taking longer at each key stroke
85- interface SnippetDetail {
86- body : string ;
87- name : string ;
88- }
89-
90- var tsSnipPrefixLookup : { [ prefix : string ] : SnippetDetail ; } = Object . create ( null ) ;
91- function loadSnippets ( ) {
92- var confPath = atom . getConfigDirPath ( ) ;
93- CSON . readFile ( confPath + "/packages/atom-typescript/snippets/typescript-snippets.cson" ,
94- ( err , snippetsRoot ) => {
95- if ( err ) return ;
96- if ( ! snippetsRoot || ! snippetsRoot [ '.source.ts' ] ) return ;
97-
98- // rearrange/invert the way this can be looked up: we want to lookup by prefix
99- // this way the lookup gets faster because we dont have to iterate over the
100- // properties of the object
101- var tsSnippets : SnippetsContianer = snippetsRoot [ '.source.ts' ] ;
102- for ( var snippetName in tsSnippets ) {
103- if ( tsSnippets . hasOwnProperty ( snippetName ) ) {
104- // if the file contains a prefix multiple times only
105- // the last will be active because the previous ones will be overwritten
106- tsSnipPrefixLookup [ tsSnippets [ snippetName ] . prefix ] = {
107- body : tsSnippets [ snippetName ] . body ,
108- name : snippetName
109- }
110- }
111- }
112- } ) ;
113- }
114- loadSnippets ( ) ;
115-
11680export var provider : autocompleteplus . Provider = {
11781 selector : '.source.ts' ,
118- inclusionPriority : 3 ,
82+ inclusionPriority : 4 ,
11983 excludeLowerPriority : false ,
12084 getSuggestions : ( options : autocompleteplus . RequestOptions ) : Promise < autocompleteplus . Suggestion [ ] > => {
12185
@@ -224,21 +188,6 @@ export var provider: autocompleteplus.Provider = {
224188 }
225189 } ) ;
226190
227-
228- // see if we have a snippet for this prefix
229- if ( tsSnipPrefixLookup [ options . prefix ] ) {
230- // you only get the snippet suggested after you have typed
231- // the full trigger word/ prefex
232- // and then it replaces a keyword/match that might also be present, e.g. "class"
233- let suggestion : autocompleteplus . Suggestion = {
234- snippet : tsSnipPrefixLookup [ options . prefix ] . body ,
235- replacementPrefix : options . prefix ,
236- rightLabelHTML : "snippet: " + options . prefix ,
237- type : 'snippet'
238- } ;
239- suggestions . unshift ( suggestion ) ;
240- }
241-
242191 return suggestions ;
243192 } ) ;
244193
0 commit comments