Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 4 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 PRIVACY.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Privacy

The code in this repository contains features that may enable you and Microsoft to collect data from users of the applications.
The data collection is disabled by default but can be enabled by setting the corresponding flag upon compilation.
With the exception of the VS Code extension, data collection is disabled by default but can be enabled by setting the corresponding flag upon compilation. For the VS Code extension, the privacy settings for VS Code set by the application user determine whether any data is collected.

## Data Collection

Expand Down
13 changes: 6 additions & 7 deletions src/VSCodeExtension/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@ After doing so, `vsce` can be used from the command line.

## Steps ##

Building the VS Code extension follows in a few main steps:
Building the VS Code extension requires the following steps:

- Setting up the Solid build itself.
- Setting up the build pre-requisites (see below for details).
- Installing all Node.js dependencies required by the extension.
- Compiling the language server and copying its assemblies into `bin/`.
- Compiling the TypeScript for the extension itself.
This step is automatically invoked when debugging the extension from within VS Code.

To set up the Solid build, we require at a minimum that `package.json` was successfully created from `package.json.v.template`.
This is necessary as `package.json` specifies all of the dependencies which must be installed in order for the TypeScript comprising the VS Code extension to successfully compile and run.
Typically, `package.json` is created from `package.json.v.template` by running `setVersionNumber.cmd` from the root folder of the Solid repository.
To set up the build pre-requisites, we require to run `build/bootstrap.cmd` from the root folder of the repository.
This in particular creates `package.json` from `package.json.v.template`, which specifies all of the dependencies that must be installed in order for the TypeScript comprising the VS Code extension to successfully compile and run.

Once `package.json` exists, Node.js dependencies can be installed:

Expand All @@ -48,7 +47,7 @@ vsce package

## Debugging ##

As an alternative to using `vsce package` to produce an installable VSIX, the VS Code extension can be run in an experimental instance of VS Code.
As an alternative to using `vsce package` to produce an installable VSIX, the VS Code extension can be run in an experimental instance of VS Code.
To do so, make sure that you have run the build procedure above through to calling `Build-Dependencies.ps1`.
Then, from the Debug tab in VS Code, ensure that "Extension" is selected in the Debug target menu and press the green ‣.

Expand All @@ -70,5 +69,5 @@ Change back to the "Extension" debugger and resume.
### semver Issues ###

You may see an error when packaging or debugging the VS Code extension indicating that the package is not semver compatible.
This indicates that `setVersionNumber.cmd` did not produce a SemVer 2.0–compatible version number when writing `package.json` from `package.json.v.template`, typically due to a mis-set environment variable.
This indicates that the build script `setVersionNumber.cmd` did not produce a SemVer 2.0–compatible version number when writing `package.json` from `package.json.v.template`, typically due to a mis-set environment variable.
If this happens, correct the environment variables used by `setVersionNumber.cmd` or manually edit the `version` property of `package.json` (note that any such manual edits **will** be overwritten by calls to `setVersionNumber.cmd` and will not be saved in the repo).
3 changes: 3 additions & 0 deletions src/VSCodeExtension/Build-Dependencies.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

