Skip to content

Commit f24587a

Browse files
committed
Update version to 2.0.4 and improve logging system
- Update version to 2.0.4 in package.json and CHANGELOG.md - Upgrade vscode-languageclient and vscode-languageserver to next.15 and next.13 - Add output channels for VSCode log level control integration - Convert file paths to file:// URLs for Windows compatibility in dynamic imports - Improve logging verbosity levels (info → debug for routine operations) - Add tip in README about controlling AGLint logging via VSCode's log level settings - Update
1 parent 4170701 commit f24587a

File tree

13 files changed

+225
-118
lines changed

13 files changed

+225
-118
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic
77
[Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
88
[Semantic Versioning]: https://semver.org/spec/v2.0.0.html
99

10+
## [2.0.4] (prerelease) - 2025-11-28
11+
12+
### Changed
13+
14+
- Improved logging.
15+
16+
### Fixed
17+
18+
- Loading AGLint on Windows.
19+
1020
## [2.0.3] (prerelease) - 2025-11-28
1121

1222
### Added

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ This extension provides the following configuration options:
107107
| `adblock.enableInMemoryAglintCache` | ⚠️ **Experimental**: Enable or disable in-memory caching of linting results for better performance. | `false` | `true`, `false` |
108108
<!--markdownlint-enable MD013-->
109109

110+
> **💡 Tip**: To control AGLint logging verbosity, use VSCode's built-in log level control:
111+
> Open Command Palette (**Cmd+Shift+P**) → **Developer: Set Log Level...** → Select **AGLint**
112+
110113
### GitHub Linguist support
111114

112115
GitHub supports adblock syntax officially via the [Linguist][linguist] library. Our extension provides a

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"private": true,
88
"dependencies": {
99
"valibot": "^1.1.0",
10-
"vscode-languageclient": "^8.0.2"
10+
"vscode-languageclient": "10.0.0-next.15"
1111
},
1212
"devDependencies": {
1313
"@types/vscode": "^1.74.0"

client/src/extension.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ function createClientForFolder(folder: WorkspaceFolder, serverModule: string): L
228228
workspaceFolder: { uri: folder.uri.toString(), name: folder.name },
229229
},
230230

231+
// Create output channel - this makes the extension appear in "Developer: Set Log Level"
232+
outputChannel: Window.createOutputChannel(`${CLIENT_NAME} (${folder.name})`, { log: true }),
233+
231234
synchronize: {
232235
fileEvents: [
233236
Workspace.createFileSystemWatcher(
@@ -319,6 +322,8 @@ function ensureDefaultClient(serverModule: string) {
319322
const clientOptions: LanguageClientOptions = {
320323
documentSelector: [{ scheme: FileScheme.Untitled, language: LANGUAGE_ID }],
321324
progressOnInitialization: true,
325+
// Create output channel - this makes the extension appear in "Developer: Set Log Level"
326+
outputChannel: Window.createOutputChannel(`${CLIENT_NAME} (untitled)`, { log: true }),
322327
};
323328

324329
// Give the untitled client a unique ID too

client/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"compilerOptions": {
3-
"module": "CommonJS",
3+
"module": "es2020",
44
"target": "es2020",
55
"lib": ["es2020"],
6+
"moduleResolution": "bundler",
67
"outDir": "out",
78
"rootDir": "src",
89
"sourceMap": true,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "adblock",
33
"displayName": "Adblock/AdGuard/uBlock filters grammar",
44
"description": "VS code extension that adds support for ad blocking rules syntax.",
5-
"version": "2.0.3",
5+
"version": "2.0.4",
66
"publisher": "adguard",
77
"icon": "icons/aglint_128x128.png",
88
"main": "./client/out/extension",

pnpm-lock.yaml

Lines changed: 26 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
"debounce": "^3.0.0",
1212
"fast-glob": "^3.3.3",
1313
"preferred-pm": "^4.1.1",
14-
"resolve-from": "^5.0.0",
15-
"vscode-languageserver": "^8.0.2",
14+
"vscode-languageserver": "10.0.0-next.13",
1615
"vscode-languageserver-textdocument": "^1.0.8",
1716
"vscode-uri": "^3.1.0",
1817
"yaml": "^2.7.1"

server/src/context/aglint-context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class AglintContext {
8686
return undefined;
8787
}
8888

89-
connection.console.info(`AGLint module loaded (version: ${aglint.version})`);
89+
connection.console.info(`AGLint module loaded from ${aglint.modulePath} (version: ${aglint.version})`);
9090

9191
const pathAdapter = new aglint.cli.NodePathAdapter();
9292
const fsAdapter = new LSPFileSystemAdapter(documents);
@@ -96,7 +96,7 @@ export class AglintContext {
9696
printTimestamps: false,
9797
printElapsed: false,
9898
colors: false,
99-
logger: (message) => connection.console.info(`[AGLint debug] ${message}`),
99+
logger: (message) => connection.console.debug(`[AGLint debugger] ${message}`),
100100
});
101101

102102
const configResolver = new aglint.cli.ConfigResolver(

server/src/server.ts

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ const LINT_FILE_DEBOUNCE_DELAY = 100;
5656
*/
5757
const connection = createConnection(ProposedFeatures.all);
5858

59+
connection.console.info(`AGLint Language Server starting (Node.js ${process.version})`);
60+
5961
/**
6062
* Create a simple text document manager.
6163
*/
@@ -163,7 +165,7 @@ connection.onInitialize(async (params: InitializeParams) => {
163165
} else {
164166
message += 'without workspace root';
165167
}
166-
connection.console.log(message);
168+
connection.console.debug(message);
167169

168170
// TODO: Define the capabilities of the language server here
169171
const result: InitializeResult = {
@@ -180,7 +182,7 @@ connection.onInitialize(async (params: InitializeParams) => {
180182
// we do not need to handle workspace folder changes.
181183
if (hasWorkspaceFolderCapability) {
182184
connection.workspace.onDidChangeWorkspaceFolders(() => {
183-
connection.console.log('Workspace folder change event received (ignored by per-folder server instance).');
185+
connection.console.warn('Workspace folder change event received (ignored by per-folder server instance).');
184186
});
185187
}
186188

@@ -342,15 +344,15 @@ async function lintFile(textDocument: TextDocument): Promise<void> {
342344
const cachedDiagnostics = lintCache.get(cacheKey);
343345
if (cachedDiagnostics) {
344346
const duration = Date.now() - startTime;
345-
connection.console.info(
347+
connection.console.debug(
346348
`Linting completed for: ${documentPath} (from cache, ${duration}ms)`,
347349
);
348350
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics: cachedDiagnostics });
349351
return;
350352
}
351353
}
352354

353-
connection.console.info(`Linting started for: ${documentPath}`);
355+
connection.console.debug(`Linting file: ${documentPath}`);
354356

355357
const linterRunOptions: LinterRunOptions = {
356358
fileProps: {
@@ -377,7 +379,7 @@ async function lintFile(textDocument: TextDocument): Promise<void> {
377379
}
378380

379381
const duration = Date.now() - startTime;
380-
connection.console.info(`Linting completed for: ${documentPath} (${duration}ms)`);
382+
connection.console.debug(`Linting completed for: ${documentPath} (${duration}ms)`);
381383

382384
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
383385
} catch (error: unknown) {
@@ -415,7 +417,7 @@ const parseConfigCommentTolerant = (rule: string): ConfigCommentRule | null => {
415417
try {
416418
return ConfigCommentRuleParser.parse(rule);
417419
} catch (error: unknown) {
418-
connection.console.error(`'${rule}' is not a valid AGLint config comment rule: ${getErrorMessage(error)}`);
420+
connection.console.debug(`'${rule}' is not a valid AGLint config comment rule: ${getErrorMessage(error)}`);
419421
return null;
420422
}
421423
};
@@ -802,11 +804,11 @@ async function pullSettings() {
802804
// If AGLint is disabled, clean up and return early
803805
if (!settings.enableAglint) {
804806
removeAllDiagnostics();
805-
connection.console.info('AGLint is disabled');
807+
connection.console.debug('AGLint is disabled');
806808
return;
807809
}
808810

809-
connection.console.info('AGLint integration is enabled');
811+
connection.console.debug('AGLint integration is enabled');
810812

811813
// Initialize AGLint context if not already initialized
812814
if (!aglintContext) {
@@ -824,7 +826,7 @@ async function pullSettings() {
824826
}
825827
} else if (previousEnableDebug !== settings.enableAglintDebug) {
826828
// Handle debug setting change
827-
connection.console.info(`AGLint debug mode changed: ${settings.enableAglintDebug}`);
829+
connection.console.info(`AGLint debug mode ${settings.enableAglintDebug ? 'enabled' : 'disabled'}`);
828830

829831
if (settings.enableAglintDebug) {
830832
aglintContext.debuggerInstance.enable();
@@ -833,6 +835,17 @@ async function pullSettings() {
833835
}
834836
}
835837

838+
// Log cache setting changes
839+
if (previousEnableCache !== settings.enableInMemoryAglintCache) {
840+
if (settings.enableInMemoryAglintCache) {
841+
connection.console.info('In-memory linting cache enabled');
842+
} else {
843+
connection.console.info('In-memory linting cache disabled');
844+
lintCache.clear();
845+
connection.console.debug('Cache cleared');
846+
}
847+
}
848+
836849
await refreshLinter();
837850
}
838851

@@ -874,7 +887,7 @@ connection.onInitialized(async () => {
874887

875888
if (hasWorkspaceFolderCapability) {
876889
connection.workspace.onDidChangeWorkspaceFolders(() => {
877-
connection.console.log('Workspace folder change event received.');
890+
connection.console.warn('Workspace folder change event received.');
878891
});
879892
}
880893

@@ -894,5 +907,3 @@ documents.listen(connection);
894907

895908
// Listen on the connection
896909
connection.listen();
897-
898-
connection.console.info(`AGLint Node.js Language Server running in node ${process.version}`);

0 commit comments

Comments
 (0)