Compare commits

...

3 Commits

Author SHA1 Message Date
Dennis Bartlett 7b299b45e6 Add changeset 2025-03-03 16:09:52 -08:00
Dennis Bartlett 27ded9ce6a Fix Format 2025-03-03 16:02:09 -08:00
Dennis Bartlett a89823362e Update linting to include webview. Fix outstanding lint issues. 2025-03-03 16:01:48 -08:00
6 changed files with 27 additions and 10 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"claude-dev": patch
---
Add webview to lint job
+1 -1
View File
@@ -226,7 +226,7 @@
"watch-tests": "tsc -p . -w --outDir out",
"pretest": "npm run compile-tests && npm run compile && npm run lint",
"check-types": "tsc --noEmit",
"lint": "eslint src --ext ts",
"lint": "eslint src --ext ts && eslint webview-ui/src --ext ts",
"format": "prettier . --check",
"format:fix": "prettier . --write",
"test": "vscode-test",
+15 -5
View File
@@ -180,7 +180,9 @@ export function getContextMenuOptions(
const seen = new Set()
const deduped = allItems.filter((item) => {
const key = `${item.type}-${item.value}`
if (seen.has(key)) return false
if (seen.has(key)) {
return false
}
seen.add(key)
return true
})
@@ -195,18 +197,26 @@ export function shouldShowContextMenu(text: string, position: number): boolean {
const beforeCursor = text.slice(0, position)
const atIndex = beforeCursor.lastIndexOf("@")
if (atIndex === -1) return false
if (atIndex === -1) {
return false
}
const textAfterAt = beforeCursor.slice(atIndex + 1)
// Check if there's any whitespace after the '@'
if (/\s/.test(textAfterAt)) return false
if (/\s/.test(textAfterAt)) {
return false
}
// Don't show the menu if it's a URL
if (textAfterAt.toLowerCase().startsWith("http")) return false
if (textAfterAt.toLowerCase().startsWith("http")) {
return false
}
// Don't show the menu if it's a problems or terminal
if (textAfterAt.toLowerCase().startsWith("problems") || textAfterAt.toLowerCase().startsWith("terminal")) return false
if (textAfterAt.toLowerCase().startsWith("problems") || textAfterAt.toLowerCase().startsWith("terminal")) {
return false
}
// NOTE: it's okay that menu shows when there's trailing punctuation since user could be inputting a path with marks
+3 -1
View File
@@ -35,7 +35,9 @@ export function findMatchingResourceOrTemplate(
): McpResource | McpResourceTemplate | undefined {
// First try to find an exact resource match
const exactMatch = resources.find((resource) => resource.uri === uri)
if (exactMatch) return exactMatch
if (exactMatch) {
return exactMatch
}
// If no exact match, try to find a matching template
return findMatchingTemplate(uri, templates)
@@ -36,7 +36,5 @@ export function useDebounceEffect(effect: VoidFn, delay: number, deps: any[]) {
// We want to reschedule if any item in `deps` changed,
// or if `delay` changed.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [delay, ...deps])
}
+3 -1
View File
@@ -35,7 +35,9 @@ export function hexToRGB(hexColor: string): { r: number; g: number; b: number }
export function colorToHex(colorVar: string): string {
const value = getComputedStyle(document.documentElement).getPropertyValue(colorVar).trim()
if (value.startsWith("#")) return value.slice(0, 7)
if (value.startsWith("#")) {
return value.slice(0, 7)
}
const rgbValues = value.match(/\d+/g)?.slice(0, 3).map(Number) || []
return `#${rgbValues.map((x) => x.toString(16).padStart(2, "0")).join("")}`