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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions example/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ==
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.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
37 changes: 37 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -100,6 +136,7 @@ export function activate(context: vscode.ExtensionContext) {
onDidChangeActiveTextEditor,
onDidChangeTextDocument,
readmeLanguageConfig,
sectionCompletionProvider,
statusBarItem,
previewProvider,
diagnosticCollection
Expand Down