Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to Simple DB are documented in this file.

## 0.1.7 - 2026-08-08

### Fixed

- The **Simple DB** right-click submenu now appears for every `.sql` file even when VS Code has not assigned that editor the `sql` language ID.
- Connection selection, query execution, status-bar attachment, keyboard shortcuts, and database navigation now recognize `.sql` files by their file extension as well as by the VS Code SQL language ID.
- Definition/declaration providers now attach to `.sql` resources directly, so `F12`, package specification, and package body navigation do not depend on a separate SQL language extension.

### Changed

- Simple DB now contributes the `.sql` to `sql` language association itself instead of relying on another installed extension to provide it.

## 0.1.6 - 2026-08-08

### Added
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Simple DB

Simple DB `0.1.6` is a Visual Studio Code extension written entirely in JavaScript for working with **SQLite, PostgreSQL, MySQL, SQL Server, and Oracle** through a single interface.
Simple DB `0.1.7` is a Visual Studio Code extension written entirely in JavaScript for working with **SQLite, PostgreSQL, MySQL, SQL Server, and Oracle** through a single interface.

The extension opens regular VS Code SQL documents and loads `src/extension.js` directly: there is no TypeScript, `tsconfig.json`, `dist` folder, or compilation step.

Expand Down Expand Up @@ -42,7 +42,7 @@ The extension opens regular VS Code SQL documents and loads `src/extension.js` d
| SQL Server | `mssql` | databases, schemas, tables, views, procedures/functions, indexes, triggers, sequences, types, synonyms, `GO` |
| Oracle | `oracledb` Thin | schemas, tables, views/materialized views, procedures/functions, packages, indexes, triggers, sequences, types, synonyms, PL/SQL |

Oracle uses the default `node-oracledb` Thin mode, so normal connections do not require Oracle Client to be installed. Simple DB `0.1.6` uses SQL authentication with a username and password for SQL Server.
Oracle uses the default `node-oracledb` Thin mode, so normal connections do not require Oracle Client to be installed. Simple DB `0.1.7` uses SQL authentication with a username and password for SQL Server.

## No imposed row limit by default

Expand Down Expand Up @@ -143,7 +143,7 @@ The `id` is generated and managed by Simple DB. Do not change it. Use **Simple D

### Editor context menu

Right-clicking inside any regular SQL editor shows a native **Simple DB** submenu with the complete working set:
Right-clicking inside any regular `.sql` editor shows a native **Simple DB** submenu with the complete working set. Simple DB recognizes the `.sql` extension directly, so this menu does not depend on another extension assigning the editor's SQL language mode:

