Skip to content

Commit

Permalink
[prompt snippets]: add PromptFileReference.isPromptSnippetFile getter
Browse files Browse the repository at this point in the history
  • Loading branch information
legomushroom committed Nov 22, 2024
1 parent 7993f20 commit 2e23acb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class ChatDynamicVariableModel extends Disposable implements IChatWidgetC

// if the `prompt snippets` feature is enabled, start resolving
// nested file references immediatelly and subscribe to updates
if (ChatDynamicVariable.promptSnippetsEnabled(this.configService)) {
if (ChatDynamicVariable.promptSnippetsEnabled(this.configService) && variable.isPromptSnippetFile) {
// subscribe to variable changes
this._register(variable.onUpdate(() => {
this.updateVariableTexts();
Expand Down
7 changes: 7 additions & 0 deletions src/vs/workbench/contrib/chat/common/promptFileReference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ export class PromptFileReference extends Disposable {
return !!value;
}

/**
* Check if the current reference points to a prompt snippet file.
*/
public get isPromptSnippetFile(): boolean {
return this.uri.path.endsWith(PROMP_SNIPPET_FILE_EXTENSION);
}

/**
* Associated URI of the reference.
*/
Expand Down

0 comments on commit 2e23acb

Please sign in to comment.