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

Add support for configuring default startup *.sln in settings.json #2053

Merged
merged 33 commits into from
Jul 5, 2018
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6d2f205
ADD: ability to specifiy in settings.json the default *.sln file when…
janaka Dec 30, 2017
fad50e8
Fix logic
janaka Jan 3, 2018
6aafccf
Change pre-release version number
janaka Jan 3, 2018
db973e8
Refactor: change config key to be more generalised.
janaka Jan 3, 2018
fab697a
Fix: integertion tests: some issues with the multi sln test project
janaka Feb 18, 2018
e0edf51
Fix: up launch config and gitignore
janaka Feb 18, 2018
baa827b
Add: gitignores to test projects
janaka Feb 18, 2018
2a5056a
tweak gitignore
janaka Feb 18, 2018
5c7d70a
Merge: latest origin master
janaka Feb 18, 2018
290ff42
Fix: gitignore
janaka Feb 18, 2018
6de3809
package-lock.json changes
janaka Feb 18, 2018
8a69508
remove none existant project from test sln
janaka Feb 18, 2018
de1a8d2
Refactor: replace deprecated ${workspaceRoot} with ${workspaceFolder}
janaka Feb 18, 2018
86b1b72
Refactor: `defaultLaunchTarget` to `defaultLaunchSolution`
janaka Feb 18, 2018
7d2b1ab
Merge upstream master
janaka Apr 7, 2018
1aa5259
Fix: based on comments in PR #2053
janaka Apr 7, 2018
fe33a07
Merge in latest upstream/master
May 15, 2018
a7b289b
Update following merging master
May 15, 2018
6d484c3
Update: options related tests to cover `defaultLaunchSolution` property
May 15, 2018
8db7c15
Merge branch 'master' into config-default-sln
akshita31 May 21, 2018
c2eea4a
Merge: latest upstream/master
janaka Jun 13, 2018
6a4060f
UPDATE: launch.json
janaka Jun 14, 2018
64c4ca2
Add to another default values test
janaka Jun 14, 2018
906d76b
Cleanup/simplify
Jun 14, 2018
dfe1974
remove accidental addition
Jun 14, 2018
f4bce55
Merge pull request #1 from rchande/forJanaka
janaka Jun 14, 2018
d5cd8fc
Merge branch 'master' into config-default-sln
Jun 22, 2018
f801b8e
Merge: latest upstream master
Jul 2, 2018
c80dd09
Fix: missing lib ref in test projet sln files
Jul 4, 2018
1e0e8fa
Fix: test project missing lib ref in csproj file
Jul 4, 2018
72ccaad
Merge branch 'master' into config-default-sln
Jul 5, 2018
dcfa0c6
Merge branch 'master' into config-default-sln
akshita31 Jul 5, 2018
e34bf5a
Update: CHANGELOG with PR details
janaka Jul 5, 2018
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
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ install.*

*.vsix

obj/
bin/
test/**/.vscode

test/**/.vscode/launch.json
test/**/.vscode/tasks.json

.logs/
.nyc_output/
coverage/
Expand Down
15 changes: 11 additions & 4 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"taskName": "build",
"command": "npm",
"isShellCommand": true,
"args": ["run", "compile"],
"args": [
"run",
"compile"
],
"showOutput": "always",
"isBuildCommand": true
},
Expand All @@ -14,19 +17,23 @@
"command": "echo",
"showOutput": "always",
"isShellCommand": true,
"args": ["Run tests in VS Code by launching the debugger with the 'Launch Tests' configuration."],
"args": [
"Run tests in VS Code by launching the debugger with the 'Launch Tests' configuration."
],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're making whitespace-only changes, can we tab->space ?

"isTestCommand": true
},
{
"taskName": "tslint",
"command": "gulp",
"isShellCommand": true,
"args": ["tslint"],
"args": [
"tslint"
],
"problemMatcher": {
"owner": "tslint",
"fileLocation": [
"relative",
"${workspaceRoot}"
"${workspaceFolder}"
],
"severity": "warning",
"pattern": {
Expand Down
23 changes: 14 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,11 @@
"default": 250,
"description": "The maximum number of projects to be shown in the 'Select Project' dropdown (maximum 250)."
},
"omnisharp.defaultLaunchSolution": {
"type": "string",
"default": null,
"description": "The name of the default solution used at start up if the repo has multiple solutions. e.g.'MyAwesomeSolution.sln'. Default value is `null` which will cause the first in alphabetical order to be chosen."
},
"omnisharp.useEditorFormattingSettings": {
"type": "boolean",
"default": true,
Expand Down Expand Up @@ -1618,9 +1623,9 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "^\"\\${workspaceRoot}/bin/Debug/${1:<target-framework>}/${2:<project-name.dll>}\"",
"program": "^\"\\${workspaceFolder}/bin/Debug/${1:<target-framework>}/${2:<project-name.dll>}\"",
"args": [],
"cwd": "^\"\\${workspaceRoot}\"",
"cwd": "^\"\\${workspaceFolder}\"",
"stopAtEntry": false,
"console": "internalConsole"
}
Expand All @@ -1643,9 +1648,9 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "^\"\\${workspaceRoot}/bin/Debug/${1:<target-framework>}/${2:<project-name.dll>}\"",
"program": "^\"\\${workspaceFolder}/bin/Debug/${1:<target-framework>}/${2:<project-name.dll>}\"",
"args": [],
"cwd": "^\"\\${workspaceRoot}\"",
"cwd": "^\"\\${workspaceFolder}\"",
"stopAtEntry": false,
"launchBrowser": {
"enabled": true,
Expand All @@ -1665,7 +1670,7 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "^\"\\${workspaceRoot}/Views\""
"/Views": "^\"\\${workspaceFolder}/Views\""
}
}
},
Expand All @@ -1677,13 +1682,13 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "^\"\\${workspaceRoot}/bin/Debug/${1:<target-framework>}/${2:<project-name.dll>}\"",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this part of launch.json is generated from src/tools/OptionsSchema.json. Can you fix it there too? Otherwise this will be lost the next time we run the generator.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is fixed now in the latest master.