- Open Configuration
- Refresh Connections
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 39 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "simple-db-suzdalenko",
"displayName": "Simple DB - SQL Client for SQLite, MySQL, PostgreSQL, SQL Server & Oracle",
"description": "SQL client and database editor for SQLite, MySQL, PostgreSQL, SQL Server (MSSQL) and Oracle. Browse database objects, run queries, manage DDL and export results.",
"version": "0.1.6",
"version": "0.1.7",
"publisher": "suzdalenko-dev",
"license": "MIT",
"icon": "resources/simple-db-marketplace.png",
Expand Down Expand Up @@ -60,6 +60,18 @@
],
"main": "./src/extension.js",
"contributes": {
"languages": [
{
"id": "sql",
"aliases": [
"SQL",
"sql"
],
"extensions": [
".sql"
]
}
],
"commands": [
{
"command": "simpleDb.openConfiguration",
Expand Down Expand Up @@ -479,146 +491,141 @@
"editor/title": [
{
"command": "simpleDb.changeEditorConnection",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "(editorLangId == sql || resourceExtname == .sql) && resourceScheme != simple-db-definition",
"group": "navigation@1"
},
{
"command": "simpleDb.executeCurrent",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "(editorLangId == sql || resourceExtname == .sql) && resourceScheme != simple-db-definition",
"group": "navigation@2"
},
{
"command": "simpleDb.executeDocument",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "(editorLangId == sql || resourceExtname == .sql) && resourceScheme != simple-db-definition",
"group": "navigation@3"
},
{
"command": "simpleDb.cancelQuery",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "(editorLangId == sql || resourceExtname == .sql) && resourceScheme != simple-db-definition",
"group": "navigation@4"
}
],
"editor/context": [
{
"submenu": "simpleDb.editorContextMenu",
"when": "editorLangId == sql",
"when": "editorLangId == sql || resourceExtname == .sql",
"group": "simpleDb@1"
}
],
"simpleDb.editorContextMenu": [
{
"command": "simpleDb.openConfiguration",
"when": "editorLangId == sql",
"group": "1_configuration@1"
},
{
"command": "simpleDb.refreshConnections",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "1_configuration@2"
},
{
"command": "simpleDb.openConnectionsFolder",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "1_configuration@3"
},
{
"command": "simpleDb.changeEditorConnection",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "2_connection@1"
},
{
"command": "simpleDb.addConnection",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "2_connection@2"
},
{
"command": "simpleDb.connect",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "2_connection@3"
},
{
"command": "simpleDb.disconnect",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "2_connection@4"
},
{
"command": "simpleDb.testConnection",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "2_connection@5"
},
{
"command": "simpleDb.editConnection",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "2_connection@6"
},
{
"command": "simpleDb.setPassword",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "2_connection@7"
},
{
"command": "simpleDb.deleteConnection",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "2_connection@8"
},
{
"command": "simpleDb.newQuery",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "3_run@1"
},
{
"command": "simpleDb.executeCurrent",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "3_run@2"
},
{
"command": "simpleDb.executeSelection",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "3_run@3"
},
{
"command": "simpleDb.executeDocument",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "3_run@4"
},
{
"command": "simpleDb.cancelQuery",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "3_run@5"
},
{
"command": "simpleDb.beginTransaction",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "4_transaction@1"
},
{
"command": "simpleDb.commit",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "4_transaction@2"
},
{
"command": "simpleDb.rollback",
"when": "editorLangId == sql && resourceScheme != simple-db-definition",
"when": "resourceScheme != simple-db-definition",
"group": "4_transaction@3"
},
{
"command": "simpleDb.goToDefinition",
"when": "editorLangId == sql",
"group": "5_navigation@1"
},
{
"command": "simpleDb.goToDeclaration",
"when": "editorLangId == sql",
"group": "5_navigation@2"
},
{
"command": "simpleDb.goToPackageSpecification",
"when": "editorLangId == sql",
"group": "5_navigation@3"
},
{
"command": "simpleDb.goToPackageBody",
"when": "editorLangId == sql",
"group": "5_navigation@4"
}
]
Expand All @@ -628,18 +635,18 @@
"command": "simpleDb.executeCurrent",
"key": "ctrl+enter",
"mac": "cmd+enter",
"when": "editorTextFocus && editorLangId == sql && resourceScheme != simple-db-definition"
"when": "editorTextFocus && (editorLangId == sql || resourceExtname == .sql) && resourceScheme != simple-db-definition"
},
{
"command": "simpleDb.executeDocument",
"key": "f5",
"mac": "f5",
"when": "editorTextFocus && editorLangId == sql && resourceScheme != simple-db-definition"
"when": "editorTextFocus && (editorLangId == sql || resourceExtname == .sql) && resourceScheme != simple-db-definition"
},
{
"command": "simpleDb.goToDefinition",
"key": "f12",
"when": "editorTextFocus && editorLangId == sql"
"when": "editorTextFocus && (editorLangId == sql || resourceExtname == .sql)"
}
],
"configuration": {
Expand Down
15 changes: 7 additions & 8 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
const path = require('node:path');
const vscode = require('vscode');
const { ConnectionManager } = require('./managers/connectionManager');
const { EditorSessionManager } = require('./managers/editorSessionManager');
const {
DEFINITION_SCHEME,
EditorSessionManager,
} = require('./managers/editorSessionManager');
SQL_DOCUMENT_SELECTOR,
isSqlDocument,
} = require('./sql/sqlDocument');
const { QueryRunner } = require('./services/queryRunner');
const { SqlNavigationProvider } = require('./views/sqlNavigationProvider');
const { ExportService } = require('./services/exportService');
Expand Down Expand Up @@ -66,10 +68,7 @@ async function profileForCommand(connectionStore, editorSessionManager, node) {
if (nodeProfile) return nodeProfile;

const editor = vscode.window.activeTextEditor;
if (
editor?.document?.languageId === 'sql' &&
editor.document.uri.scheme !== DEFINITION_SCHEME
) {
if (editor && isSqlDocument(editor.document)) {
const session = await editorSessionManager.ensureSession(editor.document);
if (!session) return null;
return connectionStore.get(session.profileId) || null;
Expand Down Expand Up @@ -200,11 +199,11 @@ async function activate(context) {
sqlNavigationProvider,
);
const definitionRegistration = vscode.languages.registerDefinitionProvider(
{ language: 'sql' },
SQL_DOCUMENT_SELECTOR,
sqlNavigationProvider,
);
const declarationRegistration = vscode.languages.registerDeclarationProvider(
{ language: 'sql' },
SQL_DOCUMENT_SELECTOR,
sqlNavigationProvider,
);
context.subscriptions.push(
Expand Down
5 changes: 2 additions & 3 deletions src/managers/editorSessionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
const { randomUUID } = require('node:crypto');
const vscode = require('vscode');
const { getDatabaseEngine } = require('../databaseEngines');

const DEFINITION_SCHEME = 'simple-db-definition';
const { DEFINITION_SCHEME, isSqlDocument } = require('../sql/sqlDocument');

function databaseForProfile(profile, preferred = '') {
return (
Expand Down Expand Up @@ -52,7 +51,7 @@ class EditorSessionManager {
}

_isSqlDocument(document) {
return document?.languageId === 'sql' && document.uri.scheme !== DEFINITION_SCHEME;
return isSqlDocument(document);
}

_canPersist(document) {
Expand Down
28 changes: 28 additions & 0 deletions src/sql/sqlDocument.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'use strict';

const DEFINITION_SCHEME = 'simple-db-definition';

function hasSqlExtension(document) {
const resourcePath = String(document?.uri?.path || document?.uri?.fsPath || '');
return resourcePath.toLowerCase().endsWith('.sql');
}

function isSqlDocument(document, options = {}) {
if (!document?.uri) return false;
if (!options.allowDefinition && document.uri.scheme === DEFINITION_SCHEME) {
return false;
}
return document.languageId === 'sql' || hasSqlExtension(document);
}

const SQL_DOCUMENT_SELECTOR = [
{ language: 'sql' },
{ pattern: '**/*.sql' },
];

module.exports = {
DEFINITION_SCHEME,
SQL_DOCUMENT_SELECTOR,
hasSqlExtension,
isSqlDocument,
};
Loading
Loading