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: 8 additions & 4 deletions .github/workflows/publish-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Checkout
run: |
git init .
git remote add origin https://github.com/${{ github.repository }}.git
git fetch --depth=1 origin ${{ github.sha }}
git checkout --detach FETCH_HEAD

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
node-version: '20'
cache: 'npm'

- name: Install dependencies
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout
run: |
git init .
git remote add origin https://github.com/${{ github.repository }}.git
git fetch --depth=1 origin ${{ github.sha }}
git checkout --detach FETCH_HEAD

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
node-version: '20'
cache: 'npm'

- name: Install dependencies
Expand Down
8 changes: 4 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"preLaunchTask": "npm: compile"
},
{
"name": "Extension Tests",
Expand All @@ -16,7 +15,8 @@
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
]
],
"preLaunchTask": "npm: compile"
}
]
}
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

All notable changes to the "SPFx Version Pal" extension will be documented in this file.

## [0.1.3] - 2026-05-27

### Added
- New configuration option `spfxVersionPal.statusBarDisplay` to control status bar content
- Support for minimal status bar display mode (icon only)
- Support for full status bar display mode (icon and text)

### Changed
- Status bar now respects user preference for display mode
- Improved configuration change handling with visual refresh

### Technical
- Added configuration listener for real-time status bar updates
- Implemented display mode toggle between full and minimal views
- Enhanced status bar rendering with forced visual refresh on config changes

## [0.1.2] - 2026-03-15

### Changed
- Updated README documentation with improved descriptions and examples

## [0.1.1] - 2026-02-14

### Changed
Expand Down
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,6 @@ This extension doesn't contribute any VS Code settings.
- The extension relies on package.json dependencies to detect SPFx version
- If SPFx dependencies are not explicitly listed, the version may not be detected

## Release Notes

### 0.0.1

Initial release of SPFx Version Pal

- Basic SPFx version detection
- Status bar display
- Auto-refresh on file changes

## Contributing

Feel free to contribute to this project by submitting issues or pull requests.

## License

See the [LICENSE](LICENSE) file for details.
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.

23 changes: 21 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-spfx-version-pal",
"displayName": "SPFx Version Pal",
"description": "Shows the SharePoint Framework (SPFx) version of the current project in the status bar",
"version": "0.1.1",
"version": "0.1.3",
"publisher": "guidozam",
"license": "MIT",
"icon": "assets/icon.png",
Expand Down Expand Up @@ -43,7 +43,26 @@
"title": "Refresh SPFx Version",
"category": "SPFx Version Pal"
}
]
],
"configuration": {
"title": "SPFx Version Pal",
"properties": {
"spfxVersionPal.statusBarDisplay": {
"type": "string",
"enum": [
"full",
"minimal"
],
"enumDescriptions": [
"Show icon and text in status bar",
"Show only icon in status bar"
],
"default": "full",
"description": "Controls how the SPFx version is displayed in the status bar",
"markdownDescription": "Controls how the SPFx version is displayed in the status bar:\n- **Full**: Shows icon and text 🏷️ SPFx 1.18.2\n- **Minimal**: Shows only icon 🏷️"
}
}
}
},
"scripts": {
"vscode:prepublish": "npm run package",
Expand Down
39 changes: 37 additions & 2 deletions src/spfxVersionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { SPFxVersionUtils } from './spfxVersionUtils';
export class SPFxVersionProvider {
private statusBarItem: vscode.StatusBarItem;
private fileWatcher: vscode.FileSystemWatcher | undefined;
private updateRequestId = 0;

constructor(private context: vscode.ExtensionContext) {
// Create status bar item
Expand All @@ -21,10 +22,21 @@ export class SPFxVersionProvider {
this.setupFileWatcher();

// Listen to workspace folder changes
vscode.workspace.onDidChangeWorkspaceFolders(() => {
const workspaceFoldersChangeDisposable = vscode.workspace.onDidChangeWorkspaceFolders(() => {
this.setupFileWatcher();
this.updateVersion();
});
this.context.subscriptions.push(workspaceFoldersChangeDisposable);

// Listen to configuration changes
const configurationChangeDisposable = vscode.workspace.onDidChangeConfiguration((e) => {
// React to any setting change in the extension section, including reset-to-default transitions.
if (e.affectsConfiguration('spfxVersionPal')) {
console.log('[SPFx Version Pal] Configuration changed, updating version display');
this.updateVersion();
}
});
this.context.subscriptions.push(configurationChangeDisposable);
}

private setupFileWatcher() {
Expand All @@ -49,11 +61,34 @@ export class SPFxVersionProvider {
}

private async updateVersion() {
const requestId = ++this.updateRequestId;
const spfxInfo = await this.detectSPFxVersion();

// Ignore stale async updates so the latest config selection always wins.
if (requestId !== this.updateRequestId) {
return;
}

if (spfxInfo) {
this.statusBarItem.text = `$(milestone) SPFx ${spfxInfo.version}`;
// Get the display mode from configuration
const config = vscode.workspace.getConfiguration('spfxVersionPal');
const displayMode = config.get<string>('statusBarDisplay', 'full');

console.log(`[SPFx Version Pal] Display mode: ${displayMode}`);

// Set text based on display mode
if (displayMode === 'minimal') {
this.statusBarItem.text = `$(milestone)`;
console.log('[SPFx Version Pal] Status bar set to minimal mode');
} else {
this.statusBarItem.text = `$(milestone) SPFx ${spfxInfo.version}`;
console.log(`[SPFx Version Pal] Status bar set to full mode: ${spfxInfo.version}`);
}

this.statusBarItem.tooltip = `SharePoint Framework v${spfxInfo.version}\nProject: ${spfxInfo.projectName}${spfxInfo.relativePath ? `\nLocation: ${spfxInfo.relativePath}` : ''}\nClick to refresh`;

// Force a visual refresh by hiding and showing the status bar
this.statusBarItem.hide();
this.statusBarItem.show();
} else {
this.statusBarItem.hide();
Expand Down
Loading