param(
[string]
$Configuration = $null,
Expand Down
10 changes: 0 additions & 10 deletions src/VSCodeExtension/CHANGELOG.md

This file was deleted.

9 changes: 6 additions & 3 deletions src/VSCodeExtension/language-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@
// symbols used as brackets
"brackets": [
["[", "]"],
["(", ")"]
["(", ")"],
["{", "}"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["[", "]"],
["(", ")"]
["(", ")"],
["{", "}"]
],
// symbols that that can be used to surround a selection
"surroundingPairs": [
["[", "]"],
["(", ")"]
["(", ")"],
["{", "}"]
]
}
3 changes: 3 additions & 0 deletions src/VSCodeExtension/src/dotnet.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

'use strict';

// IMPORTS /////////////////////////////////////////////////////////////////////
Expand Down
3 changes: 3 additions & 0 deletions src/VSCodeExtension/src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

'use strict';
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
Expand Down
3 changes: 3 additions & 0 deletions src/VSCodeExtension/src/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

'use strict';

// IMPORTS /////////////////////////////////////////////////////////////////////
Expand Down
15 changes: 11 additions & 4 deletions src/VSCodeExtension/src/telemetry.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import * as vscode from 'vscode';
import { getPackageInfo } from './packageInfo';
import TelemetryReporter from 'vscode-extension-telemetry';

export class Settings {
static enableTelemetry = true; // TODO: make this a command line flag and disable by default
};

export type TelemetryData<T> = { [key: string]: T } | undefined;

export var reporter: TelemetryReporter;
Expand All @@ -10,7 +17,7 @@ export class Reporter extends vscode.Disposable {
constructor(ctx: vscode.ExtensionContext) {
super(() => reporter.dispose());
let packageInfo = getPackageInfo(ctx);
if (packageInfo !== undefined) {
if (packageInfo !== undefined && Settings.enableTelemetry) {
reporter = new TelemetryReporter(packageInfo.name, packageInfo.version, packageInfo.aiKey);
}
}
Expand Down Expand Up @@ -38,7 +45,7 @@ export function startTelemetry(context: vscode.ExtensionContext) {
context.subscriptions.push(new Reporter(context));

// Send initial events.
reporter.sendTelemetryEvent(EventNames.activate, {}, {});
if (reporter) reporter.sendTelemetryEvent(EventNames.activate, {}, {});
}

export function sendTelemetryTiming<T>(
Expand All @@ -57,7 +64,7 @@ export function sendTelemetryTiming<T>(

measurements["elapsedTime"] = elapsedTime;

reporter.sendTelemetryEvent(eventName, properties, measurements);
if (reporter) reporter.sendTelemetryEvent(eventName, properties, measurements);

return returnValue;

Expand Down Expand Up @@ -154,5 +161,5 @@ export function forwardServerTelemetry(telemetryRequest : any) {
}

// TODO: pass more than just the event name.
sendTelemetryEvent(name, properties, measurements);
sendTelemetryEvent(name, properties, measurements);
}
5 changes: 3 additions & 2 deletions src/VSCodeExtension/src/tests/extension.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

// Note: This example test is leveraging the Mocha test framework.
// Please refer to their documentation on https://mochajs.org/ for help.
//

// The module 'assert' provides assertion methods from node
import * as assert from 'assert';
Expand Down
6 changes: 3 additions & 3 deletions src/VSCodeExtension/src/tests/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

// This file is providing the test runner to use when running extension tests.
// By default the test runner in use is Mocha based.
//
Expand Down
27 changes: 0 additions & 27 deletions src/VSCodeExtension/vsc-extension-quickstart.md

This file was deleted.

1 change: 0 additions & 1 deletion src/VisualStudioExtension/QsharpAppTemplate/Driver.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;

using Microsoft.Quantum.Simulation.Core;
using Microsoft.Quantum.Simulation.Simulators;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.VisualStudio.LanguageServer.Client;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Microsoft.VisualStudio.LanguageServer.Client;
using Microsoft.VisualStudio.Utilities;
using System.ComponentModel.Composition;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics;
Expand Down
11 changes: 9 additions & 2 deletions src/VisualStudioExtension/QsharpLanguageClient/Telemetry.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
Expand Down Expand Up @@ -36,11 +39,14 @@ public static string PrefixProperty(string propName)
return $"{PUBLISHER}.{EXTENSION}.{propName?.ToLowerInvariant()}";
}

/// Sends the telemetry event for the event with the given name and properties.
/// Does nothing unless the corresponding flag is defined upon compilation.
/// If the telemetry flag is defined upon compilation,
/// sends the telemetry event for the event with the given name and properties.
/// Ignores any properties where the key is null or "version" (case insensitive).
/// Adds the version of the extension assembly as version.
public static void SendEvent(string name, IEnumerable<KeyValuePair<string, object>> props = null)
{
#if TELEMETRY
props = props ?? Enumerable.Empty<KeyValuePair<string, object>>();
var evt = new TelemetryEvent(PrefixEventName(name));
foreach (var entry in props.Where(p => !string.IsNullOrEmpty(p.Key)))
Expand All @@ -52,6 +58,7 @@ public static void SendEvent(string name, IEnumerable<KeyValuePair<string, objec
try { TelemetryService.DefaultSession.PostEvent(evt); }
catch (Exception ex)
{ Debug.Assert(false, $"error sending telemetry: \n{ex}"); }
#endif
}

public static void SendEvent(ExtensionEvent id, params (string, object)[] props) =>
Expand Down