Update the script get-vscode-usages. (#5630)
This commit is contained in:
1 parent
a462a7aded
commit
e7c4757271
3 files changed
+26
-44
No files matched your search
@@ -1,25 +1,30 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
DIR=${1:-src/}
|
FILES=$(git ls-files src|grep -v test|grep -v vscode|grep -v extension.ts|grep -v evals|grep -v standalone|grep -v /dev/)
|
||||||
DEST_DIR=dist-standalone
|
DEST_DIR=dist-standalone
|
||||||
SDK_DEST=$DEST_DIR/vscode-sdk-uses.txt
|
SDK_DEST=$DEST_DIR/vscode-sdk-uses.txt
|
||||||
CSS_DEST=$DEST_DIR/vscode-css-uses.txt
|
CSS_DEST=$DEST_DIR/vscode-css-uses.txt
|
||||||
TMP=/tmp/vscode-sdk-uses.txt.tmp
|
TMP=/tmp/vscode-sdk-uses.txt.tmp
|
||||||
mkdir -p $DEST_DIR
|
mkdir -p $DEST_DIR
|
||||||
|
|
||||||
|
if [[ ${1:-} == "-v" ]]; then
|
||||||
|
grep -Er --color=always 'vscode[?]?\.' $FILES
|
||||||
|
fi
|
||||||
|
|
||||||
{
|
{
|
||||||
git grep -h 'vscode\.' $DIR |
|
grep -Ehr 'vscode[?]?\.' $FILES |
|
||||||
grep -Ev '//.*vscode' | # remove commented out code
|
grep -Ev '//.*vscode' | # remove commented out code
|
||||||
grep -v vscode.commands.executeCommand | # executeCommand is handled separately
|
grep -v vscode.commands.executeCommand | # executeCommand is handled separately
|
||||||
grep -Ev '"vscode' | # remove command strings that get included because they start with vscode
|
#grep -Ev '"vscode' | # remove command strings that get included because they start with vscode
|
||||||
sed 's|.*vscode\.|vscode.|'| # remove everything before vscode.
|
sed 's|.*vscode|vscode|'| # remove everything before vscode.
|
||||||
sed 's/[^a-zA-Z0-9_.].*$//' | # remove everything after last identifier
|
sed 's|?||g' | # remove ? from vcode?.env?.foo
|
||||||
grep -E '\.[a-z][^.]+$' | # remove types (last part of identifier should be lowercase)
|
sed 's/[^a-zA-Z0-9_.?].*$//' | # remove everything after last identifier
|
||||||
cat > $TMP
|
grep -E '\.[a-z][^.]+$' | # remove types (last part of identifier should be lowercase)
|
||||||
|
cat > $TMP
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
grep -rh vscode.commands.executeCommand $DIR |
|
grep -hr 'vscode.commands.executeCommand' $FILES |
|
||||||
perl -ne 'print if /["\x27"]/' | # Remove occurrences where the command is not on the same line (line doesnt contain quote chars) :(
|
perl -ne 'print if /["\x27"]/' | # Remove occurrences where the command is not on the same line (line doesnt contain quote chars) :(
|
||||||
sed -n 's|.*\(vscode.commands.executeCommand[^,]*\).*|\1|p'| # Remove all params after the first one
|
sed -n 's|.*\(vscode.commands.executeCommand[^,]*\).*|\1|p'| # Remove all params after the first one
|
||||||
sed 's|\(".*"\).*|\1)|'| # Close the parantheses
|
sed 's|\(".*"\).*|\1)|'| # Close the parantheses
|
||||||
@@ -40,4 +45,3 @@ sed 's/[),"\\].*$//' | # remove from the end of the var name to the end of the l
|
|||||||
sort | uniq > $CSS_DEST
|
sort | uniq > $CSS_DEST
|
||||||
}
|
}
|
||||||
echo Wrote vscode vars used to $(realpath $CSS_DEST)
|
echo Wrote vscode vars used to $(realpath $CSS_DEST)
|
||||||
|
|
||||||
@@ -2667,23 +2667,6 @@ export class Task {
|
|||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
}
|
}
|
||||||
|
|
||||||
// we want to get diagnostics AFTER terminal cools down for a few reasons: terminal could be scaffolding a project, dev servers (compilers like webpack) will first re-compile and then send diagnostics, etc
|
|
||||||
/*
|
|
||||||
let diagnosticsDetails = ""
|
|
||||||
const diagnostics = await this.diagnosticsMonitor.getCurrentDiagnostics(this.didEditFile || terminalWasBusy) // if cline ran a command (ie npm install) or edited the workspace then wait a bit for updated diagnostics
|
|
||||||
for (const [uri, fileDiagnostics] of diagnostics) {
|
|
||||||
const problems = fileDiagnostics.filter((d) => d.severity === vscode.DiagnosticSeverity.Error)
|
|
||||||
if (problems.length > 0) {
|
|
||||||
diagnosticsDetails += `\n## ${path.relative(cwd, uri.fsPath)}`
|
|
||||||
for (const diagnostic of problems) {
|
|
||||||
// let severity = diagnostic.severity === vscode.DiagnosticSeverity.Error ? "Error" : "Warning"
|
|
||||||
const line = diagnostic.range.start.line + 1 // VSCode lines are 0-indexed
|
|
||||||
const source = diagnostic.source ? `[${diagnostic.source}] ` : ""
|
|
||||||
diagnosticsDetails += `\n- ${source}Line ${line}: ${diagnostic.message}`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
this.taskState.didEditFile = false // reset, this lets us know when to wait for saved files to update terminals
|
this.taskState.didEditFile = false // reset, this lets us know when to wait for saved files to update terminals
|
||||||
|
|
||||||
// waiting for updated diagnostics lets terminal output be the most up-to-date possible
|
// waiting for updated diagnostics lets terminal output be the most up-to-date possible
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import * as vscode from "vscode"
|
|
||||||
import fs from "fs/promises"
|
import fs from "fs/promises"
|
||||||
import * as path from "path"
|
import * as path from "path"
|
||||||
import sizeOf from "image-size"
|
import sizeOf from "image-size"
|
||||||
import { HostProvider } from "@/hosts/host-provider"
|
import { HostProvider } from "@/hosts/host-provider"
|
||||||
import { ShowMessageRequest, ShowMessageType, ShowOpenDialogueRequest } from "@/shared/proto/host/window"
|
import { ShowMessageType } from "@/shared/proto/host/window"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supports processing of images and other file types
|
* Supports processing of images and other file types
|
||||||
@@ -13,26 +12,22 @@ export async function selectFiles(imagesAllowed: boolean): Promise<{ images: str
|
|||||||
const IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "webp"] // supported by anthropic and openrouter
|
const IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "webp"] // supported by anthropic and openrouter
|
||||||
const OTHER_FILE_EXTENSIONS = ["xml", "json", "txt", "log", "md", "docx", "ipynb", "pdf", "xlsx", "csv"]
|
const OTHER_FILE_EXTENSIONS = ["xml", "json", "txt", "log", "md", "docx", "ipynb", "pdf", "xlsx", "csv"]
|
||||||
|
|
||||||
const showDialogueResponse = await HostProvider.window.showOpenDialogue(
|
const showDialogueResponse = await HostProvider.window.showOpenDialogue({
|
||||||
ShowOpenDialogueRequest.create({
|
canSelectMany: true,
|
||||||
canSelectMany: true,
|
openLabel: "Select",
|
||||||
openLabel: "Select",
|
filters: {
|
||||||
filters: {
|
files: imagesAllowed ? [...IMAGE_EXTENSIONS, ...OTHER_FILE_EXTENSIONS] : OTHER_FILE_EXTENSIONS,
|
||||||
files: imagesAllowed ? [...IMAGE_EXTENSIONS, ...OTHER_FILE_EXTENSIONS] : OTHER_FILE_EXTENSIONS,
|
},
|
||||||
},
|
})
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
const fileUris = showDialogueResponse.paths.map((path) => vscode.Uri.file(path))
|
const filePaths = showDialogueResponse.paths
|
||||||
|
|
||||||
if (!fileUris || fileUris.length === 0) {
|
if (!filePaths || filePaths.length === 0) {
|
||||||
return { images: [], files: [] }
|
return { images: [], files: [] }
|
||||||
}
|
}
|
||||||
|
|
||||||
const processFilesPromises = fileUris.map(async (uri) => {
|
const processFilesPromises = filePaths.map(async (filePath) => {
|
||||||
const filePath = uri.fsPath
|
|
||||||
const fileExtension = path.extname(filePath).toLowerCase().substring(1)
|
const fileExtension = path.extname(filePath).toLowerCase().substring(1)
|
||||||
//const fileName = path.basename(filePath)
|
|
||||||
|
|
||||||
const isImage = IMAGE_EXTENSIONS.includes(fileExtension)
|
const isImage = IMAGE_EXTENSIONS.includes(fileExtension)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user