Skip to content

Commit 34528de

Browse files
authored
Merge pull request #2840 from Kilo-Org/mark/remove-context-analyzer
Remove unused ContextAnalyzer
2 parents 974c507 + 3178fe1 commit 34528de

File tree

3 files changed

+1
-261
lines changed

3 files changed

+1
-261
lines changed

src/services/ghost/ContextAnalyzer.ts

Lines changed: 0 additions & 185 deletions
This file was deleted.

src/services/ghost/PromptStrategyManager.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { GhostSuggestionContext } from "./types"
22
import { PromptStrategy } from "./types/PromptStrategy"
3-
import { ContextAnalyzer } from "./ContextAnalyzer"
43

54
// Import all strategies
65
import { UserRequestStrategy } from "./strategies/UserRequestStrategy"
@@ -16,12 +15,10 @@ import { AutoTriggerStrategy } from "./strategies/AutoTriggerStrategy"
1615
*/
1716
export class PromptStrategyManager {
1817
private strategies: PromptStrategy[]
19-
private contextAnalyzer: ContextAnalyzer
2018
private debug: boolean
2119

2220
constructor(options?: { debug: boolean }) {
2321
this.debug = options?.debug ?? false
24-
this.contextAnalyzer = new ContextAnalyzer()
2522

2623
// Register all strategies in priority order
2724
this.strategies = [
@@ -41,28 +38,11 @@ export class PromptStrategyManager {
4138
* @returns The selected strategy
4239
*/
4340
selectStrategy(context: GhostSuggestionContext): PromptStrategy {
44-
// Analyze context to understand the situation
45-
const analysis = this.contextAnalyzer.analyze(context)
46-
47-
if (this.debug) {
48-
console.log("[PromptStrategyManager] Context analysis:", {
49-
useCase: analysis.useCase,
50-
hasUserInput: analysis.hasUserInput,
51-
hasErrors: analysis.hasErrors,
52-
hasSelection: analysis.hasSelection,
53-
isNewLine: analysis.isNewLine,
54-
isInComment: analysis.isInComment,
55-
isInlineEdit: analysis.isInlineEdit,
56-
})
57-
}
58-
5941
// Find the first strategy that can handle this context
6042
for (const strategy of this.strategies) {
6143
if (strategy.canHandle(context)) {
6244
if (this.debug) {
63-
console.log(
64-
`[PromptStrategyManager] Selected strategy: ${strategy.name} for use case: ${analysis.useCase}`,
65-
)
45+
console.log(`[PromptStrategyManager] Selected strategy: ${strategy.name}`)
6646
}
6747
return strategy
6848
}

src/services/ghost/types/PromptStrategy.ts

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -55,58 +55,3 @@ export interface PromptStrategy {
5555
*/
5656
getUserPrompt(context: GhostSuggestionContext): string
5757
}
58-
59-
/**
60-
* Result of analyzing a suggestion context
61-
*/
62-
export interface ContextAnalysis {
63-
/**
64-
* The primary use case detected
65-
*/
66-
useCase: UseCaseType
67-
68-
/**
69-
* Whether the user provided explicit input
70-
*/
71-
hasUserInput: boolean
72-
73-
/**
74-
* Whether there are compilation errors
75-
*/
76-
hasErrors: boolean
77-
78-
/**
79-
* Whether there are warnings
80-
*/
81-
hasWarnings: boolean
82-
83-
/**
84-
* Whether text is selected
85-
*/
86-
hasSelection: boolean
87-
88-
/**
89-
* Whether the cursor is in a comment
90-
*/
91-
isInComment: boolean
92-
93-
/**
94-
* Whether the cursor is on a new/empty line
95-
*/
96-
isNewLine: boolean
97-
98-
/**
99-
* Whether the cursor is in the middle of a line
100-
*/
101-
isInlineEdit: boolean
102-
103-
/**
104-
* The text of the current line
105-
*/
106-
cursorLine: string
107-
108-
/**
109-
* The cursor's character position
110-
*/
111-
cursorPosition: number
112-
}

0 commit comments

Comments
 (0)