"program": "^\"\\${workspaceFolder}/bin/Debug/${1:<target-framework>}/${2:<project-name.dll>}\"",
"args": [],
"cwd": "^\"\\${workspaceRoot}\"",
"cwd": "^\"\\${workspaceFolder}\"",
"stopAtEntry": false,
"console": "internalConsole",
"pipeTransport": {
"pipeCwd": "^\"\\${workspaceRoot}\"",
"pipeCwd": "^\"\\${workspaceFolder}\"",
"pipeProgram": "^\"${3:enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'}\"",
"pipeArgs": [],
"debuggerPath": "^\"${4:enter the path for the debugger on the target machine, for example ~/vsdbg/vsdbg}\""
Expand All @@ -1699,7 +1704,7 @@
"request": "attach",
"processId": "^\"\\${command:pickRemoteProcess}\"",
"pipeTransport": {
"pipeCwd": "^\"\\${workspaceRoot}\"",
"pipeCwd": "^\"\\${workspaceFolder}\"",
"pipeProgram": "^\"${1:enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'}\"",
"pipeArgs": [],
"debuggerPath": "^\"${2:enter the path for the debugger on the target machine, for example ~/vsdbg/vsdbg}\""
Expand Down
1 change: 0 additions & 1 deletion src/omnisharp/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ function resourcesToLaunchTargets(resources: vscode.Uri[]): LaunchTarget[] {
// Add .sln files if there are .csproj files
if (hasCsProjFiles && isSolution(resource)) {
hasSlnFile = true;

targets.push({
label: path.basename(resource.fsPath),
description: vscode.workspace.asRelativePath(path.dirname(resource.fsPath)),
Expand Down
18 changes: 11 additions & 7 deletions src/omnisharp/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export class Options {
public showReferencesCodeLens: boolean,
public showTestsCodeLens: boolean,
public disableCodeActions: boolean,
public disableMSBuildDiagnosticWarning: boolean) { }
public disableMSBuildDiagnosticWarning: boolean,
public defaultLaunchSolution?: string) { }


public static Read(vscode: vscode): Options {
// Extra effort is taken below to ensure that legacy versions of options
Expand Down Expand Up @@ -47,6 +49,7 @@ export class Options {

const projectLoadTimeout = omnisharpConfig.get<number>('projectLoadTimeout', 60);
const maxProjectResults = omnisharpConfig.get<number>('maxProjectResults', 250);
const defaultLaunchSolution = omnisharpConfig.get<string>('defaultLaunchSolution', undefined);
const useEditorFormattingSettings = omnisharpConfig.get<boolean>('useEditorFormattingSettings', true);

const useFormatting = csharpConfig.get<boolean>('format.enable', true);
Expand All @@ -62,16 +65,17 @@ export class Options {
path,
useGlobalMono,
waitForDebugger,
loggingLevel,
autoStart,
projectLoadTimeout,
maxProjectResults,
useEditorFormattingSettings,
loggingLevel,
autoStart,
projectLoadTimeout,
maxProjectResults,
useEditorFormattingSettings,
useFormatting,
showReferencesCodeLens,
showTestsCodeLens,
disableCodeActions,
disableMSBuildDiagnosticWarning);
disableMSBuildDiagnosticWarning,
defaultLaunchSolution);
}

private static readPathOption(csharpConfig: WorkspaceConfiguration, omnisharpConfig: WorkspaceConfiguration): string | null {
Expand Down
8 changes: 8 additions & 0 deletions src/omnisharp/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,14 @@ export class OmniSharpServer {
});
}

const defaultLaunchSolutionConfigValue = this.optionProvider.GetLatestOptions().defaultLaunchSolution;

// First, try to launch against something that matches the user's preferred target
const defaultLaunchSolutionTarget = launchTargets.find((a) => (path.basename(a.target) === defaultLaunchSolutionConfigValue));
if (defaultLaunchSolutionTarget) {
return this.restart(defaultLaunchSolutionTarget);
}

// If there's more than one launch target, we start the server if one of the targets
// matches the preferred path. Otherwise, we fire the "MultipleLaunchTargets" event,
// which is handled in status.ts to display the launch target selector.
Expand Down
2 changes: 2 additions & 0 deletions test/integrationTests/testAssets/singleCsproj/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/obj/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ignores the obj directory for integrationtests, which I think is fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Just merged master. Will merge once travis approves :)

**/bin/

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
ffcdec535c6ed9f5449ad17c7f1a870da5e60671
a3678bb80f266957ba73795e6cd519aa5ad43bf2
Loading