Skip to content

Commit

Permalink
Bug-fix: Extension won't load, after changes for #18, if no configura…
Browse files Browse the repository at this point in the history
…tion was specified (restore configuration defaults).
  • Loading branch information
tintoy committed Oct 7, 2017
1 parent 9bccc90 commit b49a529
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 23 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## v0.2.10

* Bug-fix: Extension won't load, after changes for tintoy/msbuild-project-tools-vscode#18, if no configuration was specified (restore configuration defaults).

## v0.2.9

* Add command (`NuGet: toggle pre-release`) to toggle NuGet pre-release packages and package versions on / off (tintoy/msbuild-project-tools-vscode#18).
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 36 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "msbuild-project-tools",
"displayName": "MSBuild project tools",
"description": "Tools for working with MSBuild project files (such as auto-complete for package Ids / versions).",
"version": "0.2.9",
"version": "0.2.10",
"publisher": "tintoy",
"license": "MIT",
"repository": {
Expand Down Expand Up @@ -48,12 +48,24 @@
"msbuildProjectTools": {
"type": "object",
"description": "Configuration for MSBuild project tools.",
"default": { },
"default": {
"language": {
"enable": true,
"disableHover": false,
"logLevel": "Information",
"trace": false
},
"nuget": {
"newestVersionsFirst": true,
"includePreRelease": true,
"disablePrefetch": false
}
},
"properties": {
"language": {
"description": "Configuration for the MSBuild language service.",
"type": "object",
"default": { },
"default": {},
"properties": {
"enable": {
"title": "Enable language service?",
Expand Down Expand Up @@ -88,7 +100,7 @@
},
"seqLogging": {
"type": "object",
"default": { },
"default": {},
"description": "Configure the MSBuild language service to log to Seq (https://getseq.net/). This is only useful if you're hacking on the language service itself.",
"properties": {
"url": {
Expand Down Expand Up @@ -153,7 +165,7 @@
"nuget": {
"description": "Configuration for the MSBuild language service.",
"type": "object",
"default": { },
"default": {},
"properties": {
"newestVersionsFirst": {
"type": "boolean",
Expand All @@ -176,7 +188,8 @@
}
}
},
"snippets": [{
"snippets": [
{
"language": "msbuild",
"path": "./snippets/msbuild-project.json"
},
Expand All @@ -185,7 +198,8 @@
"path": "./snippets/msbuild-project.json"
}
],
"grammars": [{
"grammars": [
{
"scopeName": "text.xml.msbuild.expression",
"injectTo": [
"text.xml.msbuild"
Expand All @@ -198,18 +212,20 @@
"path": "./syntaxes/msbuild.json"
}
],
"languages": [{
"id": "msbuild",
"aliases": [
"MSBuild"
],
"extensions": [
"csproj",
"props",
"targets"
],
"configuration": "./language-configuration.json"
}]
"languages": [
{
"id": "msbuild",
"aliases": [
"MSBuild"
],
"extensions": [
"csproj",
"props",
"targets"
],
"configuration": "./language-configuration.json"
}
]
},
"scripts": {
"vscode:prepublish": "tsc -p ./",
Expand Down Expand Up @@ -240,4 +256,4 @@
"which": "^1.3.0",
"xmldom": "^0.1.27"
}
}
}
4 changes: 3 additions & 1 deletion src/extension/commands.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as vscode from 'vscode';
import { Settings } from './settings';
import { Settings, NuGetSettings } from './settings';

let extensionContext: vscode.ExtensionContext;
let extensionStatusBarItem: vscode.StatusBarItem;
Expand All @@ -25,6 +25,8 @@ export function registerCommands(context: vscode.ExtensionContext, statusBarItem
async function toggleNuGetPreRelease(): Promise<void> {
const configuration = vscode.workspace.getConfiguration();
const settings = configuration.get<Settings>('msbuildProjectTools');
settings.nuget = settings.nuget || <NuGetSettings>{};

settings.nuget.includePreRelease = !settings.nuget.includePreRelease;

await configuration.update('msbuildProjectTools', settings);
Expand Down
2 changes: 1 addition & 1 deletion src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ async function loadConfiguration(): Promise<void> {

configuration = workspaceConfiguration.get<Settings>('msbuildProjectTools');
featureFlags.clear();
if (configuration.language.experimentalFeatures)
if (configuration.language && configuration.language.experimentalFeatures)
{
configuration.language.experimentalFeatures.forEach(
featureFlag => featureFlags.add(featureFlag)
Expand Down

0 comments on commit b49a529

Please sign in to comment.