Skip to content

Commit d4a0a13

Browse files
committed
#5 - refactor cleanup
- minor cleanup
1 parent b56630f commit d4a0a13

File tree

8 files changed

+107
-115
lines changed

8 files changed

+107
-115
lines changed

.github/workflows/cdp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2-
name: CDP
2+
name: cdp
33

44
on:
55
push:

.vscode/extensions.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
{
22
"recommendations": [
33
"EditorConfig.EditorConfig",
4-
"esbenp.prettier-vscode",
5-
"dbaeumer.vscode-eslint",
6-
"msjsdiag.debugger-for-chrome",
74
"oderwat.indent-rainbow",
85
"aaron-bond.better-comments",
9-
"coenraads.bracket-pair-colorizer",
10-
"rosshamish.kuskus-kusto-language-server",
11-
"rosshamish.kuskus-kusto-syntax-highlighting"
6+
"rust-lang.rust-analyzer",
7+
"swellaby.vscode-rust-test-adapter"
128
]
139
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
# rust-analyzer.vs - Rust language support for Visual Studio
66

7-
[![Discord](https://img.shields.io/discord/1060697970426773584?color=5965F2&label=ask%20for%20help)](https://discord.gg/JyK55EsACr) [![CDP](https://github.com/kitamstudios/rust-analyzer.vs/actions/workflows/cdp.yml/badge.svg)](https://github.com/kitamstudios/rust-analyzer.vs/actions/workflows/cdp.yml) [![License: CC BY-NC-SA 4.0](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey.svg?label=license)](https://creativecommons.org/licenses/by-nc-sa/4.0/) [![Release](https://img.shields.io/github/release/kitamstudios/rust-analyzer.vs.svg?label=release)](https://github.com/kitamstudios/rust-analyzer.vs/releases) [![Visual Studio Marketplace Downloads](https://img.shields.io/visual-studio-marketplace/i/kitamstudios.RustAnalyzer)](https://marketplace.visualstudio.com/items?itemName=kitamstudios.RustAnalyzer) [![Visual Studio Marketplace Rating](https://img.shields.io/visual-studio-marketplace/r/kitamstudios.RustAnalyzer?color=C0442E)](https://marketplace.visualstudio.com/items?itemName=kitamstudios.RustAnalyzer&ssr=false\#review-details) [![Repo stars](https://img.shields.io/github/stars/kitamstudios/rust-analyzer.vs?label=repo%20stars&style=flat)](https://github.com/kitamstudios/rust-analyzer.vs/stargazers)
7+
[![Discord](https://img.shields.io/discord/1060697970426773584?color=5965F2&label=ask%20for%20help)](https://discord.gg/JyK55EsACr) [![CDP](https://github.com/kitamstudios/rust-analyzer.vs/actions/workflows/cdp.yml/badge.svg)](https://github.com/kitamstudios/rust-analyzer.vs/actions/workflows/cdp.yml) [![License: CC BY-NC-SA 4.0](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey.svg?label=license)](https://creativecommons.org/licenses/by-nc-sa/4.0/) [![Release](https://img.shields.io/github/release/kitamstudios/rust-analyzer.vs.svg?label=release)](https://github.com/kitamstudios/rust-analyzer.vs/releases) [![Visual Studio Marketplace Downloads](https://img.shields.io/visual-studio-marketplace/i/kitamstudios.RustAnalyzer?color=A0A22A)](https://marketplace.visualstudio.com/items?itemName=kitamstudios.RustAnalyzer) [![Visual Studio Marketplace Rating](https://img.shields.io/visual-studio-marketplace/r/kitamstudios.RustAnalyzer?color=C0442E)](https://marketplace.visualstudio.com/items?itemName=kitamstudios.RustAnalyzer&ssr=false\#review-details) [![Repo stars](https://img.shields.io/github/stars/kitamstudios/rust-analyzer.vs?label=repo%20stars&style=flat)](https://github.com/kitamstudios/rust-analyzer.vs/stargazers)
88

99

1010
Download this extension from the [Visual Studio Marketplace][marketplace] or get the [CI build][vsixgallery].
1111

12-
**For a superior Rust development experience install the [Rust Development Pack](https://marketplace.visualstudio.com/items?itemName=kitamstudios.RustDevelopmentPack) (includes this extension along with few other usefull extensions).**
12+
**For a superior Rust development experience install the [Rust Development Pack](https://marketplace.visualstudio.com/items?itemName=kitamstudios.RustDevelopmentPack) (includes this extension along with few other useful extensions).**
1313

1414
## Principles
1515

src/RustAnalyzer/Infrastructure/SettingsService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using System;
22
using System.ComponentModel.Composition;
33
using System.Threading.Tasks;
4+
using KS.RustAnalyzer.NodeEnhancements;
45
using KS.RustAnalyzer.TestAdapter.Common;
56
using Microsoft.VisualStudio.Workspace;
67
using Microsoft.VisualStudio.Workspace.Settings;
7-
using static KS.RustAnalyzer.NodeEnhancements.NodeBrowseObjectProvider;
88
using ILogger = KS.RustAnalyzer.TestAdapter.Common.ILogger;
99

1010
namespace KS.RustAnalyzer.Infrastructure;
@@ -36,9 +36,9 @@ public sealed class SettingsService : ISettingsService
3636
{
3737
public const string KindDebugger = "Debugger";
3838
public const string KindBuild = "Build";
39-
public const string TypeCommandLineArguments = nameof(BrowseObject.CommandLineArguments);
40-
public const string TypeDebuggerEnvironment = nameof(BrowseObject.DebuggerEnvironment);
41-
public const string TypeAdditionalBuildArgs = nameof(BrowseObject.AdditionalBuildArguments);
39+
public const string TypeCommandLineArguments = nameof(NodeBrowseObject.CommandLineArguments);
40+
public const string TypeDebuggerEnvironment = nameof(NodeBrowseObject.DebuggerEnvironment);
41+
public const string TypeAdditionalBuildArgs = nameof(NodeBrowseObject.AdditionalBuildArguments);
4242
private readonly PathEx _location;
4343
private readonly IWorkspaceSettingsManager _settingsManager;
4444
private readonly TL _tl;

src/RustAnalyzer/NodeEnhancements/BrowseObject.cs

Lines changed: 0 additions & 98 deletions
This file was deleted.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
using System.ComponentModel;
2+
using System.Runtime.CompilerServices;
3+
using KS.RustAnalyzer.Infrastructure;
4+
5+
namespace KS.RustAnalyzer.NodeEnhancements;
6+
7+
public class NodeBrowseObject : INotifyPropertyChanged
8+
{
9+
private string _commandLineArguments;
10+
private string _debuggerEnvironment;
11+
private string _additionalBuildArguments;
12+
13+
public event PropertyChangedEventHandler PropertyChanged;
14+
15+
[Browsable(false)]
16+
public string RelativePath { get; set; }
17+
18+
[Browsable(false)]
19+
public ISettingsService SS { get; set; }
20+
21+
[Category(SettingsService.KindDebugger)]
22+
[DisplayName("Command line arguments")]
23+
[Description("Command line arguments passed to executable during F5 & CTRL+F5. Example: Arg1 arg2 arg3")]
24+
public string CommandLineArguments
25+
{
26+
get
27+
{
28+
return _commandLineArguments;
29+
}
30+
31+
set
32+
{
33+
if (value != _commandLineArguments)
34+
{
35+
_commandLineArguments = value;
36+
NotifyPropertyChanged();
37+
}
38+
}
39+
}
40+
41+
[Category(SettingsService.KindDebugger)]
42+
[DisplayName("Environment")]
43+
[Description("Environment passed to executable during F5 & CTRL+F5. Example: ENVVAR1=VAL1 ENVVAR2=VAL2")]
44+
public string DebuggerEnvironment
45+
{
46+
get
47+
{
48+
return _debuggerEnvironment;
49+
}
50+
51+
set
52+
{
53+
if (value != _debuggerEnvironment)
54+
{
55+
_debuggerEnvironment = value;
56+
NotifyPropertyChanged();
57+
}
58+
}
59+
}
60+
61+
[Category(SettingsService.KindBuild)]
62+
[DisplayName("Additional arguments")]
63+
[Description($"Additional build arguments passed Cargo.exe. Example: --features=blocking")]
64+
public string AdditionalBuildArguments
65+
{
66+
get
67+
{
68+
return _additionalBuildArguments;
69+
}
70+
71+
set
72+
{
73+
if (value != _additionalBuildArguments)
74+
{
75+
_additionalBuildArguments = value;
76+
NotifyPropertyChanged();
77+
}
78+
}
79+
}
80+
81+
public void ResetForNewNode(string relativePath, ISettingsService ss, string cmdLineArgs, string dbgEnv, string additionalBuildArgs)
82+
{
83+
RelativePath = relativePath;
84+
SS = ss;
85+
_commandLineArguments = cmdLineArgs;
86+
_debuggerEnvironment = dbgEnv;
87+
_additionalBuildArguments = additionalBuildArgs;
88+
}
89+
90+
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
91+
{
92+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
93+
}
94+
}

src/RustAnalyzer/NodeEnhancements/NodeBrowseObjectProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
namespace KS.RustAnalyzer.NodeEnhancements;
1313

1414
[Export(typeof(INodeBrowseObjectProvider))]
15-
public sealed partial class NodeBrowseObjectProvider : INodeBrowseObjectProvider
15+
public sealed class NodeBrowseObjectProvider : INodeBrowseObjectProvider
1616
{
1717
private readonly TL _tl;
18-
private readonly BrowseObject _browseObject = new ();
18+
private readonly NodeBrowseObject _browseObject = new ();
1919
private readonly IPreReqsCheckService _preReqs;
2020

2121
[ImportingConstructor]
@@ -65,7 +65,7 @@ public object ProvideBrowseObject(WorkspaceVisualNodeBase node)
6565

6666
private void BrowseObject_PropertyChanged(object sender, PropertyChangedEventArgs e)
6767
{
68-
if (sender is not BrowseObject fsob)
68+
if (sender is not NodeBrowseObject fsob)
6969
{
7070
return;
7171
}

src/RustAnalyzer/RustAnalyzer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<WarningLevel>4</WarningLevel>
4646
</PropertyGroup>
4747
<ItemGroup>
48-
<Compile Include="NodeEnhancements\BrowseObject.cs" />
48+
<Compile Include="NodeEnhancements\NodeBrowseObject.cs" />
4949
<Compile Include="Properties\AssemblyInfo.cs" />
5050
<Compile Include="RustAnalyzerPackage.cs" />
5151
<Compile Include="source.extension.cs">

0 commit comments

Comments
 (0)