Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
* upstream/master:
  Make use of new execution layer instead of spawning processes (#425)
  Use localhost instead of 0.0.0.0 for all local socket servers (#417)
  Provide full signature help with highlighted parameter (#416)
  Change `os.arch()` to `npm` `arch` to fix wrong arch detection. (#419)
  Document our Russian support (#424)
  Bump the version number to the next release as an alpha (#422)
  Russian translation (#411)
  Speed up virtual environment detection in workspace (#405)
  • Loading branch information
DonJayamanne committed Dec 15, 2017
2 parents d2340d2 + 660c3c5 commit 52bb7ae
Show file tree
Hide file tree
Showing 42 changed files with 1,828 additions and 911 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ contributors (if you would like to contribute a translation, see the
[pull request which added simplified Chinese](https://github.com/Microsoft/vscode-python/pull/240)):

* `en`
* `ru`
* `zh-cn`

## Data/Telemetry
Expand Down
1,141 changes: 1,037 additions & 104 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 20 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "python",
"displayName": "Python",
"description": "Linting, Debugging (multi-threaded, remote), Intellisense, code formatting, refactoring, unit tests, snippets, and more.",
"version": "0.9.0",
"version": "2018.1.0-alpha",
"publisher": "ms-python",
"author": {
"name": "Microsoft Corporation"
Expand Down Expand Up @@ -627,6 +627,16 @@
"type": "string",
"description": "Absolute path to a file containing environment variable definitions.",
"default": ""
},
"port": {
"type": "number",
"description": "Debug port (default is 0, resulting in the use of a dynamic port).",
"default": 0
},
"host": {
"type": "string",
"description": "IP address of the of the local debug server (default is localhost).",
"default": "localhost"
}
}
},
Expand Down Expand Up @@ -1321,6 +1331,12 @@
"description": "Port number used for debugging of unittests.",
"scope": "resource"
},
"python.unitTest.debugHost": {
"type": "number",
"default": "localhost",
"description": "IP Address of the of the local unit test server (default is localhost or use 127.0.0.1).",
"scope": "resource"
},
"python.unitTest.cwd": {
"type": "string",
"default": null,
Expand Down Expand Up @@ -1506,6 +1522,7 @@
"lint": "tslint src/**/*.ts -t verbose"
},
"dependencies": {
"arch": "^2.1.0",
"diff-match-patch": "^1.0.0",
"fs-extra": "^4.0.2",
"fuzzy": "^0.1.3",
Expand Down Expand Up @@ -1567,6 +1584,7 @@
"tslint-microsoft-contrib": "^5.0.1",
"typescript": "^2.6.2",
"typescript-formatter": "^6.0.0",
"vscode": "^1.1.5"
"vscode": "^1.1.5",
"vscode-debugadapter-testsupport": "^1.25.0"
}
}
50 changes: 50 additions & 0 deletions package.nls.ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"python.command.python.sortImports.title": "Отсортировать Imports",
"python.command.python.startREPL.title": "Открыть REPL",
"python.command.python.buildWorkspaceSymbols.title": "Собрать символы рабочего пространства",
"python.command.python.runtests.title": "Запустить все тесты",
"python.command.python.debugtests.title": "Запустить все тесты под отладчиком",
"python.command.python.execInTerminal.title": "Выполнить файл в консоли",
"python.command.python.setInterpreter.title": "Выбрать интерпретатор",
"python.command.python.updateSparkLibrary.title": "Обновить библиотеки PySpark",
"python.command.python.refactorExtractVariable.title": "Извлечь в переменную",
"python.command.python.refactorExtractMethod.title": "Извлечь в метод",
"python.command.python.viewTestOutput.title": "Показать вывод теста",
"python.command.python.selectAndRunTestMethod.title": "Запусть тестовый метод...",
"python.command.python.selectAndDebugTestMethod.title": "Отладить тестовый метод...",
"python.command.python.selectAndRunTestFile.title": "Запустить тестовый файл...",
"python.command.python.runCurrentTestFile.title": "Запустить текущий тестовый файл",
"python.command.python.runFailedTests.title": "Запустить непрошедшие тесты",
"python.command.python.execSelectionInTerminal.title": "Выполнить выбранный текст или текущую строку в консоли",
"python.command.python.execSelectionInDjangoShell.title": "Выполнить выбранный текст или текущую строку в оболочке Django",
"python.command.jupyter.runSelectionLine.title": "Выполнить выбранный текст или текущую строку",
"python.command.jupyter.execCurrentCell.title": "Выполнить ячейку",
"python.command.jupyter.execCurrentCellAndAdvance.title": "Выполнить ячейку и перейти к следующей",
"python.command.jupyter.gotToPreviousCell.title": "Перейти к предыдущей ячейке",
"python.command.jupyter.gotToNextCell.title": "Перейти к следующей ячейке",
"python.command.python.goToPythonObject.title": "Перейти к объекту Python",
"python.snippet.launch.standard.label": "Python",
"python.snippet.launch.standard.description": "Отладить программу Python со стандартным выводом",
"python.snippet.launch.pyspark.label": "Python: PySpark",
"python.snippet.launch.pyspark.description": "Отладка PySpark",
"python.snippet.launch.module.label": "Python: Модуль",
"python.snippet.launch.module.description": "Отладка модуля",
"python.snippet.launch.terminal.label": "Python: Интегрированная консоль",
"python.snippet.launch.terminal.description": "Отладка программы Python в интегрированной консоли",
"python.snippet.launch.externalTerminal.label": "Python: Внешний терминал",
"python.snippet.launch.externalTerminal.description": "Отладка программы Python во внешней консоли",
"python.snippet.launch.django.label": "Python: Django",
"python.snippet.launch.django.description": "Отладка приложения Django",
"python.snippet.launch.flask.label": "Python: Flask (0.11.x или новее)",
"python.snippet.launch.flask.description": "Отладка приложения Flask",
"python.snippet.launch.flaskOld.label": "Python: Flask (0.10.x или старее)",
"python.snippet.launch.flaskOld.description": "Отладка приложения Flask (старый стиль)",
"python.snippet.launch.pyramid.label": "Python: Приложение Pyramid",
"python.snippet.launch.pyramid.description": "Отладка приложения Pyramid",
"python.snippet.launch.watson.label": "Python: Приложение Watson",
"python.snippet.launch.watson.description": "Отладка приложения Watson",
"python.snippet.launch.attach.label": "Python: Подключить отладчик",
"python.snippet.launch.attach.description": "Подключить отладчик для удаленной отладки",
"python.snippet.launch.scrapy.label": "Python: Scrapy",
"python.snippet.launch.scrapy.description": "Scrapy в интегрированной консоли"
}
5 changes: 0 additions & 5 deletions pythonFiles/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import traceback
import platform

WORD_RE = re.compile(r'\w')
jediPreview = False

class RedirectStdout(object):
Expand Down Expand Up @@ -111,8 +110,6 @@ def _get_call_signatures(self, script):
continue
if param.name == 'self' and pos == 0:
continue
if WORD_RE.match(param.name) is None:
continue
try:
name, value = param.description.split('=')
except ValueError:
Expand Down Expand Up @@ -155,8 +152,6 @@ def _get_call_signatures_with_args(self, script):
continue
if param.name == 'self' and pos == 0:
continue
if WORD_RE.match(param.name) is None:
continue
try:
name, value = param.description.split('=')
except ValueError:
Expand Down
1 change: 1 addition & 0 deletions src/client/common/configSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface ISortImportSettings {
export interface IUnitTestSettings {
promptToConfigure: boolean;
debugPort: number;
debugHost?: string;
nosetestsEnabled: boolean;
nosetestPath: string;
nosetestArgs: string[];
Expand Down
40 changes: 18 additions & 22 deletions src/client/common/net/socket/socketServer.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
"use strict";

import * as net from "net";
import { EventEmitter } from 'events';
import * as net from 'net';
import { createDeferred } from '../../helpers';

export class SocketServer extends EventEmitter {
private socketServer: net.Server = null;
private socketServer: net.Server | undefined;
constructor() {
super();
}

public Stop() {
if (this.socketServer === null) { return; }
if (!this.socketServer) { return; }
try {
this.socketServer.close();
}
catch (ex) { }
this.socketServer = null;
// tslint:disable-next-line:no-empty
} catch (ex) { }
this.socketServer = undefined;
}

public Start(): Promise<number> {
public Start(options: { port?: number, host?: string } = {}): Promise<number> {
const def = createDeferred<number>();
this.socketServer = net.createServer(this.connectionListener.bind(this));

this.socketServer.listen(0, function (this: SocketServer) {
def.resolve(this.socketServer.address().port);
}.bind(this));
const port = typeof options.port === 'number' ? options.port! : 0;
const host = typeof options.host === 'string' ? options.host! : 'localhost';
this.socketServer!.listen({ port, host }, () => {
def.resolve(this.socketServer!.address().port);
});

this.socketServer.on("error", ex => {
this.socketServer!.on('error', ex => {
console.error('Error in Socket Server', ex);
if (def.completed) {
// Ooops
debugger;
}
const msg = `Failed to start the socket server. (Error: ${ex.message})`;

def.reject(msg);
Expand All @@ -41,14 +37,14 @@ export class SocketServer extends EventEmitter {
}

private connectionListener(client: net.Socket) {
client.on("close", function () {
client.on('close', () => {
this.emit('close', client);
}.bind(this));
client.on("data", function (data: Buffer) {
});
client.on('data', (data: Buffer) => {
this.emit('data', client, data);
}.bind(this));
});

client.on("timeout", d => {
client.on('timeout', d => {
// let msg = "Debugger client timedout, " + d;
});
}
Expand Down
5 changes: 2 additions & 3 deletions src/client/common/platform/constants.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import * as os from 'os';

import * as arch from 'arch';
export const WINDOWS_PATH_VARIABLE_NAME = 'Path';
export const NON_WINDOWS_PATH_VARIABLE_NAME = 'PATH';
export const IS_WINDOWS = /^win/.test(process.platform);
export const IS_64_BIT = os.arch() === 'x64';
export const IS_64_BIT = arch() === 'x64';
4 changes: 2 additions & 2 deletions src/client/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ export function getSubDirectories(rootDir: string): Promise<string[]> {
subDirs.push(fullPath);
}
}
catch (ex) {
}
// tslint:disable-next-line:no-empty
catch (ex) {}
});
resolve(subDirs);
});
Expand Down
37 changes: 20 additions & 17 deletions src/client/debugger/Common/Contracts.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"use strict";
import * as net from "net";
// tslint:disable:interface-name member-access no-single-line-block-comment no-any no-stateless-class member-ordering prefer-method-signature

'use strict';
import { ChildProcess } from 'child_process';
import { DebugProtocol } from "vscode-debugprotocol";
import { OutputEvent } from "vscode-debugadapter";
import * as net from 'net';
import { OutputEvent } from 'vscode-debugadapter';
import { DebugProtocol } from 'vscode-debugprotocol';

export class TelemetryEvent extends OutputEvent {
body: {
Expand All @@ -14,25 +16,25 @@ export class TelemetryEvent extends OutputEvent {
data?: any;
};
constructor(output: string, data?: any) {
super(output, "telemetry");
super(output, 'telemetry');
if (data) {
this.body.data = data;
}
}
}
export const DjangoApp = "DJANGO";
export const DjangoApp = 'DJANGO';
export enum DebugFlags {
None = 0,
IgnoreCommandBursts = 1
}

export class DebugOptions {
public static get WaitOnAbnormalExit(): string { return "WaitOnAbnormalExit"; }
public static get WaitOnNormalExit(): string { return "WaitOnNormalExit"; }
public static get RedirectOutput(): string { return "RedirectOutput"; }
public static get DjangoDebugging(): string { return "DjangoDebugging"; }
public static get DebugStdLib(): string { return "DebugStdLib"; }
public static get BreakOnSystemExitZero(): string { return "BreakOnSystemExitZero"; }
public static get WaitOnAbnormalExit(): string { return 'WaitOnAbnormalExit'; }
public static get WaitOnNormalExit(): string { return 'WaitOnNormalExit'; }
public static get RedirectOutput(): string { return 'RedirectOutput'; }
public static get DjangoDebugging(): string { return 'DjangoDebugging'; }
public static get DebugStdLib(): string { return 'DebugStdLib'; }
public static get BreakOnSystemExitZero(): string { return 'BreakOnSystemExitZero'; }
}

export interface ExceptionHandling {
Expand All @@ -55,7 +57,9 @@ export interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArgum
env?: Object;
envFile: string;
exceptionHandling?: ExceptionHandling;
console?: "none" | "integratedTerminal" | "externalTerminal";
console?: 'none' | 'integratedTerminal' | 'externalTerminal';
port?: number;
host?: string;
}

export interface AttachRequestArguments extends DebugProtocol.AttachRequestArguments {
Expand All @@ -76,7 +80,8 @@ export enum FrameKind {
None,
Python,
Django
};
}

export enum enum_EXCEPTION_STATE {
BREAK_MODE_NEVER = 0,
BREAK_MODE_ALWAYS = 1,
Expand All @@ -99,7 +104,7 @@ export enum PythonEvaluationResultFlags {
MethodCall = 2,
SideEffects = 4,
Raw = 8,
HasRawRepr = 16,
HasRawRepr = 16
}

export interface IPythonProcess extends NodeJS.EventEmitter {
Expand Down Expand Up @@ -138,14 +143,12 @@ export interface IPythonEvaluationResult {
Frame: IPythonStackFrame;
}


export interface IPythonModule {
ModuleId: number;
Name: string;
Filename: string;
}


export interface IPythonThread {
IsWorkerThread: boolean;
Process: IPythonProcess;
Expand Down
2 changes: 1 addition & 1 deletion src/client/debugger/DebugClients/LocalDebugClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class LocalDebugClient extends DebugClient {

public CreateDebugServer(pythonProcess: IPythonProcess): BaseDebugServer {
this.pythonProcess = pythonProcess;
this.debugServer = new LocalDebugServer(this.debugSession, this.pythonProcess);
this.debugServer = new LocalDebugServer(this.debugSession, this.pythonProcess, this.args);
return this.debugServer;
}

Expand Down
13 changes: 6 additions & 7 deletions src/client/debugger/DebugServers/DebugServerFactory.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {BaseDebugServer} from "./BaseDebugServer";
import {LocalDebugServer} from "./LocalDebugServer";
import {RemoteDebugServer} from "./RemoteDebugServer";
import {DebugSession, OutputEvent} from "vscode-debugadapter";
import {IPythonProcess, IDebugServer} from "../Common/Contracts";
import { DebugSession } from 'vscode-debugadapter';
import { IPythonProcess, LaunchRequestArguments } from '../Common/Contracts';
import { BaseDebugServer } from './BaseDebugServer';
import { LocalDebugServer } from './LocalDebugServer';

export function CreateDebugServer(debugSession: DebugSession, pythonProcess: IPythonProcess): BaseDebugServer {
return new LocalDebugServer(debugSession, pythonProcess);
export function CreateDebugServer(debugSession: DebugSession, pythonProcess: IPythonProcess, args: LaunchRequestArguments): BaseDebugServer {
return new LocalDebugServer(debugSession, pythonProcess, args);
}
Loading

0 comments on commit 52bb7ae

Please sign in to comment.