Skip to content

Commit 06a7d99

Browse files
committed
remove useless method
this method is defined in a strategy to hide context from itself. If we do not want it we can just not use it
1 parent 80f0f3a commit 06a7d99

File tree

8 files changed

+2
-86
lines changed

8 files changed

+2
-86
lines changed

src/services/ghost/strategies/AutoTriggerStrategy.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,6 @@ export class AutoTriggerStrategy extends BasePromptStrategy {
2121
return !!context.document
2222
}
2323

24-
/**
25-
* Minimal context for auto-trigger
26-
* Focus on immediate context only
27-
*/
28-
getRelevantContext(context: GhostSuggestionContext): Partial<GhostSuggestionContext> {
29-
return {
30-
document: context.document,
31-
range: context.range,
32-
recentOperations: context.recentOperations?.slice(0, 3), // Only last 3 operations
33-
// Exclude:
34-
// - userInput (no explicit request)
35-
// - diagnostics (not fixing errors)
36-
// - openFiles (reduces tokens)
37-
}
38-
}
39-
4024
/**
4125
* System instructions for auto-trigger
4226
*/

src/services/ghost/strategies/BasePromptStrategy.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ export abstract class BasePromptStrategy implements PromptStrategy {
2424
*/
2525
abstract canHandle(context: GhostSuggestionContext): boolean
2626

27-
/**
28-
* Filters the context to only include relevant fields for this strategy
29-
*/
30-
abstract getRelevantContext(context: GhostSuggestionContext): Partial<GhostSuggestionContext>
31-
3227
/**
3328
* Generates system instructions for the AI model
3429
*/
@@ -91,15 +86,14 @@ EXAMPLE:
9186
* Generates the user prompt with context
9287
*/
9388
getUserPrompt(context: GhostSuggestionContext): string {
94-
const relevantContext = this.getRelevantContext(context)
95-
return this.buildUserPrompt(relevantContext)
89+
return this.buildUserPrompt(context)
9690
}
9791

9892
/**
9993
* Builds the user prompt from the relevant context
10094
* Must be implemented by each strategy
10195
*/
102-
protected abstract buildUserPrompt(context: Partial<GhostSuggestionContext>): string
96+
protected abstract buildUserPrompt(context: GhostSuggestionContext): string
10397

10498
/**
10599
* Adds the cursor marker to the document text at the specified position

src/services/ghost/strategies/CommentDrivenStrategy.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@ export class CommentDrivenStrategy extends BasePromptStrategy {
3030
return isComment && !context.userInput // User input takes precedence
3131
}
3232

33-
getRelevantContext(context: GhostSuggestionContext): Partial<GhostSuggestionContext> {
34-
return {
35-
document: context.document,
36-
range: context.range,
37-
recentOperations: context.recentOperations,
38-
}
39-
}
40-
4133
protected getSpecificSystemInstructions(): string {
4234
return `You are an expert code generation assistant that implements code based on comments.
4335

src/services/ghost/strategies/InlineCompletionStrategy.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ export class InlineCompletionStrategy extends BasePromptStrategy {
2525
return hasContentBefore && !context.userInput && !context.range.isEmpty === false && isNotAtEnd
2626
}
2727

28-
getRelevantContext(context: GhostSuggestionContext): Partial<GhostSuggestionContext> {
29-
return {
30-
document: context.document,
31-
range: context.range,
32-
}
33-
}
34-
3528
protected getSpecificSystemInstructions(): string {
3629
return `You are an expert code completion assistant specializing in inline completions.
3730

src/services/ghost/strategies/NewLineCompletionStrategy.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,6 @@ export class NewLineCompletionStrategy extends BasePromptStrategy {
2222
return line.trim() === ""
2323
}
2424

25-
/**
26-
* Focus on surrounding code and recent actions
27-
* Exclude diagnostics and user input
28-
*/
29-
getRelevantContext(context: GhostSuggestionContext): Partial<GhostSuggestionContext> {
30-
return {
31-
document: context.document,
32-
range: context.range,
33-
recentOperations: context.recentOperations,
34-
// Exclude:
35-
// - userInput (no explicit request)
36-
// - diagnostics (not relevant for new line)
37-
// - openFiles (reduces tokens)
38-
}
39-
}
40-
4125
/**
4226
* System instructions for new line completion
4327
*/

src/services/ghost/strategies/SelectionRefactorStrategy.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ export class SelectionRefactorStrategy extends BasePromptStrategy {
1717
return !!(context.range && !context.range.isEmpty && !context.userInput)
1818
}
1919

20-
getRelevantContext(context: GhostSuggestionContext): Partial<GhostSuggestionContext> {
21-
return {
22-
document: context.document,
23-
range: context.range,
24-
diagnostics: context.diagnostics,
25-
}
26-
}
27-
2820
protected getSpecificSystemInstructions(): string {
2921
return `You are an expert code refactoring assistant. Your task is to improve selected code while maintaining its functionality.
3022

src/services/ghost/strategies/UserRequestStrategy.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,6 @@ export class UserRequestStrategy extends BasePromptStrategy {
1919
return !!context.userInput && context.userInput.trim().length > 0
2020
}
2121

22-
/**
23-
* Include user input, document, selection, and diagnostics
24-
* Exclude recent operations and open files as they're less relevant
25-
*/
26-
getRelevantContext(context: GhostSuggestionContext): Partial<GhostSuggestionContext> {
27-
return {
28-
document: context.document,
29-
userInput: context.userInput,
30-
range: context.range,
31-
diagnostics: context.diagnostics,
32-
// Explicitly exclude:
33-
// - recentOperations (not needed for explicit requests)
34-
// - openFiles (reduces token usage)
35-
}
36-
}
37-
3822
/**
3923
* System instructions specific to user requests
4024
*/

src/services/ghost/types/PromptStrategy.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,6 @@ export interface PromptStrategy {
3434
*/
3535
canHandle(context: GhostSuggestionContext): boolean
3636

37-
/**
38-
* Filters the context to only include relevant fields for this strategy
39-
* @param context The full suggestion context
40-
* @returns Partial context with only relevant fields
41-
*/
42-
getRelevantContext(context: GhostSuggestionContext): Partial<GhostSuggestionContext>
43-
4437
/**
4538
* Generates system instructions for the AI model
4639
* @param customInstructions Optional custom instructions to append

0 commit comments

Comments
 (0)