Skip to content

Conversation

@code-crusher
Copy link
Member

@code-crusher code-crusher commented Jan 21, 2026

No description provided.

@matter-ai-bot
Copy link
Contributor

matter-ai-bot bot commented Jan 21, 2026

Context

This PR introduces the ability to mention specific line ranges in files using the #Lstart-end syntax (e.g., @/file.ts#L10-20). It also includes UI refinements for mention chips, settings cleanup, and layout adjustments.

Implementation

  • Regex Update: Modified mentionRegex in context-mentions.ts to capture optional line number patterns.
  • Line Extraction: Updated getFileOrFolderContent in mentions/index.ts to parse the hash fragment and slice the file content accordingly.
  • UI Rendering: Enhanced chat-render.ts and index.css to display line information within mention chips.
  • Cleanup: Refactored KiloCode.tsx and ApiOptions.tsx to remove unused logic and simplify the settings interface.

Summary By MatterAI MatterAI logo

🔄 What Changed

Implemented line-range support for file mentions (#L), updated the mention regex, refined chip UI rendering, and performed significant cleanup of the KiloCode settings provider.

🔍 Impact of the Change

Users can now reference specific code segments, reducing context noise. The settings UI is cleaner, and mention chips now visually indicate the selected line range.

📁 Total Files Changed

Click to Expand
File ChangeLog
Line Parsing src/core/mentions/index.ts Implemented logic to parse #L and slice file content.
Regex Update src/shared/context-mentions.ts Updated regex to support optional line number suffixes.
Test Update src/shared/__tests__/support-prompts.spec.ts Updated test expectations to include line number fragments.
Template Fix src/shared/support-prompt.ts Updated context template to include start and end lines.
UI Spacing webview-ui/src/components/chat/ChatView.tsx Added trailing space after chip insertion for better UX.
Layout Fix webview-ui/src/components/chat/CodeIndexPopover.tsx Adjusted footer layout for better alignment.
Positioning webview-ui/src/components/kilocode/BottomApiConfig.tsx Fixed hover card positioning and transform logic.
Refactor webview-ui/src/components/kilocode/settings/providers/KiloCode.tsx Removed dead code and simplified provider settings.
UI Cleanup webview-ui/src/components/settings/ApiOptions.tsx Commented out/removed advanced settings sections.
Styling webview-ui/src/index.css Added styles for line number display in chips.
Chip Render webview-ui/src/utils/chat-render.ts Updated HTML generation for chips to include line info.

🧪 Test Added/Recommended

Added

  • Updated support-prompts.spec.ts to validate the new mention string format.

Recommended

  • Unit tests for extractTextFromFile specifically targeting edge cases like startLine > endLine or endLine > fileLength.
  • Integration test for the updated mentionRegex with various path formats.

🔒 Security Vulnerabilities

N/A

Screenshots

before after
N/A N/A

How to Test

  • Type @/path/to/file.ts#L10-20 in the chat input.
  • Verify the chip displays the line range.
  • Send the message and ensure only lines 10 through 20 are processed in the context.
  • Check the KiloCode settings page to ensure the UI is simplified as expected.

Get in Touch

N/A

Copy link
Contributor

@matter-ai-bot matter-ai-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 PR Review is completed: The implementation of line-range mentions looks solid with correct regex parsing and file slicing logic. However, there is a significant amount of commented-out code in the UI components (ApiOptions.tsx and KiloCode.tsx), including what appears to be the new DiffSettingsControl component. This dead code should be cleaned up or properly enabled.

Skipped files
  • CHANGELOG.md: Skipped file pattern
  • webview-ui/src/i18n/locales/en/kilocode.json: Skipped file pattern
  • webview-ui/src/i18n/locales/en/settings.json: Skipped file pattern
⬇️ Low Priority Suggestions (2)
webview-ui/src/components/kilocode/settings/providers/KiloCode.tsx (2 suggestions)

Location: webview-ui/src/components/kilocode/settings/providers/KiloCode.tsx (Lines 39-48)

🔵 Code Quality

Issue: Large block of commented-out code (handleInputChange). Dead code should be removed to maintain codebase cleanliness.

Fix: Remove the commented-out code block.

Impact: Improves readability and maintainability.

-  	// const handleInputChange = useCallback(
-  	// 	<K extends keyof ProviderSettings, E>(
-  	// 		field: K,
-  	// 		transform: (event: E) => ProviderSettings[K] = inputEventTransform,
-  	// 	) =>
-  	// 		(event: E | Event) => {
-  	// 			setApiConfigurationField(field, transform(event as E))
-  	// 		},
-  	// 	[setApiConfigurationField],
-  	// )
+  

Location: webview-ui/src/components/kilocode/settings/providers/KiloCode.tsx (Lines 58-61)

🔵 Code Quality

Issue: Commented-out code (handleToggleTesterWarnings).

Fix: Remove the commented-out code block.

Impact: Improves readability.

-  	// const handleToggleTesterWarnings = useCallback(() => {
-  	// 	const newTimestamp = Date.now() + (areKilocodeWarningsDisabled ? 0 : 24 * 60 * 60 * 1000)
-  	// 	setApiConfigurationField("kilocodeTesterWarningsDisabledUntil", newTimestamp)
-  	// }, [areKilocodeWarningsDisabled, setApiConfigurationField])
+  

onChange={(field, value) => setApiConfigurationField(field, value)}
/>
{/* <DiffSettingsControl
<DiffSettingsControl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Code Quality

Issue: The DiffSettingsControl component is added inside a commented-out block ({/* ... */}), making it dead code. It appears the entire advanced settings section is being disabled, but adding new code to a disabled block creates technical debt and confusion.

Fix: If the advanced settings are intended to be disabled for this release, remove the DiffSettingsControl line to keep the codebase clean. If this is a mistake, the surrounding comment wrappers should be removed.

Impact: Improves code maintainability and prevents confusion about active features.

Suggested change
<DiffSettingsControl

@code-crusher code-crusher merged commit e0383c2 into main Jan 21, 2026
6 of 13 checks passed
@code-crusher code-crusher deleted the release/v5.2.5 branch January 21, 2026 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants