Merge pull request #6276 from uinstinct/remote-ripgprep

fix: skip ripgrep if workspace is remote
This commit is contained in:
Patrick Erichsen 2025-06-25 11:19:10 -07:00 • committed by GitHub
commit dae12185d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 67 additions and 4 deletions

View file

@ -39,7 +39,7 @@ import { GlobalContext } from "../../util/GlobalContext";
import { modifyAnyConfigWithSharedConfig } from "../sharedConfig";
import { getControlPlaneEnvSync } from "../../control-plane/env";
import { baseToolDefinitions } from "../../tools";
import { getToolsForIde } from "../../tools";
import { getCleanUriPath } from "../../util/uri";
import { getAllDotContinueDefinitionFiles } from "../loadLocalAssistants";
import { LocalPlatformClient } from "./LocalPlatformClient";
@ -187,7 +187,7 @@ async function configYamlToContinueConfig(options: {
const continueConfig: ContinueConfig = {
slashCommands: [],
tools: [...baseToolDefinitions],
tools: await getToolsForIde(ide),
mcpServerStatuses: [],
contextProviders: [],
modelsByRole: {

2
core/index.d.ts vendored
View file

@ -731,6 +731,8 @@ export interface IDE {
isTelemetryEnabled(): Promise<boolean>;
isWorkspaceRemote(): Promise<boolean>;
getUniqueId(): Promise<string>;
getTerminalContents(): Promise<string>;

View file

@ -70,6 +70,7 @@ export type ToIdeFromWebviewOrCoreProtocol = {
];
getAvailableThreads: [undefined, Thread[]];
isTelemetryEnabled: [undefined, boolean];
isWorkspaceRemote: [undefined, boolean];
getUniqueId: [undefined, string];
getTags: [string, IndexTag[]];
readSecrets: [{ keys: string[] }, Record<string, string>];

View file

@ -106,6 +106,10 @@ export class MessageIde implements IDE {
return this.request("isTelemetryEnabled", undefined);
}
isWorkspaceRemote(): Promise<boolean> {
return this.request("isWorkspaceRemote", undefined);
}
getUniqueId(): Promise<string> {
return this.request("getUniqueId", undefined);
}

View file

@ -1,4 +1,4 @@
import { ConfigDependentToolParams, Tool } from "..";
import { ConfigDependentToolParams, IDE, Tool } from "..";
import { createNewFileTool } from "./definitions/createNewFile";
import { createRuleBlock } from "./definitions/createRuleBlock";
import { editFileTool } from "./definitions/editFile";
@ -13,12 +13,14 @@ import { runTerminalCommandTool } from "./definitions/runTerminalCommand";
import { searchWebTool } from "./definitions/searchWeb";
import { viewDiffTool } from "./definitions/viewDiff";
// missing support for remote os calls: https://github.com/microsoft/vscode/issues/252269
export const localOnlyToolDefinitions = [grepSearchTool];
export const baseToolDefinitions = [
readFileTool,
editFileTool,
createNewFileTool,
runTerminalCommandTool,
grepSearchTool,
globSearchTool,
searchWebTool,
viewDiffTool,
@ -34,3 +36,8 @@ export const baseToolDefinitions = [
export const getConfigDependentToolDefinitions = (
params: ConfigDependentToolParams,
): Tool[] => [requestRuleTool(params)];
export const getToolsForIde = async (ide: IDE) =>
(await ide.isWorkspaceRemote())
? baseToolDefinitions
: [...baseToolDefinitions, ...localOnlyToolDefinitions];

View file

@ -48,6 +48,10 @@ class FileSystemIde implements IDE {
return;
}
isWorkspaceRemote(): Promise<boolean> {
return Promise.resolve(false);
}
async getIdeSettings(): Promise<IdeSettings> {
return {
remoteConfigServerUrl: undefined,

View file

@ -126,6 +126,10 @@ class IntelliJIDE(
return true
}
override suspend fun isWorkspaceRemote(): Boolean {
return this.getIdeInfo().remoteName != "local"
}
override suspend fun getUniqueId(): String {
return getMachineUniqueID()
}

View file

@ -102,6 +102,8 @@ interface IDE {
suspend fun isTelemetryEnabled(): Boolean
suspend fun isWorkspaceRemote(): Boolean
suspend fun getUniqueId(): String
suspend fun getTerminalContents(): String

View file

@ -200,6 +200,10 @@ class VsCodeIde implements IDE {
return globalEnabled && continueEnabled;
}
isWorkspaceRemote(): Promise<boolean> {
return Promise.resolve(vscode.env.remoteName !== undefined);
}
getUniqueId(): Promise<string> {
return Promise.resolve(vscode.env.machineId);
}

View file

@ -0,0 +1,35 @@
# create the docker file
cat > Dockerfile << 'EOF'
FROM ubuntu:latest
ENV DEBIAN_FRONTEND=noninteractive
# Install SSH server
RUN apt-get update && apt-get install -y openssh-server
# Configure SSH
RUN mkdir /var/run/sshd
RUN echo 'root:my_password' | chpasswd
# Allow root login
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
EOF
docker build -t continue-ubuntu-ssh . # build the image
rm Dockerfile # remove the created Dockerfile
container_name="continue-ssh-container"
docker run -d -p 2222:22 --name $container_name continue-ubuntu-ssh # run the container
echo "docker container ${container_name} running on port 2222"
# add the instructions
bold=$(tput bold)
normal=$(tput sgr0)
echo "\n--------------------------------------"
echo "now ssh into vscode (using remote explorer) with the following command: ${bold}ssh root@localhost -p 2222${normal}"
echo "use the following password - \"${bold}my_password${normal}\""