@@ -50,8 +50,6 @@ const registerIntelliSenseField = (tableList: string[], dataSourceId, databaseNa
5050 intelliSenseField = monaco . languages . registerCompletionItemProvider ( 'sql' , {
5151 triggerCharacters : [ ' ' , '.' , '(' ] ,
5252 provideCompletionItems : async ( model , position ) => {
53- console . log ( 'registerIntelliSenseField' ) ;
54-
5553 // 获取到当前行文本
5654 const textUntilPosition = model . getValueInRange ( {
5755 startLineNumber : position . lineNumber ,
@@ -61,8 +59,8 @@ const registerIntelliSenseField = (tableList: string[], dataSourceId, databaseNa
6159 } ) ;
6260
6361 const isFieldContext = checkFieldContext ( textUntilPosition ) ;
64-
6562 const match = textUntilPosition . match ( / ( \b \w + \b ) [ ^ \w ] * $ / ) ;
63+
6664 let word ;
6765 if ( match ) {
6866 word = match [ 1 ] ;
@@ -73,7 +71,6 @@ const registerIntelliSenseField = (tableList: string[], dataSourceId, databaseNa
7371 return ; // 如果没有匹配到,直接返回
7472 }
7573 if ( word && tableList . includes ( word ) && ! fieldList [ word ] ) {
76- console . log ( 'registerIntelliSenseField start word' ) ;
7774 const data = await sqlService . getAllFieldByTable ( {
7875 dataSourceId,
7976 databaseName,
@@ -83,7 +80,7 @@ const registerIntelliSenseField = (tableList: string[], dataSourceId, databaseNa
8380 fieldList [ word ] = data ;
8481 }
8582
86- const suggestions = Object . keys ( fieldList ) . reduce ( ( acc , cur ) => {
83+ const suggestions : monaco . languages . CompletionItem [ ] = Object . keys ( fieldList ) . reduce ( ( acc , cur ) => {
8784 const arr = fieldList [ cur ] . map ( ( fieldObj ) => ( {
8885 label : {
8986 label : fieldObj . name ,
0 commit comments