Use 'psql' file extension for Postgres (#1533)
This commit is contained in:
Родитель
b9f7654607
Коммит
ebe79f37f4
15
package.json
15
package.json
|
@ -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();
|
||||
|
|
Загрузка…
Ссылка в новой задаче