Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode extension packaging fixes #252

Merged
merged 3 commits into from
Sep 26, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:

- name: Pack VSCode Extension
working-directory: msbuild-editor-vscode
run: npx vsce package --no-git-tag-version --pre-release ${{ steps.nbgv.outputs.NpmPackageVersion }}
run: npm run vsix-pack

- uses: actions/upload-artifact@v4
if: startsWith(matrix.os, 'windows')
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ node_modules
.vscode-test
dist

# these are copied during vsix packaging
/msbuild-editor-vscode/LICENSE
/msbuild-editor-vscode/server
/msbuild-editor-vscode/*.vsix
/msbuild-editor-vscode/icon.png
2 changes: 1 addition & 1 deletion MonoDevelop.MSBuild/Analyzers/AppendNoWarnAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AppendNoWarnAnalyzer : MSBuildAnalyzer
readonly MSBuildDiagnosticDescriptor AppendNoWarn = new (
DiagnosticId,
"Append NoWarn values to existing value",
"When settings the `NoWarn` property, you should append the additional values to the existing value of the property. " +
"When setting the `NoWarn` property, you should append the additional values to the existing value of the property. " +
"Otherwise, you may accidentally remove existing values.",
MSBuildDiagnosticSeverity.Warning
);
Expand Down
2 changes: 1 addition & 1 deletion MonoDevelop.MSBuild/Language/CoreDiagnostics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class CoreDiagnostics
public const string DeprecatedWithMessage_Id = nameof(DeprecatedWithMessage);
public static readonly MSBuildDiagnosticDescriptor DeprecatedWithMessage = new (
DeprecatedWithMessage_Id,
"Deprecated {0}",
"Deprecated symbol",
"The {0} `{1}` is deprecated: {2}",
MSBuildDiagnosticSeverity.Warning
);
Expand Down
Binary file added art/icon-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions msbuild-editor-vscode/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ node_modules/**
src/**
.gitignore
.yarnrc
webpack.config.js
vsc-extension-quickstart.md
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
**/.vscode-test.*
**/.vscode-test.*

# the images for the README.md are in this directory so the paths
# are correct when the README.md is viewed in the repo. however, they
# are not needed in the vsix as README.md in the generated package
# has the paths rewritten to https URLs to the GitHub repo
images/**
18 changes: 9 additions & 9 deletions msbuild-editor-vscode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,37 @@ The extension is also available [for Visual Studio](https://marketplace.visualst

MSBuild-specific IntelliSense helps you write your project and target files, with rich contextual completion for MSBuild elements, attributes and expressions.

![Property completion](images/vscode-nowarn-completion.png)
![Property completion](./images/vscode-nowarn-completion.png)

The completion for `PackageReference` attributes queries NuGet.org as you type, and provides completion for package names and package versions.

![Package reference completion](images/vscode-packageref-completion.png)
![Package reference completion](./images/vscode-packageref-completion.png)

There's completion for MSBuild expressions, including condition comparisons, property functions and item functions. The editor also supports *Expand Selection* within MSBuild expressions.

![Expression completion](images/vscode-expression-completion.png)
![Expression completion](./images/vscode-expression-completion.png)

![Condition completion](images/vscode-condition-completion.png)
![Condition completion](./images/vscode-condition-completion.png)

### Navigation

You can use the *Go to Definition* command or *Ctrl-Click* to navigate to any import, SDK or filename. If an import has multiple valid ways it can be evaluated, you can navigate to any of them. When navigating to an SDK, you can navigate to any of the `.props` and `.targets` in it.

The *Find References* command can accurately and precisely find all references to items, properties, metadata and tasks throughout your project and its imports, including in expressions.

![Find References](images/vscode-find-references.png)
![Find References](./images/vscode-find-references.png)

### Quick Info

Quick Info tooltips for items, properties, metadata and values allow you to see their descriptions and expected value types, with deep links into documentation. Tooltips for imports and SDKs show you the paths of the imported files.

![Quick info](images/vscode-quick-info.png)
![Quick info](./images/vscode-quick-info.png)

### Validation and Analyzers

The editor validates your document against the MSBuild language and any imported schemas, and shows these errors and warnings as you type.

![Unknown value validation](images/vscode-validation.png)
![Unknown value validation](./images/vscode-validation.png)

The core validator performs several other diagnostics such as warning about unused symbols, and there is a Roslyn-like analyzer mechanism, and examples of current built-in analyzers include:

Expand All @@ -57,15 +57,15 @@ The core validator performs several other diagnostics such as warning about unus

The editor supports code fixes for several diagnostics, and has refactorings such as *Extract Expression*.

![Code fix for misspelled property value](images/vscode-code-fix.png)
![Code fix for misspelled property value](./images/vscode-code-fix.png)

### Schemas

In addition to the schema inferred from the items, metadata, properties and tasks used in a project's imports, the extension also defines a json-based MSBuild-specific schema format that can be used to provide documentation, type annotations, allowed values, and other information that is used to provide a richer editing and validation experience.

Any targets file can provide a schema 'sidecar', which has the same name as the targets file except with the suffix `.buildschema.json`. The editor will load the sidecar schemas for any targets that it imports. This allows MSBuild targets to provide their own documentation.

![Schema for MSBuild items](images/vscode-schema.png)
![Schema for MSBuild items](./images/vscode-schema.png)

The extension includes built-in schemas for `Microsoft.Common.targets`, `Microsoft.NET.Sdk`, and other common targets and MSBuild SDKs.

Expand Down
8 changes: 6 additions & 2 deletions msbuild-editor-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"author": {
"name": "Mikayla Hutchinson"
},
"icon": "icon.png",
"repository": {
"type": "git",
"url": "https://github.com/mhutch/MonoDevelop.MSBuildEditor.git"
Expand All @@ -25,7 +26,7 @@
"activationEvents": [],
"main": "./dist/extension.js",
"scripts": {
"vscode:prepublish": "cp ../LICENSE . && npm run publish-server && npm run package",
"vscode:prepublish": "npm run publish-server && npm run copy-vsix-assets && npm run package",
"compile": "npm run check-types && npm run lint && node esbuild.js",
"watch": "npm-run-all -p watch:*",
"watch:esbuild": "node esbuild.js --watch",
Expand All @@ -37,7 +38,10 @@
"check-types": "tsc --noEmit",
"lint": "eslint src --ext ts",
"test": "vscode-test",
"publish-server": "dotnet publish ../MSBuildLanguageServer/MSBuildLanguageServer.csproj --configuration Debug --output ./server"
"publish-server": "dotnet publish ../MSBuildLanguageServer/MSBuildLanguageServer.csproj --configuration Debug --output ./server",
"copy-vsix-assets": "cp ../LICENSE . && cp ../art/icon-128.png icon.png",
"vsix-pack": "pwsh -c \"vsce package --baseImagesUrl https://github.com/mhutch/MonoDevelop.MSBuildEditor/raw/HEAD/msbuild-editor-vscode --no-update-package-json --no-git-tag-version --pre-release $(nbgv get-version -v NpmPackageVersion)\"",
"vsix-install": "pwsh -c \"npm run vsix-pack && code --install-extension msbuild-editor-$(nbgv get-version -v NpmPackageVersion).vsix\""
},
"dependencies": {
"@vscode/extension-telemetry": "^0.9.0",
Expand Down
Loading