* NPS survey after 5 sessions

* Fix path normalization issue

* Improve F5 behavior without configs

* Add gitattributes
This commit is contained in:
Brandon Waterloo [MSFT] 2019-11-13 13:40:42 -06:00 коммит произвёл GitHub
Родитель 363d88e666
Коммит c85d769612
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 46 добавлений и 8 удалений

2
.gitattributes поставляемый Normal file
Просмотреть файл

@ -0,0 +1,2 @@
# Stop git from breaking this script by putting CRLF in place of LF
resources/vsdbg text eol=lf

Просмотреть файл

@ -3,7 +3,7 @@
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CancellationToken, debug, DebugConfiguration, DebugConfigurationProvider, ProviderResult, WorkspaceFolder } from 'vscode';
import { CancellationToken, commands, debug, DebugConfiguration, DebugConfigurationProvider, MessageItem, ProviderResult, window, WorkspaceFolder } from 'vscode';
import { callWithTelemetryAndErrorHandling, IActionContext } from 'vscode-azureextensionui';
import { DockerOrchestration } from '../constants';
import { getAssociatedDockerRunTask } from '../tasks/TaskHelper';
@ -24,7 +24,18 @@ export class DockerDebugConfigurationProvider implements DebugConfigurationProvi
) { }
public provideDebugConfigurations(folder: WorkspaceFolder | undefined, token?: CancellationToken): ProviderResult<DebugConfiguration[]> {
return undefined;
const add: MessageItem = { title: 'Add Docker Files' };
// Prompt them to add Docker files since they probably haven't
window.showErrorMessage(
'To debug in a Docker container on supported platforms, use the command \"Docker: Add Docker Files to Workspace\", or click \"Add Docker Files\".',
...[add]).then((result) => {
if (result === add) {
commands.executeCommand('vscode-docker.configure');
}
});
return [];
}
public resolveDebugConfiguration(folder: WorkspaceFolder | undefined, debugConfiguration: DockerDebugConfiguration, token?: CancellationToken): ProviderResult<DebugConfiguration | undefined> {
@ -35,6 +46,12 @@ export class DockerDebugConfigurationProvider implements DebugConfigurationProvi
throw new Error('To debug with Docker you must first open a folder or workspace in VS Code.');
}
if (debugConfiguration.type === undefined) {
// If type is undefined, they may be doing F5 without creating any real launch.json, which won't work
// VSCode subsequently will call provideDebugConfigurations which will show an error message
return null;
}
const debugPlatform = getPlatform(debugConfiguration);
actionContext.telemetry.properties.platform = debugPlatform;
actionContext.telemetry.properties.orchestration = 'single' as DockerOrchestration; // TODO: docker-compose, when support is added

Просмотреть файл

@ -4,7 +4,7 @@
import * as fse from 'fs-extra';
import * as path from 'path';
import { CancellationToken, DebugConfiguration, DebugConfigurationProvider, ProviderResult, WorkspaceFolder } from 'vscode';
import { CancellationToken, commands, DebugConfiguration, DebugConfigurationProvider, MessageItem, ProviderResult, window, WorkspaceFolder } from 'vscode';
import { callWithTelemetryAndErrorHandling } from 'vscode-azureextensionui';
import { PlatformOS } from '../../utils/platform';
import { resolveVariables } from '../../utils/resolveVariables';
@ -73,6 +73,17 @@ export class DockerNetCoreDebugConfigurationProvider implements DebugConfigurati
}
public provideDebugConfigurations(folder: WorkspaceFolder | undefined, token?: CancellationToken): ProviderResult<DebugConfiguration[]> {
const add: MessageItem = { title: 'Add Docker Files' };
// Prompt them to add Docker files since they probably haven't
window.showErrorMessage(
'To debug in a Docker container on supported platforms, use the command \"Docker: Add Docker Files to Workspace\", or click \"Add Docker Files\".',
...[add]).then((result) => {
if (result === add) {
commands.executeCommand('vscode-docker.configure');
}
});
return [];
}
@ -87,6 +98,12 @@ export class DockerNetCoreDebugConfigurationProvider implements DebugConfigurati
throw new Error('No workspace folder is associated with debugging.');
}
if (debugConfiguration.type === undefined) {
// If type is undefined, they may be doing F5 without creating any real launch.json, which won't work
// VSCode subsequently will call provideDebugConfigurations which will show an error message
return null;
}
const { appFolder, resolvedAppFolder } = await this.inferAppFolder(folder, debugConfiguration);
const { resolvedAppProject } = await this.inferAppProject(folder, debugConfiguration, resolvedAppFolder);

Просмотреть файл

@ -222,9 +222,11 @@ export class NetCoreDebugHelper implements DebugHelper {
private static getContainerAppOutput(debugConfiguration: DockerDebugConfiguration, appOutput: string, platformOS: PlatformOS): string {
const relativePath = path.relative(path.dirname(debugConfiguration.netCore.appProject), appOutput);
return platformOS === 'Windows' ?
pathNormalize(path.win32.join('C:\\app', relativePath)) :
pathNormalize(path.posix.join('/app', relativePath));
let result = platformOS === 'Windows' ?
path.win32.join('C:\\app', relativePath) :
path.posix.join('/app', relativePath);
return pathNormalize(result, platformOS);
}
}

Просмотреть файл

@ -41,7 +41,7 @@ export async function updateBlazorManifest(context: DockerRunTaskContext, runDef
const targetsFile = path.join(ext.context.asAbsolutePath('resources'), 'GetBlazorManifestLocations.targets');
const command = `dotnet build /r:false /t:GetBlazorManifestLocations /p:CustomAfterMicrosoftCommonTargets=${targetsFile} /p:BlazorManifestLocationsOutput=${locationsFile} ${runDefinition.netCore.appProject}`;
const command = `dotnet build /r:false /t:GetBlazorManifestLocations /p:CustomAfterMicrosoftCommonTargets="${targetsFile}" /p:BlazorManifestLocationsOutput="${locationsFile}" "${runDefinition.netCore.appProject}"`;
try {
await execAsync(command, { timeout: 5000 });

Просмотреть файл

@ -9,7 +9,7 @@ import { env, Memento, Uri, window } from "vscode";
import { ext } from "vscode-azureappservice/out/src/extensionVariables";
const PROBABILITY = 0.15;
const MIN_SESSION_COUNT = 10;
const MIN_SESSION_COUNT = 5;
const SURVEY_NAME = 'nps1';
const SURVEY_URL = 'https://aka.ms/vscodedockernpsinproduct';