Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send server contextualization to Copilot extension #24230

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unnecessary server context and extension service
lewis-sanchez committed Aug 28, 2023
commit c85563879475e64defc2a00aa849203560878ee3
Original file line number Diff line number Diff line change
@@ -18,8 +18,6 @@ import { FILE_QUERY_EDITOR_TYPEID } from 'sql/workbench/common/constants';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { IResourceEditorInput } from 'vs/platform/editor/common/editor';
import { IServerContextualizationService } from 'sql/workbench/services/contextualization/common/interfaces';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';

export class FileQueryEditorInput extends QueryEditorInput {

@@ -32,11 +30,9 @@ export class FileQueryEditorInput extends QueryEditorInput {
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
@IQueryModelService queryModelService: IQueryModelService,
@IConfigurationService configurationService: IConfigurationService,
@IInstantiationService instantiationService: IInstantiationService,
@IServerContextualizationService serverContextualizationService: IServerContextualizationService,
@IExtensionService extensionService: IExtensionService
@IInstantiationService instantiationService: IInstantiationService
) {
super(description, text, results, connectionManagementService, queryModelService, configurationService, instantiationService, serverContextualizationService, extensionService);
super(description, text, results, connectionManagementService, queryModelService, configurationService, instantiationService);
}

public override resolve(): Promise<ITextFileEditorModel | BinaryEditorModel> {
Original file line number Diff line number Diff line change
@@ -22,8 +22,6 @@ import { IUntitledQueryEditorInput } from 'sql/workbench/common/editor/query/unt
import { IEditorResolverService } from 'vs/workbench/services/editor/common/editorResolverService';
import { Uri } from 'vscode';
import { ILogService } from 'vs/platform/log/common/log';
import { IServerContextualizationService } from 'sql/workbench/services/contextualization/common/interfaces';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';

export class UntitledQueryEditorInput extends QueryEditorInput implements IUntitledQueryEditorInput {

@@ -38,11 +36,9 @@ export class UntitledQueryEditorInput extends QueryEditorInput implements IUntit
@IConfigurationService configurationService: IConfigurationService,
@IInstantiationService instantiationService: IInstantiationService,
@ILogService private readonly logService: ILogService,
@IEditorResolverService private readonly editorResolverService: IEditorResolverService,
@IServerContextualizationService serverContextualizationService: IServerContextualizationService,
@IExtensionService extensionService: IExtensionService
@IEditorResolverService private readonly editorResolverService: IEditorResolverService
) {
super(description, text, results, connectionManagementService, queryModelService, configurationService, instantiationService, serverContextualizationService, extensionService);
super(description, text, results, connectionManagementService, queryModelService, configurationService, instantiationService);
// Set the mode explicitely to stop the auto language detection service from changing the mode unexpectedly.
// the auto language detection service won't do the language change only if the mode is explicitely set.
// if the mode (e.g. kusto, sql) do not exist for whatever reason, we will default it to sql.
6 changes: 1 addition & 5 deletions src/sql/workbench/common/editor/query/queryEditorInput.ts
Original file line number Diff line number Diff line change
@@ -20,8 +20,6 @@ import { AbstractTextResourceEditorInput } from 'vs/workbench/common/editor/text
import { IQueryEditorConfiguration } from 'sql/platform/query/common/query';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IServerContextualizationService } from 'sql/workbench/services/contextualization/common/interfaces';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';

const MAX_SIZE = 13;

@@ -153,9 +151,7 @@ export abstract class QueryEditorInput extends EditorInput implements IConnectab
@IConnectionManagementService private readonly connectionManagementService: IConnectionManagementService,
@IQueryModelService private readonly queryModelService: IQueryModelService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IInstantiationService protected readonly instantiationService: IInstantiationService,
@IServerContextualizationService private readonly serverContextualizationService: IServerContextualizationService,
@IExtensionService private readonly extensionService: IExtensionService
@IInstantiationService protected readonly instantiationService: IInstantiationService
) {
super();

Original file line number Diff line number Diff line change
@@ -467,7 +467,7 @@ suite('commandLineService tests', () => {
let uri = URI.file(args._[0]);
const workbenchinstantiationService = workbenchInstantiationService();
const editorInput = workbenchinstantiationService.createInstance(FileEditorInput, uri, undefined, undefined, undefined, undefined, undefined, undefined);
const queryInput = new FileQueryEditorInput(undefined, editorInput, undefined, connectionManagementService.object, querymodelService.object, configurationService.object, workbenchinstantiationService, undefined, undefined);
const queryInput = new FileQueryEditorInput(undefined, editorInput, undefined, connectionManagementService.object, querymodelService.object, configurationService.object, workbenchinstantiationService);
queryInput.state.connected = true;
const editorService: TypeMoq.Mock<IEditorService> = TypeMoq.Mock.ofType<IEditorService>(TestEditorService, TypeMoq.MockBehavior.Strict);
editorService.setup(e => e.editors).returns(() => [queryInput]);
Original file line number Diff line number Diff line change
@@ -316,8 +316,6 @@ suite('SQL QueryEditor Tests', () => {
configurationService.object,
testinstantiationService,
undefined,
undefined,
undefined,
undefined
);
});