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

[WIP] VS Code extension #137

Draft
wants to merge 71 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
d9b095a
Add skeleton of VS Code extension
mhutch Oct 5, 2023
9d79f45
Enable syntax highlighting in VS Code
mhutch Oct 5, 2023
d58b146
Merge VS Code extension workspace into toplevel workspace
mhutch Oct 5, 2023
ed9a0e3
Get LSP server infrastructure set up
mhutch Jan 23, 2024
b40ccdd
More LSP imports - logging/hosting
mhutch Jan 23, 2024
6e4cf87
Update Roslyn and track changes
mhutch May 7, 2024
cfa6733
Stub out an LSP test project
mhutch May 7, 2024
8673379
Use a resolvable System.CommandLine version
mhutch May 7, 2024
4550d9e
Fix some warnings
mhutch May 17, 2024
08bb5f1
Update Roslyn again for System.Text.Json changeover
mhutch May 17, 2024
ff94daf
Get some Roslyn LSP test infrastructure compiling
mhutch May 18, 2024
3abd168
Get basic LSP initialization test working
mhutch May 20, 2024
f173c14
Eliminate duplicate TextWithMarkers
mhutch May 20, 2024
1de9177
Add dummy LSP hover handler and a test
mhutch May 20, 2024
3ad051b
Switch to dotnet build on windows CI
mhutch May 21, 2024
1997fe7
Fix non-Windows full solution build
mhutch May 21, 2024
b9e4aa7
WIP: Importing Roslyn workspace code
mhutch May 21, 2024
b01e15c
Use non-LSP Roslyn code via package ref instead of source
mhutch May 22, 2024
238257e
Fix regressions caused by TextWithMarkers change
mhutch May 23, 2024
967c3f1
Implement basic workspace and parser services
mhutch May 24, 2024
3e7fee2
Fully (?) port hover handler
mhutch May 29, 2024
81c156a
Update VSCode extension build
mhutch May 29, 2024
ea45d11
Fix rendering of navigation hovers
mhutch May 30, 2024
9f7c0eb
Get the hover handler fully working
mhutch May 30, 2024
540057b
Import & parameterize vscode-csharp server startup code
mhutch May 30, 2024
d840931
Wire up imported code and E2E server connection
mhutch May 30, 2024
1bfc42d
Further parameterize server activation
mhutch May 31, 2024
d27ba4d
Improve hover rendering
mhutch May 31, 2024
13cef54
Fix tests
mhutch Jun 1, 2024
b03f383
Clean up diagnostic message API a little
mhutch Jun 1, 2024
dcc79d0
Implement support for diagnostics in LSP
mhutch Jun 1, 2024
d674d5e
Update roslyn & use lsp-protcol-types branch
mhutch Aug 15, 2024
969b4e8
Update roslyn for LSP types merge
mhutch Aug 20, 2024
0639167
Update MonoDevelop.Xml
mhutch Aug 23, 2024
2fd2540
Improve capability checks in hover markdown
mhutch Aug 23, 2024
c24a1f4
Implement tag/attribute completion
mhutch Aug 23, 2024
324116d
Add middleware for completion doc tooltips
mhutch Aug 23, 2024
04169fb
Track fix in server pipe name casing
mhutch Aug 23, 2024
8fbaa45
Tag deprection diagnostics appropriately
mhutch Aug 23, 2024
d7944f7
Fix nullability in TestFileSystem
mhutch Aug 23, 2024
d86a34c
Clean up collection of navigation targets
mhutch Aug 23, 2024
cbd572f
Fix missing resource file
mhutch Aug 30, 2024
d64be63
Extract VS Editor code to new project for LSP to share
mhutch Aug 30, 2024
e2ecaf0
Fix a couple issues in DisplayElementRenderer
mhutch Aug 30, 2024
0ca5a53
Implement expression completion in LSP
mhutch Aug 30, 2024
c6d69dd
Sort Directory.Packages.props
mhutch Sep 3, 2024
87c6d9c
Remove more duplicate Roslyn imports
mhutch Sep 3, 2024
0a24753
Update MD.Xml to remove MiniEditor dependency
mhutch Sep 3, 2024
518b668
Fix errors and deadlocks in tests w/ new VSEditor test host
mhutch Sep 4, 2024
8c64ae3
Fix internal error in task validation
mhutch Sep 4, 2024
5fc8efb
Fix build
mhutch Sep 5, 2024
31392be
Factor out more shared code and implement AllowTextContentInElement
mhutch Sep 5, 2024
dc77665
Port MSBuildCompletionTests to LSP
mhutch Sep 5, 2024
f01addb
Import files from ProjFileTools
mhutch Sep 5, 2024
058519f
Implement package id/version completion in LSP
mhutch Sep 6, 2024
8a8b928
Fix missing VS Code problem matcher recommendation
mhutch Sep 6, 2024
ef72afb
Add EditRange to improve correctness of commits and matching
mhutch Sep 6, 2024
f4aef66
Add built in analyzers to LSP diagnostics
mhutch Sep 12, 2024
22c1d5d
Declaration span instead of offset in TaskInfo
mhutch Sep 12, 2024
26505fa
Move some navigation stuff to Editor.Common
mhutch Sep 12, 2024
d388fd1
Ensure FunctionTypeProvider is initialized
mhutch Sep 12, 2024
b003358
Add ) when committing $(
mhutch Sep 12, 2024
077b919
Fix some stray format specifiers
mhutch Sep 12, 2024
9bcd744
Expose LspXmlParserService state machine
mhutch Sep 12, 2024
373d5cc
Fix including analyzer output in diagnostics
mhutch Sep 12, 2024
d442ac5
Implement Go To Definition in LSP
mhutch Sep 12, 2024
78d9f15
Implement Find References
mhutch Sep 12, 2024
4c19949
Populate package ID completion before first char is typed
mhutch Sep 12, 2024
a0c6bb2
Update VS Code matching brackets
mhutch Sep 12, 2024
80d94ad
Fix automatically triggering completion in several places
mhutch Sep 12, 2024
62d0028
Fix test data paths for CI
mhutch Sep 12, 2024
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
27 changes: 16 additions & 11 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ indent_size = 2
indent_style = space
indent_size = 4

# VS Code config files
[*.vscode/*.json]
indent_style = tab
indent_size = 2

# Dotnet code style settings:
[*.{cs,vb}]

Expand Down Expand Up @@ -154,31 +159,31 @@ dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
dotnet_naming_symbols.non_field_members.required_modifiers =

# Naming styles

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
Expand Down
30 changes: 8 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,19 @@ jobs:
dotnet-version: |
8.0.x

- name: Find MSBuild
if: startsWith(matrix.os, 'windows')
uses: microsoft/setup-msbuild@v2

- uses: actions/cache@v4
with:
path: ${{ env.NUGET_PACKAGES }}
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Restore (dotnet)
if: startsWith(matrix.os, 'macos')
- name: Restore
run: dotnet restore -p:Configuration=${{ matrix.config }}

- name: Build (dotnet)
if: startsWith(matrix.os, 'macos')
- name: Build
run: dotnet build --no-restore -c ${{ matrix.config }} -p:CreatePackage=true

- name: Restore (MSBuild)
if: startsWith(matrix.os, 'windows')
run: msbuild -t:Restore -p:Configuration=${{ matrix.config }}

- name: Build (MSBuild)
if: startsWith(matrix.os, 'windows')
run: msbuild MonoDevelop.MSBuildEditor.sln -p:Configuration=${{ matrix.config }}

- name: Test
run: dotnet test --no-build -c ${{ matrix.config }}

Expand All @@ -65,9 +51,9 @@ jobs:
name: MSBuild Editor Extension Package (VSWin)
path: MonoDevelop.MSBuild.Editor.VisualStudio/bin/**/*.vsix

- uses: actions/upload-artifact@v4
if: startsWith(matrix.os, 'macos')
with:
name: MSBuild Editor Extension Package (VSMac)
path: MonoDevelop.MSBuildEditor/bin/**/*.mpack
if-no-files-found: error
# - uses: actions/upload-artifact@v4
# if: startsWith(matrix.os, 'macos')
# with:
# name: MSBuild Editor Extension Package (VSMac)
# path: MonoDevelop.MSBuildEditor/bin/**/*.mpack
# if-no-files-found: error
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ packages
.vs
*.user
*.binlog
out
node_modules
.vscode-test
dist
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "external/ProjFileTools"]
path = external/ProjFileTools
url = https://github.com/mhutch/ProjFileTools.git
[submodule "MonoDevelop.Xml"]
path = MonoDevelop.Xml
url = https://github.com/mhutch/MonoDevelop.Xml.git
[submodule "external/NuGet.Client"]
path = external/NuGet.Client
url = https://github.com/NuGet/NuGet.Client.git
[submodule "external/roslyn"]
path = external/roslyn
url = https://github.com/dotnet/roslyn.git
13 changes: 13 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint",
"amodio.tsl-problem-matcher",
"ms-vscode.extension-test-runner",
"ms-dotnettools.csharp",
"streetsidesoftware.code-spell-checker",
"editorconfig.editorconfig",
"connor4312.esbuild-problem-matchers",
]
}
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run VS Code Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/msbuild-editor-vscode",
],
"env": {
"MSBUILD_LANGUAGE_SERVER_PATH": "${workspaceFolder}/artifacts/bin/MSBuildLanguageServer/debug/MSBuildLanguageServer.dll",
},
"outFiles": [
"${workspaceFolder}/msbuild-editor-vscode/dist/**/*.js"
],
"sourceMaps": true,
"preLaunchTask": "Build VS Code Extension in Background",
}
]
}
21 changes: 20 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
"/*.buildschema.json"
],
"url": "./MonoDevelop.MSBuild/Schemas/buildschema.json"
},
{
"fileMatch": [
"/*.tmLanguage.json"
],
"url": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json"
}
],
"cSpell.words": [
Expand All @@ -19,16 +25,29 @@
"fxcop",
"Hotpatchable",
"LCID",
"msbuild",
"mscorlib",
"Multitargeting",
"netstandard",
"overridable",
"Precompiled",
"refactorings",
"resx",
"ruleset",
"Struct",
"Toolset",
"unescaping",
"VSINSTALLDIR"
]
],
"files.exclude": {
"msbuild-editor-vscode/out": false,
"msbuild-editor-vscode/dist": false
},
"search.exclude": {
"msbuild-editor-vscode/out": true,
"msbuild-editor-vscode/dist": true
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",
"debug.allowBreakpointsEverywhere": true
}
86 changes: 86 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"label": "Build VS Code Extension in Background",
"dependsOn": [
"npm: watch:tsc",
"npm: watch:esbuild"
],
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "npm: watch:esbuild",
"type": "npm",
"script": "watch:esbuild",
"path": "msbuild-editor-vscode",
"group": "build",
"problemMatcher": {
"base": "$esbuild-watch",
"fileLocation": [
"relative",
"${workspaceFolder}/msbuild-editor-vscode"
]
},
"isBackground": true,
"presentation": {
"group": "watch",
"reveal": "never"
}
},
{
"label": "npm: watch:tsc",
"type": "npm",
"script": "watch:tsc",
"path": "msbuild-editor-vscode",
"group": "build",
"problemMatcher": {
"base": "$tsc-watch",
"fileLocation": [
"relative",
"${workspaceFolder}/msbuild-editor-vscode"
]
},
"isBackground": true,
"presentation": {
"group": "watch",
"reveal": "never"
}
},
{
"label": "npm: watch-tests",
"type": "npm",
"script": "watch-tests",
"path": "msbuild-editor-vscode",
"problemMatcher": {
"base": "$tsc-watch",
"fileLocation": [
"relative",
"${workspaceFolder}/msbuild-editor-vscode"
]
},
"isBackground": true,
"presentation": {
"reveal": "never",
"group": "watchers"
},
"group": "build"
},
{
"label": "Build VS Code Tests in Background",
"dependsOn": [
"npm: watch",
"npm: watch-tests"
],
"problemMatcher": []
}
]
}
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
<DebugType>embedded</DebugType>
<NBGV_ThisAssemblyNamespace>$(MSBuildProjectName)</NBGV_ThisAssemblyNamespace>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<UseArtifactsOutput>true</UseArtifactsOutput>
</PropertyGroup>
</Project>
Loading
Loading