fix: cursor does not respond to listRoots (#826)
This commit is contained in:
@@ -55,7 +55,9 @@ export class BrowserServerBackend implements ServerBackend {
|
|||||||
async initialize(server: mcpServer.Server): Promise<void> {
|
async initialize(server: mcpServer.Server): Promise<void> {
|
||||||
const capabilities = server.getClientCapabilities() as mcpServer.ClientCapabilities;
|
const capabilities = server.getClientCapabilities() as mcpServer.ClientCapabilities;
|
||||||
let rootPath: string | undefined;
|
let rootPath: string | undefined;
|
||||||
if (capabilities.roots) {
|
if (capabilities.roots && (
|
||||||
|
server.getClientVersion()?.name === 'Visual Studio Code' ||
|
||||||
|
server.getClientVersion()?.name === 'Visual Studio Code - Insiders')) {
|
||||||
const { roots } = await server.listRoots();
|
const { roots } = await server.listRoots();
|
||||||
const firstRootUri = roots[0]?.uri;
|
const firstRootUri = roots[0]?.uri;
|
||||||
const url = firstRootUri ? new URL(firstRootUri) : undefined;
|
const url = firstRootUri ? new URL(firstRootUri) : undefined;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ const p = process.platform === 'win32' ? 'c:\\non\\existent\\folder' : '/non/exi
|
|||||||
|
|
||||||
test('should use separate user data by root path', async ({ startClient, server }, testInfo) => {
|
test('should use separate user data by root path', async ({ startClient, server }, testInfo) => {
|
||||||
const { client } = await startClient({
|
const { client } = await startClient({
|
||||||
|
clientName: 'Visual Studio Code', // Simulate VS Code client, roots only work with it
|
||||||
roots: [
|
roots: [
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'test',
|
||||||
@@ -48,6 +49,7 @@ test('check that trace is saved in workspace', async ({ startClient, server, mcp
|
|||||||
const rootPath = testInfo.outputPath('workspace');
|
const rootPath = testInfo.outputPath('workspace');
|
||||||
const { client } = await startClient({
|
const { client } = await startClient({
|
||||||
args: ['--save-trace'],
|
args: ['--save-trace'],
|
||||||
|
clientName: 'Visual Studio Code - Insiders', // Simulate VS Code client, roots only work with it
|
||||||
roots: [
|
roots: [
|
||||||
{
|
{
|
||||||
name: 'workspace',
|
name: 'workspace',
|
||||||
|
|||||||
Reference in New Issue
Block a user