File tree Expand file tree Collapse file tree 3 files changed +28
-5
lines changed
packages/monaco-plugin-ob
example/src/components/App Expand file tree Collapse file tree 3 files changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ export default function () {
7272 delimiter : ';' ,
7373 llm : {
7474 async completions ( input : string , pos : number ) {
75- return 'aaa1'
75+ return 'aaa1\naaaa\n '
7676 }
7777 } ,
7878 async getSnippets ( ) {
Original file line number Diff line number Diff line change 11{
22 "name" : " @oceanbase-odc/monaco-plugin-ob" ,
3- "version" : " 1.3.1 " ,
3+ "version" : " 1.3.2 " ,
44 "description" : " " ,
55 "main" : " dist/index.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -48,13 +48,36 @@ class MonacoInlineComplete implements monaco.languages.InlineCompletionsProvider
4848 } )
4949 return ;
5050 }
51- value = ( currentToken ?. word || '' ) + value
51+
52+ const start = model . getValueInRange ( {
53+ startLineNumber : position . lineNumber ,
54+ startColumn : 0 ,
55+ endLineNumber : position . lineNumber ,
56+ endColumn : position . column
57+ } ) ;
58+ const end = model . getValueInRange ( {
59+ startLineNumber : position . lineNumber ,
60+ startColumn : position . column ,
61+ endLineNumber : position . lineNumber + 1 ,
62+ endColumn : 0
63+ } )
64+ let newValue = value ;
65+ if ( currentToken && currentToken . word ) {
66+ newValue = start + value + end ;
67+ } else {
68+ newValue = value + end ;
69+ }
5270 resolve (
5371 {
5472 items : [
5573 {
56- insertText : {
57- snippet : value
74+ insertText : value ,
75+ filterText : newValue ,
76+ range : {
77+ startLineNumber : position . lineNumber ,
78+ startColumn : position . column ,
79+ endLineNumber : position . lineNumber ,
80+ endColumn : position . column
5881 }
5982 }
6083 ]
You can’t perform that action at this time.
0 commit comments