@@ -7,7 +7,7 @@ import { URI, UriComponents } from 'vs/base/common/uri';
7
7
import { mixin } from 'vs/base/common/objects' ;
8
8
import type * as vscode from 'vscode' ;
9
9
import * as typeConvert from 'vs/workbench/api/common/extHostTypeConverters' ;
10
- import { Range , Disposable , CompletionList , SnippetString , CodeActionKind , SymbolInformation , DocumentSymbol , SemanticTokensEdits , SemanticTokens , SemanticTokensEdit , Location , InlineCompletionTriggerKind , InternalDataTransferItem } from 'vs/workbench/api/common/extHostTypes' ;
10
+ import { Range , Disposable , CompletionList , SnippetString , CodeActionKind , SymbolInformation , DocumentSymbol , SemanticTokensEdits , SemanticTokens , SemanticTokensEdit , Location , InlineCompletionTriggerKind , InternalDataTransferItem , CodeActionTriggerKind } from 'vs/workbench/api/common/extHostTypes' ;
11
11
import { ISingleEditOperation } from 'vs/editor/common/core/editOperation' ;
12
12
import * as languages from 'vs/editor/common/languages' ;
13
13
import { ExtHostDocuments } from 'vs/workbench/api/common/extHostDocuments' ;
@@ -376,6 +376,7 @@ class CodeActionAdapter {
376
376
377
377
private readonly _cache = new Cache < vscode . CodeAction | vscode . Command > ( 'CodeAction' ) ;
378
378
private readonly _disposables = new Map < number , DisposableStore > ( ) ;
379
+ private readonly nbKind = new CodeActionKind ( 'notebook' ) ;
379
380
380
381
constructor (
381
382
private readonly _documents : ExtHostDocuments ,
@@ -414,6 +415,7 @@ class CodeActionAdapter {
414
415
if ( ! isNonEmptyArray ( commandsOrActions ) || token . isCancellationRequested ) {
415
416
return undefined ;
416
417
}
418
+
417
419
const cacheId = this . _cache . add ( commandsOrActions ) ;
418
420
const disposables = new DisposableStore ( ) ;
419
421
this . _disposables . set ( cacheId , disposables ) ;
@@ -434,6 +436,10 @@ class CodeActionAdapter {
434
436
command : this . _commands . toInternal ( candidate , disposables ) ,
435
437
} ) ;
436
438
} else {
439
+ if ( codeActionContext . triggerKind !== CodeActionTriggerKind . Invoke && candidate . kind && this . nbKind . contains ( candidate . kind ) ) {
440
+ continue ;
441
+ }
442
+
437
443
if ( codeActionContext . only ) {
438
444
if ( ! candidate . kind ) {
439
445
this . _logService . warn ( `${ this . _extension . identifier . value } - Code actions of kind '${ codeActionContext . only . value } 'requested but returned code action does not have a 'kind'. Code action will be dropped. Please set 'CodeAction.kind'.` ) ;
0 commit comments