Use 'psql' file extension for Postgres (#1533)

This commit is contained in:
Will Lorey 2020-05-27 11:28:42 -07:00 коммит произвёл GitHub
Родитель b9f7654607
Коммит ebe79f37f4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 21 добавлений и 11 удалений

Просмотреть файл

@ -118,6 +118,15 @@
],
"firstLine": "^#!/.*\\bmongo*\\b",
"configuration": "./grammar/configuration.json"
},
{
"id": "postgres",
"aliases": [
"PostgreSQL"
],
"extensions": [
".psql"
]
}
],
"grammars": [
@ -443,7 +452,7 @@
},
{
"command": "postgreSQL.connectDatabase",
"when": "resourceLangId==sql"
"when": "resourceLangId==postgres"
}
],
"editor/title": [
@ -815,7 +824,7 @@
},
{
"command": "postgreSQL.connectDatabase",
"when": "resourceLangId == sql"
"when": "resourceLangId == postgres"
}
],
"commandPalette": [
@ -845,7 +854,7 @@
},
{
"command": "postgreSQL.executeQuery",
"when": "editorLangId == 'sql'"
"when": "editorLangId == 'postgres'"
}
]
},

Просмотреть файл

@ -79,5 +79,6 @@ export let emulatorPassword = 'C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDu
export const testDb: string = 'test';
export const connectedPostgresKey: string = 'ms-azuretools.vscode-azuredatabases.connectedPostgresDB';
export const sqlFileExtension: string = '.sql';
export const postgresBaseFileName: string = 'pg-query';
export const postgresLanguageId: string = 'postgres';
export const postgresFileExtension: string = `.psql`;
export const postgresBaseFileName: string = 'query';

Просмотреть файл

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { AzureWizard, IActionContext } from "vscode-azureextensionui";
import { postgresBaseFileName, sqlFileExtension } from "../../constants";
import { postgresBaseFileName, postgresFileExtension } from "../../constants";
import { nonNullProp } from "../../utils/nonNull";
import * as vscodeUtil from '../../utils/vscodeUtils';
import { PostgresFunctionsTreeItem } from "../tree/PostgresFunctionsTreeItem";
@ -24,7 +24,7 @@ export async function createPostgresFunctionQuery(context: IActionContext, treeI
await wizard.prompt();
await wizard.execute();
await vscodeUtil.showNewFile(nonNullProp(wizardContext, 'query'), postgresBaseFileName, sqlFileExtension);
await vscodeUtil.showNewFile(nonNullProp(wizardContext, 'query'), postgresBaseFileName, postgresFileExtension);
if (treeItem) {
await connectPostgresDatabase(wizardContext, treeItem.parent);

Просмотреть файл

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { IActionContext } from "vscode-azureextensionui";
import { postgresBaseFileName, sqlFileExtension } from "../../constants";
import { postgresBaseFileName, postgresFileExtension } from "../../constants";
import { ext } from "../../extensionVariables";
import * as vscodeUtil from '../../utils/vscodeUtils';
import { PostgresFunctionTreeItem } from "../tree/PostgresFunctionTreeItem";
@ -15,5 +15,5 @@ export async function openPostgresFunction(context: IActionContext, treeItem?: P
}
const fileName: string = `${treeItem.label}-${postgresBaseFileName}`;
await vscodeUtil.showNewFile(treeItem.definition, fileName, sqlFileExtension);
await vscodeUtil.showNewFile(treeItem.definition, fileName, postgresFileExtension);
}

Просмотреть файл

@ -5,7 +5,7 @@
import { languages } from "vscode";
import { callWithTelemetryAndErrorHandling, IActionContext, registerCommand } from "vscode-azureextensionui";
import { connectedPostgresKey, doubleClickDebounceDelay, postgresBaseFileName, sqlFileExtension } from "../../constants";
import { connectedPostgresKey, doubleClickDebounceDelay, postgresLanguageId } from "../../constants";
import { ext } from "../../extensionVariables";
import { PostgresCodeLensProvider } from "../services/PostgresCodeLensProvider";
import { PostgresDatabaseTreeItem } from "../tree/PostgresDatabaseTreeItem";
@ -24,7 +24,7 @@ import { openPostgresFunction } from "./openPostgresFunction";
export function registerPostgresCommands(): void {
ext.postgresCodeLensProvider = new PostgresCodeLensProvider();
ext.context.subscriptions.push(languages.registerCodeLensProvider({ pattern: `{**/,}*${postgresBaseFileName}*${sqlFileExtension}` }, ext.postgresCodeLensProvider));
ext.context.subscriptions.push(languages.registerCodeLensProvider(postgresLanguageId, ext.postgresCodeLensProvider));
// tslint:disable-next-line: no-floating-promises
loadPersistedPostgresDatabase();