mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 09:35:36 -05:00
default to using extension of the file for editor replacement (#8482)
This commit is contained in:
@@ -14,6 +14,7 @@ import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import * as path from 'vs/base/common/path';
|
||||
|
||||
import { ILanguageAssociationRegistry, Extensions as LanguageAssociationExtensions } from 'sql/workbench/common/languageAssociation';
|
||||
|
||||
@@ -55,6 +56,11 @@ export class EditorReplacementContribution implements IWorkbenchContribution {
|
||||
language = this.modeService.getModeIdByFilepathOrFirstLine(editor.getResource());
|
||||
}
|
||||
|
||||
if (!language) {
|
||||
// just use the extension
|
||||
language = path.extname(editor.getResource().toString()).slice(1); // remove the .
|
||||
}
|
||||
|
||||
if (!language) {
|
||||
const defaultInputCreator = languageAssociationRegistry.getAssociations().filter(e => e.isDefault)[0];
|
||||
if (defaultInputCreator) {
|
||||
|
||||
Reference in New Issue
Block a user