@@ -70,12 +70,12 @@ import { createDiagnosticsForIgnore } from './diagnosticsHandler'
70
70
71
71
export function handleDiagnosticsRequest (
72
72
document : TextDocument ,
73
- showErrorToast ?: ( errorMessage : string ) => void ,
73
+ onError ?: ( errorMessage : string ) => void ,
74
74
) : Diagnostic [ ] {
75
75
const text = document . getText ( fullDocumentRange ( document ) )
76
76
const res = lint ( text , ( errorMessage : string ) => {
77
- if ( showErrorToast ) {
78
- showErrorToast ( errorMessage )
77
+ if ( onError ) {
78
+ onError ( errorMessage )
79
79
}
80
80
} )
81
81
@@ -87,8 +87,8 @@ export function handleDiagnosticsRequest(
87
87
diagnostic . text === 'Model declarations have to be indicated with the `model` keyword.' ,
88
88
)
89
89
) {
90
- if ( showErrorToast ) {
91
- showErrorToast (
90
+ if ( onError ) {
91
+ onError (
92
92
"You might currently be viewing a Prisma 1 datamodel which is based on the GraphQL syntax. The current Prisma Language Server doesn't support this syntax. If you are handling a Prisma 1 datamodel, please change the file extension to `.graphql` so the new Prisma Language Server does not get triggered anymore." ,
93
93
)
94
94
}
@@ -240,13 +240,13 @@ export function handleHoverRequest(document: TextDocument, params: HoverParams):
240
240
function prismaFmtCompletions (
241
241
params : CompletionParams ,
242
242
document : TextDocument ,
243
- showErrorToast ?: ( errorMessage : string ) => void ,
243
+ onError ?: ( errorMessage : string ) => void ,
244
244
) : CompletionList | undefined {
245
245
const text = document . getText ( fullDocumentRange ( document ) )
246
246
247
247
const completionList = textDocumentCompletion ( text , params , ( errorMessage : string ) => {
248
- if ( showErrorToast ) {
249
- showErrorToast ( errorMessage )
248
+ if ( onError ) {
249
+ onError ( errorMessage )
250
250
}
251
251
} )
252
252
@@ -260,7 +260,7 @@ function prismaFmtCompletions(
260
260
function localCompletions (
261
261
params : CompletionParams ,
262
262
document : TextDocument ,
263
- showErrorToast ?: ( errorMessage : string ) => void ,
263
+ onError ?: ( errorMessage : string ) => void ,
264
264
) : CompletionList | undefined {
265
265
const context = params . context
266
266
const position = params . position
@@ -303,7 +303,7 @@ function localCompletions(
303
303
lines ,
304
304
wordsBeforePosition ,
305
305
document ,
306
- showErrorToast ,
306
+ onError ,
307
307
)
308
308
case '"' :
309
309
return getSuggestionForSupportedFields (
@@ -319,7 +319,7 @@ function localCompletions(
319
319
if ( [ 'model' , 'view' ] . includes ( foundBlock . type ) && isInsideAttribute ( currentLineUntrimmed , position , '()' ) ) {
320
320
return getSuggestionsForInsideRoundBrackets ( currentLineUntrimmed , lines , document , position , foundBlock )
321
321
} else {
322
- return getSuggestionForNativeTypes ( foundBlock , lines , wordsBeforePosition , document , showErrorToast )
322
+ return getSuggestionForNativeTypes ( foundBlock , lines , wordsBeforePosition , document , onError )
323
323
}
324
324
}
325
325
}
@@ -342,7 +342,7 @@ function localCompletions(
342
342
lines ,
343
343
wordsBeforePosition ,
344
344
document ,
345
- showErrorToast ,
345
+ onError ,
346
346
)
347
347
case 'datasource' :
348
348
case 'generator' :
@@ -376,9 +376,9 @@ function localCompletions(
376
376
export function handleCompletionRequest (
377
377
params : CompletionParams ,
378
378
document : TextDocument ,
379
- showErrorToast ?: ( errorMessage : string ) => void ,
379
+ onError ?: ( errorMessage : string ) => void ,
380
380
) : CompletionList | undefined {
381
- return prismaFmtCompletions ( params , document , showErrorToast ) || localCompletions ( params , document , showErrorToast )
381
+ return prismaFmtCompletions ( params , document , onError ) || localCompletions ( params , document , onError )
382
382
}
383
383
384
384
export function handleRenameRequest ( params : RenameParams , document : TextDocument ) : WorkspaceEdit | undefined {
@@ -477,13 +477,13 @@ export function handleCompletionResolveRequest(item: CompletionItem): Completion
477
477
export function handleCodeActions (
478
478
params : CodeActionParams ,
479
479
document : TextDocument ,
480
- showErrorToast ?: ( errorMessage : string ) => void ,
480
+ onError ?: ( errorMessage : string ) => void ,
481
481
) : CodeAction [ ] {
482
482
if ( ! params . context . diagnostics . length ) {
483
483
return [ ]
484
484
}
485
485
486
- return quickFix ( document , params , showErrorToast )
486
+ return quickFix ( document , params , onError )
487
487
}
488
488
489
489
export function handleDocumentSymbol ( params : DocumentSymbolParams , document : TextDocument ) : DocumentSymbol [ ] {
0 commit comments