From f5a0a9fee1cb454aa1637f6d429adf6afa425f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20S=C3=B8derlind?= Date: Sat, 4 Oct 2025 00:26:24 +0200 Subject: [PATCH 1/2] chore(release): 0.1.3 - Added section heading IntelliSense completion provider - Updated README.md with new feature --- CHANGELOG.md | 5 +++++ README.md | 1 + package.json | 2 +- src/extension.ts | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cacfef..85732ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on Keep a Changelog (https://keepachangelog.com/en/1.0.0/) and this project adheres to Semantic Versioning (https://semver.org/spec/v2.0.0.html). +## [0.1.3] - 2025-10-04 +### Added +- Section heading IntelliSense completion provider (type `==` then space for valid section suggestions) + ## [0.1.1] - 2025-10-03 ### Added - wordpress.org tabbed preview theme (Description, Installation, FAQ, Screenshots, Changelog, Reviews placeholder) @@ -27,4 +31,5 @@ The format is based on Keep a Changelog (https://keepachangelog.com/en/1.0.0/) a - Context menu integration across explorer, editor tab, and editor content - Custom parser for WordPress readme formatting (FAQ, changelog headers, etc.) +[0.1.3]: https://github.com/soderlind/wordpress-readme-preview/compare/v0.1.1...v0.1.3 [0.1.1]: https://github.com/soderlind/wordpress-readme-preview/compare/v0.1.0...v0.1.1 diff --git a/README.md b/README.md index 0d9ecae..a0cc193 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ A Visual Studio Code extension that provides live preview and validation for Wor ✅ **False Positive Prevention** - Accurate detection without hallucinated errors ✅ **Tabbed wordpress.org Layout** - Authentic multi-tab presentation (Description, Installation, FAQ, Screenshots, Changelog) ✅ **Accessible Screenshot Gallery** - Keyboard & screen reader friendly with thumbnails +✅ **Section Heading IntelliSense** - Type `==` then space for valid section name completions ![Alt text](media/example.png) diff --git a/package.json b/package.json index a7b7005..38c8099 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "wordpress-readme-preview", "displayName": "WordPress Readme Preview", "description": "Preview WordPress readme.txt files with accurate rendering and validation", - "version": "0.1.1", + "version": "0.1.3", "publisher": "persoderlind", "engines": { "vscode": "^1.74.0" diff --git a/src/extension.ts b/src/extension.ts index 99ce177..31efcfd 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -72,6 +72,42 @@ export function activate(context: vscode.ExtensionContext) { ] }); + // Completion provider for section headings after '==' at start of line + const SECTION_HEADINGS = [ + 'Description', + 'Installation', + 'Frequently Asked Questions', + 'Screenshots', + 'Changelog', + 'Upgrade Notice' + ]; + + const sectionCompletionProvider = vscode.languages.registerCompletionItemProvider( + { language: 'readme-txt', scheme: 'file' }, + { + provideCompletionItems(document, position) { + const line = document.lineAt(position).text; + const prefix = line.substring(0, position.character); + // Trigger only if line starts with optional whitespace then '==' and no closing '==' yet + const match = prefix.match(/^\s*==\s?(.*)$/); + if (!match) { + return undefined; + } + // If closing '==' already present, do not offer + if (/==\s.*==/.test(line)) { + return undefined; + } + return SECTION_HEADINGS.map(h => { + const item = new vscode.CompletionItem(h, vscode.CompletionItemKind.Module); + item.insertText = `== ${h} ==`; + item.detail = 'WordPress readme section'; + item.sortText = '0_' + h; + return item; + }); + }, + }, ' ' + ); + // Add status bar item const statusBarItem = createStatusBarItem(); updateStatusBarItem(statusBarItem); @@ -100,6 +136,7 @@ export function activate(context: vscode.ExtensionContext) { onDidChangeActiveTextEditor, onDidChangeTextDocument, readmeLanguageConfig, + sectionCompletionProvider, statusBarItem, previewProvider, diagnosticCollection From 68702e7a060c7519c214b9b3e2b29bd90e813903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20S=C3=B8derlind?= Date: Sat, 4 Oct 2025 00:32:50 +0200 Subject: [PATCH 2/2] chore: update version to 0.1.3 in package-lock.json and add a blank line in readme.txt --- example/readme.txt | 1 + package-lock.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/example/readme.txt b/example/readme.txt index f35ba7f..b61cbab 100644 --- a/example/readme.txt +++ b/example/readme.txt @@ -7,6 +7,7 @@ Stable tag: 1.5.3 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html + Run wp-cron on all public sites in a multisite network (REST API based). Formerly known as DSS Cron. == Description == diff --git a/package-lock.json b/package-lock.json index 572f200..4e40701 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wordpress-readme-preview", - "version": "0.1.1", + "version": "0.1.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "wordpress-readme-preview", - "version": "0.1.1", + "version": "0.1.3", "license": "GPL-2.0-or-later", "dependencies": { "marked": "^4.2.5"