Files
vscode/extensions/copilot/test/inline/slashDoc.rb.stest.ts
Johannes Rieken fcbff5831a InlineChatIntent (#1549)
* remove references to old setting `github.copilot.chat.advanced.inlineChat2`

* play with `InlineChatIntent`

* wip

* move things, better/simpler prompt

* cleanup, renames, stuff

* more wip

* done after tool call

* edit and generate stest for new InlineChatIntent

* use codebook for diagnostics

* inline chat fixing stests

* stest run

* remove old Inline2 tests

* remove slash commands for v2, remove the editCodeIntent path for v2

* 💄

* 💄

* Don't use `diagnosticsTimeout` when with inline chat because the new diagnostics will never be read but slow down the result

* fix compile error

* stest run

* update baseline

* prevent some JSON errors from empty output

* unfresh baseline.json

* use `MockGithubAvailableEmbeddingTypesService` in stests

* back to hamfisted skipping of stests

* send telemetry from inline chat intent

* tweak some stests
2025-10-29 10:44:00 +00:00

72 lines
2.4 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { InlineDocIntent } from '../../src/extension/intents/node/docIntent';
import { ssuite, stest } from '../base/stest';
import { forInline, simulateInlineChatWithStrategy } from '../simulation/inlineChatSimulator';
import { assertInlineEdit, fromFixture } from '../simulation/stestUtil';
import { assertDocLinesForInlineComments } from './slashDoc.util';
function assertRubyDocComments(fileContents: string | string[], line: string) {
assertDocLinesForInlineComments(fileContents, line, '#');
}
forInline((strategy, nonExtensionConfigurations, suffix) => {
ssuite({ title: `/doc${suffix}`, language: 'ruby', location: 'inline' }, () => {
stest({ description: 'method', nonExtensionConfigurations }, (testingServiceCollection) => {
return simulateInlineChatWithStrategy(strategy, testingServiceCollection, {
files: [
fromFixture('doc-ruby/fib.rb'),
],
queries: [
{
file: 'fib.rb',
selection: [14, 26],
query: '/doc',
expectedIntent: InlineDocIntent.ID,
validate: async (outcome, workspace, accessor) => {
assertInlineEdit(outcome);
const fileContents = outcome.fileContents;
// assert it contains doc comments above
const lineWithCursor = ' def self.calculate_nth_number(n)';
assertRubyDocComments(fileContents, lineWithCursor);
}
}
],
});
});
stest({ description: 'long method', nonExtensionConfigurations }, (testingServiceCollection) => {
return simulateInlineChatWithStrategy(strategy, testingServiceCollection, {
files: [
fromFixture('doc-ruby/fib.rb'),
],
queries: [
{
file: 'fib.rb',
selection: [30, 33],
query: '/doc',
expectedIntent: InlineDocIntent.ID,
validate: async (outcome, workspace, accessor) => {
assertInlineEdit(outcome);
const fileContents = outcome.fileContents;
// assert it contains doc comments above
const lineWithCursor = ' def self.fibonacci_with_hardcoded_values(n)';
assertRubyDocComments(fileContents, lineWithCursor);
}
}
],
});
});
});
});