From 61b36101c45b0fc05d0a839d2ea7d680c5b2a2e7 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Wed, 28 Apr 2021 16:02:25 -0700 Subject: [PATCH 01/13] Remove ctags (#16066) --- package.json | 54 +- src/client/activation/jedi.ts | 8 - src/client/common/configSettings.ts | 30 - .../common/installer/productInstaller.ts | 48 -- src/client/common/installer/productPath.ts | 11 - src/client/common/installer/productService.ts | 1 - .../common/installer/serviceRegistry.ts | 6 - src/client/common/types.ts | 12 +- src/client/workspaceSymbols/contracts.ts | 9 - src/client/workspaceSymbols/generator.ts | 99 --- src/client/workspaceSymbols/main.ts | 151 ---- src/client/workspaceSymbols/parser.ts | 170 ----- src/client/workspaceSymbols/provider.ts | 75 -- src/test/.vscode/tags | 721 ------------------ src/test/common/configSettings.test.ts | 19 - .../configSettings.unit.test.ts | 4 - src/test/common/installer.test.ts | 10 +- .../installer.invalidPath.unit.test.ts | 1 - .../common/installer/installer.unit.test.ts | 120 +-- .../common/installer/productPath.unit.test.ts | 23 - .../installer/serviceRegistry.unit.test.ts | 8 - src/test/linters/lint.multiroot.test.ts | 6 - src/test/linters/lint.test.ts | 6 - src/test/linters/linterManager.unit.test.ts | 2 +- .../disableLinters/.vscode/tags | 19 - .../multiRootWkspc/parent/child/.vscode/tags | 24 - .../multiRootWkspc/workspace1/.vscode/tags | 19 - .../workspace2/workspace2.tags.file | 24 - .../workspace3/workspace3.tags.file | 19 - src/test/workspaceSymbols/common.ts | 12 - .../workspaceSymbols/generator.unit.test.ts | 116 --- src/test/workspaceSymbols/main.unit.test.ts | 224 ------ .../workspaceSymbols/provider.unit.test.ts | 134 ---- .../disableLinters/.vscode/tags | 19 - .../parent/child/.vscode/tags | 24 - .../workspace1/.vscode/tags | 19 - .../workspace2/workspace2.tags.file | 24 - .../workspace3/workspace3.tags.file | 19 - 38 files changed, 8 insertions(+), 2282 deletions(-) delete mode 100644 src/client/workspaceSymbols/contracts.ts delete mode 100644 src/client/workspaceSymbols/generator.ts delete mode 100644 src/client/workspaceSymbols/main.ts delete mode 100644 src/client/workspaceSymbols/parser.ts delete mode 100644 src/client/workspaceSymbols/provider.ts delete mode 100644 src/test/.vscode/tags delete mode 100644 src/test/multiRootWkspc/disableLinters/.vscode/tags delete mode 100644 src/test/multiRootWkspc/parent/child/.vscode/tags delete mode 100644 src/test/multiRootWkspc/workspace1/.vscode/tags delete mode 100644 src/test/multiRootWkspc/workspace2/workspace2.tags.file delete mode 100644 src/test/multiRootWkspc/workspace3/workspace3.tags.file delete mode 100644 src/test/workspaceSymbols/common.ts delete mode 100644 src/test/workspaceSymbols/generator.unit.test.ts delete mode 100644 src/test/workspaceSymbols/main.unit.test.ts delete mode 100644 src/test/workspaceSymbols/provider.unit.test.ts delete mode 100644 src/testMultiRootWkspc/disableLinters/.vscode/tags delete mode 100644 src/testMultiRootWkspc/parent/child/.vscode/tags delete mode 100644 src/testMultiRootWkspc/workspace1/.vscode/tags delete mode 100644 src/testMultiRootWkspc/workspace2/workspace2.tags.file delete mode 100644 src/testMultiRootWkspc/workspace3/workspace3.tags.file diff --git a/package.json b/package.json index 5028bbf93893..5738c7aeebed 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,6 @@ "onCommand:python.viewOutput", "onCommand:python.execSelectionInTerminal", "onCommand:python.execSelectionInDjangoShell", - "onCommand:python.buildWorkspaceSymbols", "onCommand:python.startREPL", "onCommand:python.goToPythonObject", "onCommand:python.reportIssue", @@ -164,7 +163,7 @@ { "id": "python.learnMore", "title": "Learn more", - "description": "• Explore all the features the Python extension has to offer by looking for \"Python\" in the [Command Palette](command:workbench.action.showCommands).\n• [Sign up](https://aka.ms/python-vscode-mailinglist) for tips and tutorials through our mailing list.\n• Explore more features in our [Tutorials](https://aka.ms/AA8dqti) or check [Documentation](https://aka.ms/AA8dxwy) for tips and troubleshooting.\n• Take a look at our [Release Notes](https://aka.ms/AA8dxtb) to learn more about the latest features.", + "description": "� Explore all the features the Python extension has to offer by looking for \"Python\" in the [Command Palette](command:workbench.action.showCommands).\n� [Sign up](https://aka.ms/python-vscode-mailinglist) for tips and tutorials through our mailing list.\n� Explore more features in our [Tutorials](https://aka.ms/AA8dqti) or check [Documentation](https://aka.ms/AA8dxwy) for tips and troubleshooting.\n� Take a look at our [Release Notes](https://aka.ms/AA8dxtb) to learn more about the latest features.", "media": { "image": "resources/walkthrough/python-docs-learn-more.png", "altText": "Documentation page for Python in VS Code" @@ -249,7 +248,7 @@ { "id": "python.dataScienceLearnMore", "title": "Learn more", - "description": "• Explore all the features the Python extension has to offer by looking for \"Python\" in the [Command Palette](command:workbench.action.showCommands).\n• [Sign up](https://aka.ms/python-vscode-mailinglist) for tips and tutorials through our mailing list.\n• Explore more features in our [Tutorials](https://aka.ms/AAdar6q) or check the [Documentation](https://aka.ms/AA8dxwy) for tips and troubleshooting.\n• Take a look at our [Release Notes](https://aka.ms/AA8dxtb) to learn more about the latest features.", + "description": "� Explore all the features the Python extension has to offer by looking for \"Python\" in the [Command Palette](command:workbench.action.showCommands).\n� [Sign up](https://aka.ms/python-vscode-mailinglist) for tips and tutorials through our mailing list.\n� Explore more features in our [Tutorials](https://aka.ms/AAdar6q) or check the [Documentation](https://aka.ms/AA8dxwy) for tips and troubleshooting.\n� Take a look at our [Release Notes](https://aka.ms/AA8dxtb) to learn more about the latest features.", "media": { "image": "resources/walkthrough/datascience-learn-more.png", "altText": "Learning more from python visual studio code documentation" @@ -280,11 +279,6 @@ "command": "python.analysis.restartLanguageServer", "title": "%python.command.python.analysis.restartLanguageServer.title%" }, - { - "category": "Python", - "command": "python.buildWorkspaceSymbols", - "title": "%python.command.python.buildWorkspaceSymbols.title%" - }, { "category": "Python", "command": "python.clearPersistentStorage", @@ -380,7 +374,6 @@ { "category": "Test", "command": "testing.reRunFailTests", - "icon": { "dark": "resources/dark/run-failed-tests.svg", "light": "resources/light/run-failed-tests.svg" @@ -1249,47 +1242,6 @@ "description": "Path to folder with a list of Virtual Environments (e.g. ~/.pyenv, ~/Envs, ~/.virtualenvs).", "scope": "machine", "type": "string" - }, - "python.workspaceSymbols.ctagsPath": { - "default": "ctags", - "description": "Fully qualified path to the ctags executable (else leave as ctags, assuming it is in current path).", - "scope": "resource", - "type": "string" - }, - "python.workspaceSymbols.enabled": { - "default": false, - "description": "Set to 'true' to enable ctags to provide Workspace Symbols.", - "scope": "resource", - "type": "boolean" - }, - "python.workspaceSymbols.exclusionPatterns": { - "default": [ - "**/site-packages/**" - ], - "description": "Pattern used to exclude files and folders from ctags See http://ctags.sourceforge.net/ctags.html.", - "items": { - "type": "string" - }, - "scope": "resource", - "type": "array" - }, - "python.workspaceSymbols.rebuildOnFileSave": { - "default": true, - "description": "Whether to re-build the tags file on when changes made to python files are saved.", - "scope": "resource", - "type": "boolean" - }, - "python.workspaceSymbols.rebuildOnStart": { - "default": true, - "description": "Whether to re-build the tags file on start (defaults to true).", - "scope": "resource", - "type": "boolean" - }, - "python.workspaceSymbols.tagFilePath": { - "default": "${workspaceFolder}/.vscode/tags", - "description": "Fully qualified path to tag file (exuberant ctag file), used to provide workspace symbols.", - "scope": "resource", - "type": "string" } }, "title": "Python", @@ -1886,7 +1838,7 @@ "when": "resourceLangId == python" } ], - "view/title":[ + "view/title": [ { "command": "python.refreshTests", "when": "view == workbench.view.testing", diff --git a/src/client/activation/jedi.ts b/src/client/activation/jedi.ts index f65763ac8d72..a1d88c2c247f 100644 --- a/src/client/activation/jedi.ts +++ b/src/client/activation/jedi.ts @@ -39,12 +39,10 @@ import { PythonRenameProvider } from '../providers/renameProvider'; import { PythonSignatureProvider } from '../providers/signatureProvider'; import { JediSymbolProvider } from '../providers/symbolProvider'; import { PythonEnvironment } from '../pythonEnvironments/info'; -import { WorkspaceSymbols } from '../workspaceSymbols/main'; import { ILanguageServerActivator } from './types'; @injectable() export class JediExtensionActivator implements ILanguageServerActivator { - private static workspaceSymbols: WorkspaceSymbols | undefined; private readonly context: IExtensionContext; private jediFactory?: JediFactory; private readonly documentSelector: DocumentFilter[]; @@ -82,12 +80,6 @@ export class JediExtensionActivator implements ILanguageServerActivator { this.objectDefinitionProvider = new PythonObjectDefinitionProvider(jediFactory); this.symbolProvider = new JediSymbolProvider(serviceContainer, jediFactory); this.signatureProvider = new PythonSignatureProvider(jediFactory); - - if (!JediExtensionActivator.workspaceSymbols) { - // Workspace symbols is static because it doesn't rely on the jediFactory. - JediExtensionActivator.workspaceSymbols = new WorkspaceSymbols(serviceContainer); - context.subscriptions.push(JediExtensionActivator.workspaceSymbols); - } } public deactivate() { diff --git a/src/client/common/configSettings.ts b/src/client/common/configSettings.ts index 15239764306c..ea32412473ac 100644 --- a/src/client/common/configSettings.ts +++ b/src/client/common/configSettings.ts @@ -41,7 +41,6 @@ import { ISortImportSettings, ITensorBoardSettings, ITerminalSettings, - IWorkspaceSymbolSettings, LoggingLevelSettingType, Resource, } from './types'; @@ -128,8 +127,6 @@ export class PythonSettings implements IPythonSettings { public sortImports!: ISortImportSettings; - public workspaceSymbols!: IWorkspaceSymbolSettings; - public disableInstallationChecks = false; public globalModuleInstallation = false; @@ -478,33 +475,6 @@ export class PythonSettings implements IPythonSettings { typeshedPaths: [], }; - const workspaceSymbolsSettings = systemVariables.resolveAny( - pythonSettings.get('workspaceSymbols'), - )!; - if (this.workspaceSymbols) { - Object.assign( - this.workspaceSymbols, - workspaceSymbolsSettings, - ); - } else { - this.workspaceSymbols = workspaceSymbolsSettings; - } - // Support for travis. - this.workspaceSymbols = this.workspaceSymbols - ? this.workspaceSymbols - : { - ctagsPath: 'ctags', - enabled: true, - exclusionPatterns: [], - rebuildOnFileSave: true, - rebuildOnStart: true, - tagFilePath: workspaceRoot ? path.join(workspaceRoot, 'tags') : '', - }; - this.workspaceSymbols.tagFilePath = getAbsolutePath( - systemVariables.resolveAny(this.workspaceSymbols.tagFilePath), - workspaceRoot, - ); - const testSettings = systemVariables.resolveAny(pythonSettings.get('testing'))!; if (this.testing) { Object.assign(this.testing, testSettings); diff --git a/src/client/common/installer/productInstaller.ts b/src/client/common/installer/productInstaller.ts index add920fbb176..65cc04abb68c 100644 --- a/src/client/common/installer/productInstaller.ts +++ b/src/client/common/installer/productInstaller.ts @@ -1,7 +1,6 @@ /* eslint-disable max-classes-per-file */ import { inject, injectable, named } from 'inversify'; -import * as os from 'os'; import * as semver from 'semver'; import { CancellationToken, OutputChannel, Uri } from 'vscode'; import '../extensions'; @@ -14,9 +13,7 @@ import { EventName } from '../../telemetry/constants'; import { IApplicationShell, ICommandManager, IWorkspaceService } from '../application/types'; import { Commands, STANDARD_OUTPUT_CHANNEL } from '../constants'; import { traceError, traceInfo } from '../logger'; -import { IPlatformService } from '../platform/types'; import { IProcessServiceFactory, IPythonExecutionFactory } from '../process/types'; -import { ITerminalServiceFactory } from '../terminal/types'; import { IConfigurationService, IInstaller, @@ -42,9 +39,6 @@ import { export { Product } from '../types'; -export const CTagsInstallationScript = - os.platform() === 'darwin' ? 'brew install ctags' : 'sudo apt-get install exuberant-ctags'; - // Products which may not be available to install from certain package registries, keyed by product name // Installer implementations can check this to determine a suitable installation channel for a product // This is temporary and can be removed when https://github.com/microsoft/vscode-jupyter/issues/5034 is unblocked @@ -225,46 +219,6 @@ abstract class BaseInstaller { } } -export class CTagsInstaller extends BaseInstaller { - public async install(_product: Product, resource?: Uri): Promise { - if (this.serviceContainer.get(IPlatformService).isWindows) { - this.outputChannel.appendLine('Install Universal Ctags Win32 to enable support for Workspace Symbols'); - this.outputChannel.appendLine('Download the CTags binary from the Universal CTags site.'); - this.outputChannel.appendLine( - 'Option 1: Extract ctags.exe from the downloaded zip to any folder within your PATH so that Visual Studio Code can run it.', - ); - this.outputChannel.appendLine( - 'Option 2: Extract to any folder and add the path to this folder to the command setting.', - ); - this.outputChannel.appendLine( - 'Option 3: Extract to any folder and define that path in the python.workspaceSymbols.ctagsPath setting of your user settings file (settings.json).', - ); - this.outputChannel.show(); - } else { - const terminalService = this.serviceContainer - .get(ITerminalServiceFactory) - .getTerminalService({ resource }); - terminalService - .sendCommand(CTagsInstallationScript, []) - .catch((ex) => traceError(`Failed to install ctags. Script sent '${CTagsInstallationScript}', ${ex}`)); - } - return InstallerResponse.Ignore; - } - - protected async promptToInstallImplementation( - product: Product, - resource?: Uri, - _cancel?: CancellationToken, - ): Promise { - const item = await this.appShell.showErrorMessage( - 'Install CTags to enable Python workspace symbols?', - 'Yes', - 'No', - ); - return item === 'Yes' ? this.install(product, resource) : InstallerResponse.Ignore; - } -} - export class FormatterInstaller extends BaseInstaller { protected async promptToInstallImplementation( product: Product, @@ -614,8 +568,6 @@ export class ProductInstaller implements IInstaller { return new FormatterInstaller(this.serviceContainer, this.outputChannel); case ProductType.Linter: return new LinterInstaller(this.serviceContainer, this.outputChannel); - case ProductType.WorkspaceSymbols: - return new CTagsInstaller(this.serviceContainer, this.outputChannel); case ProductType.TestFramework: return new TestFrameworkInstaller(this.serviceContainer, this.outputChannel); case ProductType.RefactoringLibrary: diff --git a/src/client/common/installer/productPath.ts b/src/client/common/installer/productPath.ts index 2ac48ed35d62..f0055129a434 100644 --- a/src/client/common/installer/productPath.ts +++ b/src/client/common/installer/productPath.ts @@ -37,17 +37,6 @@ export abstract class BaseProductPathsService implements IProductPathService { } } -@injectable() -export class CTagsProductPathService extends BaseProductPathsService { - constructor(@inject(IServiceContainer) serviceContainer: IServiceContainer) { - super(serviceContainer); - } - public getExecutableNameFromSettings(_: Product, resource?: Uri): string { - const settings = this.configService.getSettings(resource); - return settings.workspaceSymbols.ctagsPath; - } -} - @injectable() export class FormatterProductPathService extends BaseProductPathsService { constructor(@inject(IServiceContainer) serviceContainer: IServiceContainer) { diff --git a/src/client/common/installer/productService.ts b/src/client/common/installer/productService.ts index 569a302e06df..499ccf07774f 100644 --- a/src/client/common/installer/productService.ts +++ b/src/client/common/installer/productService.ts @@ -20,7 +20,6 @@ export class ProductService implements IProductService { this.ProductTypes.set(Product.pydocstyle, ProductType.Linter); this.ProductTypes.set(Product.pylama, ProductType.Linter); this.ProductTypes.set(Product.pylint, ProductType.Linter); - this.ProductTypes.set(Product.ctags, ProductType.WorkspaceSymbols); this.ProductTypes.set(Product.pytest, ProductType.TestFramework); this.ProductTypes.set(Product.unittest, ProductType.TestFramework); this.ProductTypes.set(Product.autopep8, ProductType.Formatter); diff --git a/src/client/common/installer/serviceRegistry.ts b/src/client/common/installer/serviceRegistry.ts index a7c7dee08866..7e5cba29f231 100644 --- a/src/client/common/installer/serviceRegistry.ts +++ b/src/client/common/installer/serviceRegistry.ts @@ -13,7 +13,6 @@ import { PipEnvInstaller } from './pipEnvInstaller'; import { PipInstaller } from './pipInstaller'; import { PoetryInstaller } from './poetryInstaller'; import { - CTagsProductPathService, DataScienceProductPathService, FormatterProductPathService, LinterProductPathService, @@ -49,11 +48,6 @@ export function registerTypes(serviceManager: IServiceManager) { ); serviceManager.addSingleton(IProductService, ProductService); - serviceManager.addSingleton( - IProductPathService, - CTagsProductPathService, - ProductType.WorkspaceSymbols, - ); serviceManager.addSingleton( IProductPathService, FormatterProductPathService, diff --git a/src/client/common/types.ts b/src/client/common/types.ts index 7ff71aa96aea..0d6650df7dff 100644 --- a/src/client/common/types.ts +++ b/src/client/common/types.ts @@ -77,7 +77,6 @@ export enum ProductType { Formatter = 'Formatter', TestFramework = 'TestFramework', RefactoringLibrary = 'RefactoringLibrary', - WorkspaceSymbols = 'WorkspaceSymbols', DataScience = 'DataScience', } @@ -93,7 +92,6 @@ export enum Product { autopep8 = 10, mypy = 11, unittest = 12, - ctags = 13, rope = 14, isort = 15, black = 16, @@ -185,7 +183,6 @@ export interface IPythonSettings { readonly autoComplete: IAutoCompleteSettings; readonly terminal: ITerminalSettings; readonly sortImports: ISortImportSettings; - readonly workspaceSymbols: IWorkspaceSymbolSettings; readonly envFile: string; readonly disableInstallationChecks: boolean; readonly globalModuleInstallation: boolean; @@ -287,14 +284,7 @@ export interface IAutoCompleteSettings { readonly showAdvancedMembers: boolean; readonly typeshedPaths: string[]; } -export interface IWorkspaceSymbolSettings { - readonly enabled: boolean; - tagFilePath: string; - readonly rebuildOnStart: boolean; - readonly rebuildOnFileSave: boolean; - readonly ctagsPath: string; - readonly exclusionPatterns: string[]; -} + export interface ITerminalSettings { readonly executeInFileDir: boolean; readonly launchArgs: string[]; diff --git a/src/client/workspaceSymbols/contracts.ts b/src/client/workspaceSymbols/contracts.ts deleted file mode 100644 index ae447a4e2fbb..000000000000 --- a/src/client/workspaceSymbols/contracts.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Position, SymbolKind } from 'vscode'; - -export interface ITag { - fileName: string; - symbolName: string; - symbolKind: SymbolKind; - position: Position; - code: string; -} diff --git a/src/client/workspaceSymbols/generator.ts b/src/client/workspaceSymbols/generator.ts deleted file mode 100644 index 779440d8cfb5..000000000000 --- a/src/client/workspaceSymbols/generator.ts +++ /dev/null @@ -1,99 +0,0 @@ -import * as path from 'path'; -import { Disposable, OutputChannel, Uri } from 'vscode'; -import { IApplicationShell } from '../common/application/types'; -import { IFileSystem } from '../common/platform/types'; -import { IProcessServiceFactory } from '../common/process/types'; -import { IConfigurationService, IPythonSettings } from '../common/types'; -import { EXTENSION_ROOT_DIR } from '../constants'; -import { captureTelemetry } from '../telemetry'; -import { EventName } from '../telemetry/constants'; - -export class Generator implements Disposable { - private optionsFile: string; - private disposables: Disposable[]; - private pythonSettings: IPythonSettings; - public get tagFilePath(): string { - return this.pythonSettings.workspaceSymbols.tagFilePath; - } - public get enabled(): boolean { - return this.pythonSettings.workspaceSymbols.enabled; - } - constructor( - public readonly workspaceFolder: Uri, - private readonly output: OutputChannel, - private readonly appShell: IApplicationShell, - private readonly fs: IFileSystem, - private readonly processServiceFactory: IProcessServiceFactory, - configurationService: IConfigurationService, - ) { - this.disposables = []; - this.optionsFile = path.join(EXTENSION_ROOT_DIR, 'resources', 'ctagOptions'); - this.pythonSettings = configurationService.getSettings(workspaceFolder); - } - - public dispose() { - this.disposables.forEach((d) => d.dispose()); - } - public async generateWorkspaceTags(): Promise { - if (!this.pythonSettings.workspaceSymbols.enabled) { - return; - } - return this.generateTags({ directory: this.workspaceFolder.fsPath }); - } - private buildCmdArgs(): string[] { - const exclusions = this.pythonSettings.workspaceSymbols.exclusionPatterns; - const excludes = exclusions.length === 0 ? [] : exclusions.map((pattern) => `--exclude=${pattern}`); - - return [`--options=${this.optionsFile}`, '--languages=Python'].concat(excludes); - } - @captureTelemetry(EventName.WORKSPACE_SYMBOLS_BUILD) - private async generateTags(source: { directory?: string; file?: string }): Promise { - const tagFile = path.normalize(this.pythonSettings.workspaceSymbols.tagFilePath); - const cmd = this.pythonSettings.workspaceSymbols.ctagsPath; - const args = this.buildCmdArgs(); - let outputFile = tagFile; - if (source.file && source.file.length > 0) { - source.directory = path.dirname(source.file); - } - - if (path.dirname(outputFile) === source.directory) { - outputFile = path.basename(outputFile); - } - const outputDir = path.dirname(outputFile); - if (!(await this.fs.directoryExists(outputDir))) { - await this.fs.createDirectory(outputDir); - } - args.push('-o', outputFile, '.'); - this.output.appendLine(`${'-'.repeat(10)}Generating Tags${'-'.repeat(10)}`); - this.output.appendLine(`${cmd} ${args.join(' ')}`); - const promise = new Promise(async (resolve, reject) => { - try { - const processService = await this.processServiceFactory.create(); - const result = processService.execObservable(cmd, args, { cwd: source.directory }); - let errorMsg = ''; - result.out.subscribe( - (output) => { - if (output.source === 'stderr') { - errorMsg += output.out; - } - this.output.append(output.out); - }, - reject, - () => { - if (errorMsg.length > 0) { - reject(new Error(errorMsg)); - } else { - resolve(); - } - }, - ); - } catch (ex) { - reject(ex); - } - }); - - this.appShell.setStatusBarMessage('Generating Tags', promise); - - await promise; - } -} diff --git a/src/client/workspaceSymbols/main.ts b/src/client/workspaceSymbols/main.ts deleted file mode 100644 index af3aa232a90b..000000000000 --- a/src/client/workspaceSymbols/main.ts +++ /dev/null @@ -1,151 +0,0 @@ -import { CancellationToken, Disposable, languages, OutputChannel, TextDocument } from 'vscode'; -import { IApplicationShell, ICommandManager, IDocumentManager, IWorkspaceService } from '../common/application/types'; -import { Commands, STANDARD_OUTPUT_CHANNEL } from '../common/constants'; -import { isNotInstalledError } from '../common/helpers'; -import { IFileSystem } from '../common/platform/types'; -import { IProcessServiceFactory } from '../common/process/types'; -import { IConfigurationService, IInstaller, InstallerResponse, IOutputChannel, Product } from '../common/types'; -import { IServiceContainer } from '../ioc/types'; -import { Generator } from './generator'; -import { WorkspaceSymbolProvider } from './provider'; - -const MAX_NUMBER_OF_ATTEMPTS_TO_INSTALL_AND_BUILD = 2; - -export class WorkspaceSymbols implements Disposable { - private disposables: Disposable[]; - private generators: Generator[] = []; - private readonly outputChannel: OutputChannel; - private commandMgr: ICommandManager; - private fs: IFileSystem; - private workspace: IWorkspaceService; - private processFactory: IProcessServiceFactory; - private appShell: IApplicationShell; - private configurationService: IConfigurationService; - private documents: IDocumentManager; - - constructor(private serviceContainer: IServiceContainer) { - this.outputChannel = this.serviceContainer.get(IOutputChannel, STANDARD_OUTPUT_CHANNEL); - this.commandMgr = this.serviceContainer.get(ICommandManager); - this.fs = this.serviceContainer.get(IFileSystem); - this.workspace = this.serviceContainer.get(IWorkspaceService); - this.processFactory = this.serviceContainer.get(IProcessServiceFactory); - this.appShell = this.serviceContainer.get(IApplicationShell); - this.configurationService = this.serviceContainer.get(IConfigurationService); - this.documents = this.serviceContainer.get(IDocumentManager); - this.disposables = []; - this.disposables.push(this.outputChannel); - this.registerCommands(); - this.initializeGenerators(); - languages.registerWorkspaceSymbolProvider( - new WorkspaceSymbolProvider(this.fs, this.commandMgr, this.generators), - ); - this.disposables.push(this.workspace.onDidChangeWorkspaceFolders(() => this.initializeGenerators())); - this.disposables.push(this.documents.onDidSaveTextDocument((e) => this.onDocumentSaved(e))); - this.buildSymbolsOnStart(); - } - public dispose() { - this.disposables.forEach((d) => d.dispose()); - } - private initializeGenerators() { - while (this.generators.length > 0) { - const generator = this.generators.shift()!; - generator.dispose(); - } - - if (Array.isArray(this.workspace.workspaceFolders)) { - this.workspace.workspaceFolders.forEach((wkSpc) => { - this.generators.push( - new Generator( - wkSpc.uri, - this.outputChannel, - this.appShell, - this.fs, - this.processFactory, - this.configurationService, - ), - ); - }); - } - } - - private buildSymbolsOnStart() { - if (Array.isArray(this.workspace.workspaceFolders)) { - this.workspace.workspaceFolders.forEach((workspaceFolder) => { - const pythonSettings = this.configurationService.getSettings(workspaceFolder.uri); - if (pythonSettings.workspaceSymbols.rebuildOnStart) { - const promises = this.buildWorkspaceSymbols(true); - return Promise.all(promises); - } - }); - } - } - - private registerCommands() { - this.disposables.push( - this.commandMgr.registerCommand( - Commands.Build_Workspace_Symbols, - async (rebuild: boolean = true, token?: CancellationToken) => { - const promises = this.buildWorkspaceSymbols(rebuild, token); - return Promise.all(promises); - }, - ), - ); - } - - private onDocumentSaved(document: TextDocument) { - const workspaceFolder = this.workspace.getWorkspaceFolder(document.uri); - const pythonSettings = this.configurationService.getSettings(workspaceFolder?.uri); - if (pythonSettings.workspaceSymbols.rebuildOnFileSave) { - const promises = this.buildWorkspaceSymbols(true); - return Promise.all(promises); - } - } - - private buildWorkspaceSymbols(rebuild: boolean = true, token?: CancellationToken): Promise[] { - if (token && token.isCancellationRequested) { - return []; - } - if (this.generators.length === 0) { - return []; - } - - let promptPromise: Promise; - let promptResponse: InstallerResponse; - return this.generators.map(async (generator) => { - if (!generator.enabled) { - return; - } - const exists = await this.fs.fileExists(generator.tagFilePath); - // If file doesn't exist, then run the ctag generator, - // or check if required to rebuild. - if (!rebuild && exists) { - return; - } - for (let counter = 0; counter < MAX_NUMBER_OF_ATTEMPTS_TO_INSTALL_AND_BUILD; counter += 1) { - try { - await generator.generateWorkspaceTags(); - return; - } catch (error) { - if (!isNotInstalledError(error)) { - return; - } - } - if (!token || token.isCancellationRequested) { - return; - } - // Display prompt once for all workspaces. - if (promptPromise) { - promptResponse = await promptPromise; - continue; - } else { - const installer = this.serviceContainer.get(IInstaller); - promptPromise = installer.promptToInstall(Product.ctags, this.workspace.workspaceFolders![0]!.uri); - promptResponse = await promptPromise; - } - if (promptResponse !== InstallerResponse.Installed || !token || token.isCancellationRequested) { - return; - } - } - }); - } -} diff --git a/src/client/workspaceSymbols/parser.ts b/src/client/workspaceSymbols/parser.ts deleted file mode 100644 index b46ce151f6b4..000000000000 --- a/src/client/workspaceSymbols/parser.ts +++ /dev/null @@ -1,170 +0,0 @@ -import * as path from 'path'; -import * as vscode from 'vscode'; -import { IFileSystem } from '../common/platform/types'; -import { ITag } from './contracts'; - -// TODO: Turn these into imports. -const LineByLineReader = require('line-by-line'); -const NamedRegexp = require('named-js-regexp'); -const fuzzy = require('fuzzy'); - -const IsFileRegEx = /\tkind:file\tline:\d+$/g; -const LINE_REGEX = '(?\\w+)\\t(?.*)\\t\\/\\^(?.*)\\$\\/;"\\tkind:(?\\w+)\\tline:(?\\d+)$'; - -interface IRegexGroup { - name: string; - file: string; - code: string; - type: string; - line: number; -} - -function matchNamedRegEx(data: String, regex: String): IRegexGroup | null { - const compiledRegexp = NamedRegexp(regex, 'g'); - const rawMatch = compiledRegexp.exec(data); - if (rawMatch !== null) { - return rawMatch.groups(); - } - - return null; -} - -const CTagKinMapping = new Map(); -CTagKinMapping.set('_array', vscode.SymbolKind.Array); -CTagKinMapping.set('_boolean', vscode.SymbolKind.Boolean); -CTagKinMapping.set('_class', vscode.SymbolKind.Class); -CTagKinMapping.set('_classes', vscode.SymbolKind.Class); -CTagKinMapping.set('_constant', vscode.SymbolKind.Constant); -CTagKinMapping.set('_constants', vscode.SymbolKind.Constant); -CTagKinMapping.set('_constructor', vscode.SymbolKind.Constructor); -CTagKinMapping.set('_enum', vscode.SymbolKind.Enum); -CTagKinMapping.set('_enums', vscode.SymbolKind.Enum); -CTagKinMapping.set('_enumeration', vscode.SymbolKind.Enum); -CTagKinMapping.set('_enumerations', vscode.SymbolKind.Enum); -CTagKinMapping.set('_field', vscode.SymbolKind.Field); -CTagKinMapping.set('_fields', vscode.SymbolKind.Field); -CTagKinMapping.set('_file', vscode.SymbolKind.File); -CTagKinMapping.set('_files', vscode.SymbolKind.File); -CTagKinMapping.set('_function', vscode.SymbolKind.Function); -CTagKinMapping.set('_functions', vscode.SymbolKind.Function); -CTagKinMapping.set('_member', vscode.SymbolKind.Function); -CTagKinMapping.set('_interface', vscode.SymbolKind.Interface); -CTagKinMapping.set('_interfaces', vscode.SymbolKind.Interface); -CTagKinMapping.set('_key', vscode.SymbolKind.Key); -CTagKinMapping.set('_keys', vscode.SymbolKind.Key); -CTagKinMapping.set('_method', vscode.SymbolKind.Method); -CTagKinMapping.set('_methods', vscode.SymbolKind.Method); -CTagKinMapping.set('_module', vscode.SymbolKind.Module); -CTagKinMapping.set('_modules', vscode.SymbolKind.Module); -CTagKinMapping.set('_namespace', vscode.SymbolKind.Namespace); -CTagKinMapping.set('_namespaces', vscode.SymbolKind.Namespace); -CTagKinMapping.set('_number', vscode.SymbolKind.Number); -CTagKinMapping.set('_numbers', vscode.SymbolKind.Number); -CTagKinMapping.set('_null', vscode.SymbolKind.Null); -CTagKinMapping.set('_object', vscode.SymbolKind.Object); -CTagKinMapping.set('_package', vscode.SymbolKind.Package); -CTagKinMapping.set('_packages', vscode.SymbolKind.Package); -CTagKinMapping.set('_property', vscode.SymbolKind.Property); -CTagKinMapping.set('_properties', vscode.SymbolKind.Property); -CTagKinMapping.set('_objects', vscode.SymbolKind.Object); -CTagKinMapping.set('_string', vscode.SymbolKind.String); -CTagKinMapping.set('_variable', vscode.SymbolKind.Variable); -CTagKinMapping.set('_variables', vscode.SymbolKind.Variable); -CTagKinMapping.set('_projects', vscode.SymbolKind.Package); -CTagKinMapping.set('_defines', vscode.SymbolKind.Module); -CTagKinMapping.set('_labels', vscode.SymbolKind.Interface); -CTagKinMapping.set('_macros', vscode.SymbolKind.Function); -CTagKinMapping.set('_types (structs and records)', vscode.SymbolKind.Class); -CTagKinMapping.set('_subroutine', vscode.SymbolKind.Method); -CTagKinMapping.set('_subroutines', vscode.SymbolKind.Method); -CTagKinMapping.set('_types', vscode.SymbolKind.Class); -CTagKinMapping.set('_programs', vscode.SymbolKind.Class); -CTagKinMapping.set("_Object's method", vscode.SymbolKind.Method); -CTagKinMapping.set('_Module or functor', vscode.SymbolKind.Module); -CTagKinMapping.set('_Global variable', vscode.SymbolKind.Variable); -CTagKinMapping.set('_Type name', vscode.SymbolKind.Class); -CTagKinMapping.set('_A function', vscode.SymbolKind.Function); -CTagKinMapping.set('_A constructor', vscode.SymbolKind.Constructor); -CTagKinMapping.set('_An exception', vscode.SymbolKind.Class); -CTagKinMapping.set("_A 'structure' field", vscode.SymbolKind.Field); -CTagKinMapping.set('_procedure', vscode.SymbolKind.Function); -CTagKinMapping.set('_procedures', vscode.SymbolKind.Function); -CTagKinMapping.set('_constant definitions', vscode.SymbolKind.Constant); -CTagKinMapping.set('_javascript functions', vscode.SymbolKind.Function); -CTagKinMapping.set('_singleton methods', vscode.SymbolKind.Method); - -const newValuesAndKeys = {}; -CTagKinMapping.forEach((value, key) => { - (newValuesAndKeys as any)[key.substring(1)] = value; -}); -Object.keys(newValuesAndKeys).forEach((key) => { - CTagKinMapping.set(key, (newValuesAndKeys as any)[key]); -}); - -export function parseTags( - workspaceFolder: string, - tagFile: string, - query: string, - token: vscode.CancellationToken, - fs: IFileSystem, -): Promise { - return fs.fileExists(tagFile).then((exists) => { - if (!exists) { - return Promise.resolve([]); - } - - return new Promise((resolve, reject) => { - const lr = new LineByLineReader(tagFile); - let lineNumber = 0; - const tags: ITag[] = []; - - lr.on('error', (err: Error) => { - reject(err); - }); - - lr.on('line', (line: string) => { - lineNumber = lineNumber + 1; - if (token.isCancellationRequested) { - lr.close(); - return; - } - const tag = parseTagsLine(workspaceFolder, line, query); - if (tag) { - tags.push(tag); - } - if (tags.length >= 100) { - lr.close(); - } - }); - - lr.on('end', () => { - resolve(tags); - }); - }); - }); -} -function parseTagsLine(workspaceFolder: string, line: string, searchPattern: string): ITag | undefined { - if (IsFileRegEx.test(line)) { - return; - } - const match = matchNamedRegEx(line, LINE_REGEX); - if (!match) { - return; - } - if (!fuzzy.test(searchPattern, match.name)) { - return; - } - let file = match.file; - if (!path.isAbsolute(file)) { - file = path.resolve(workspaceFolder, '.vscode', file); - } - - const symbolKind = CTagKinMapping.get(match.type) || vscode.SymbolKind.Null; - return { - fileName: file, - code: match.code, - position: new vscode.Position(Number(match.line) - 1, 0), - symbolName: match.name, - symbolKind: symbolKind, - }; -} diff --git a/src/client/workspaceSymbols/provider.ts b/src/client/workspaceSymbols/provider.ts deleted file mode 100644 index 7fa6c2e1d0d6..000000000000 --- a/src/client/workspaceSymbols/provider.ts +++ /dev/null @@ -1,75 +0,0 @@ -'use strict'; - -const flatten = require('lodash/flatten') as typeof import('lodash/flatten'); -import { - CancellationToken, - Location, - SymbolInformation, - Uri, - WorkspaceSymbolProvider as IWorspaceSymbolProvider, -} from 'vscode'; -import { ICommandManager } from '../common/application/types'; -import { Commands } from '../common/constants'; -import { IFileSystem } from '../common/platform/types'; -import { captureTelemetry } from '../telemetry'; -import { EventName } from '../telemetry/constants'; -import { Generator } from './generator'; -import { parseTags } from './parser'; - -export class WorkspaceSymbolProvider implements IWorspaceSymbolProvider { - public constructor( - private fs: IFileSystem, - private commands: ICommandManager, - private tagGenerators: Generator[], - ) {} - - @captureTelemetry(EventName.WORKSPACE_SYMBOLS_GO_TO) - public async provideWorkspaceSymbols(query: string, token: CancellationToken): Promise { - if (this.tagGenerators.length === 0) { - return []; - } - const generatorsWithTagFiles = await Promise.all( - this.tagGenerators.map((generator) => this.fs.fileExists(generator.tagFilePath)), - ); - if (generatorsWithTagFiles.filter((exists) => exists).length !== this.tagGenerators.length) { - await this.commands.executeCommand(Commands.Build_Workspace_Symbols, true, token); - } - - const generators: Generator[] = []; - await Promise.all( - this.tagGenerators.map(async (generator) => { - if (await this.fs.fileExists(generator.tagFilePath)) { - generators.push(generator); - } - }), - ); - - const promises = generators - .filter((generator) => generator !== undefined && generator.enabled) - .map(async (generator) => { - // load tags - const items = await parseTags( - generator!.workspaceFolder.fsPath, - generator!.tagFilePath, - query, - token, - this.fs, - ); - if (!Array.isArray(items)) { - return []; - } - return items.map( - (item) => - new SymbolInformation( - item.symbolName, - item.symbolKind, - '', - new Location(Uri.file(item.fileName), item.position), - ), - ); - }); - - const symbols = await Promise.all(promises); - return flatten(symbols); - } -} diff --git a/src/test/.vscode/tags b/src/test/.vscode/tags deleted file mode 100644 index e4dc3f827c89..000000000000 --- a/src/test/.vscode/tags +++ /dev/null @@ -1,721 +0,0 @@ -!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ -!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ -!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ -!_TAG_PROGRAM_AUTHOR Universal Ctags Team // -!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ -!_TAG_PROGRAM_URL https://ctags.io/ /official site/ -!_TAG_PROGRAM_VERSION 0.0.0 /f9e6e3c1/ -A ..\\pythonFiles\\autocomp\\pep526.py /^class A:$/;" kind:class line:13 -A ..\\pythonFiles\\definition\\await.test.py /^class A:$/;" kind:class line:3 -B ..\\pythonFiles\\autocomp\\pep526.py /^class B:$/;" kind:class line:17 -B ..\\pythonFiles\\typeFormatFiles\\tryBlocks2.py /^class B(Exception):$/;" kind:class line:19 -B ..\\pythonFiles\\typeFormatFiles\\tryBlocks4.py /^class B(Exception):$/;" kind:class line:19 -B ..\\pythonFiles\\typeFormatFiles\\tryBlocksTab.py /^class B(Exception):$/;" kind:class line:19 -BaseRefactoring ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^class BaseRefactoring(object):$/;" kind:class line:54 -BoundedQueue ..\\pythonFiles\\autocomp\\misc.py /^ class BoundedQueue(_Verbose):$/;" kind:class line:1250 -BoundedSemaphore ..\\pythonFiles\\autocomp\\misc.py /^def BoundedSemaphore(*args, **kwargs):$/;" kind:function line:497 -C ..\\pythonFiles\\typeFormatFiles\\tryBlocks2.py /^class C(B):$/;" kind:class line:22 -C ..\\pythonFiles\\typeFormatFiles\\tryBlocks4.py /^class C(B):$/;" kind:class line:22 -C ..\\pythonFiles\\typeFormatFiles\\tryBlocksTab.py /^class C(B):$/;" kind:class line:22 -Change ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^class Change():$/;" kind:class line:41 -ChangeType ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^class ChangeType():$/;" kind:class line:32 -Child2Class ..\\pythonFiles\\symbolFiles\\childFile.py /^class Child2Class(object):$/;" kind:class line:5 -Class1 ..\\pythonFiles\\autocomp\\one.py /^class Class1(object):$/;" kind:class line:6 -Class1 ..\\pythonFiles\\definition\\one.py /^class Class1(object):$/;" kind:class line:6 -Condition ..\\pythonFiles\\autocomp\\misc.py /^def Condition(*args, **kwargs):$/;" kind:function line:242 -ConsumerThread ..\\pythonFiles\\autocomp\\misc.py /^ class ConsumerThread(Thread):$/;" kind:class line:1298 -D ..\\pythonFiles\\typeFormatFiles\\tryBlocks2.py /^class D(C):$/;" kind:class line:25 -D ..\\pythonFiles\\typeFormatFiles\\tryBlocks4.py /^class D(C):$/;" kind:class line:25 -D ..\\pythonFiles\\typeFormatFiles\\tryBlocksTab.py /^class D(C):$/;" kind:class line:25 -DELETE ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ DELETE = 2$/;" kind:variable line:38 -DELETE ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ DELETE = 2$/;" kind:variable line:46 -Decorator ..\\pythonFiles\\autocomp\\deco.py /^class Decorator(metaclass=abc.ABCMeta):$/;" kind:class line:3 -DoSomething ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py /^class DoSomething():$/;" kind:class line:200 -DoSomething ..\\pythonFiles\\typeFormatFiles\\elseBlocks4.py /^class DoSomething():$/;" kind:class line:200 -DoSomething ..\\pythonFiles\\typeFormatFiles\\elseBlocksTab.py /^class DoSomething():$/;" kind:class line:200 -EDIT ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ EDIT = 0$/;" kind:variable line:36 -EDIT ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ EDIT = 0$/;" kind:variable line:44 -Event ..\\pythonFiles\\autocomp\\misc.py /^def Event(*args, **kwargs):$/;" kind:function line:542 -Example3 ..\\pythonFiles\\formatting\\fileToFormat.py /^class Example3( object ):$/;" kind:class line:12 -ExtractMethodRefactor ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^class ExtractMethodRefactor(ExtractVariableRefactor):$/;" kind:class line:144 -ExtractVariableRefactor ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^class ExtractVariableRefactor(BaseRefactoring):$/;" kind:class line:120 -Foo ..\\multiRootWkspc\\disableLinters\\file.py /^class Foo(object):$/;" kind:class line:5 -Foo ..\\multiRootWkspc\\parent\\child\\file.py /^class Foo(object):$/;" kind:class line:5 -Foo ..\\multiRootWkspc\\workspace1\\file.py /^class Foo(object):$/;" kind:class line:5 -Foo ..\\multiRootWkspc\\workspace2\\file.py /^class Foo(object):$/;" kind:class line:5 -Foo ..\\multiRootWkspc\\workspace3\\file.py /^class Foo(object):$/;" kind:class line:5 -Foo ..\\pythonFiles\\autocomp\\four.py /^class Foo(object):$/;" kind:class line:7 -Foo ..\\pythonFiles\\definition\\four.py /^class Foo(object):$/;" kind:class line:7 -Foo ..\\pythonFiles\\linting\\file.py /^class Foo(object):$/;" kind:class line:5 -Foo ..\\pythonFiles\\linting\\flake8config\\file.py /^class Foo(object):$/;" kind:class line:5 -Foo ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^class Foo(object):$/;" kind:class line:5 -Foo ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^class Foo(object):$/;" kind:class line:5 -Foo ..\\pythonFiles\\linting\\pylintconfig\\file.py /^class Foo(object):$/;" kind:class line:5 -Foo ..\\pythonFiles\\symbolFiles\\file.py /^class Foo(object):$/;" kind:class line:5 -Gaussian ..\\pythonFiles\\jupyter\\cells.py /^class Gaussian(object):$/;" kind:class line:100 -Lock ..\\pythonFiles\\autocomp\\misc.py /^Lock = _allocate_lock$/;" kind:variable line:112 -N ..\\pythonFiles\\jupyter\\cells.py /^N = 50$/;" kind:variable line:42 -NEW ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ NEW = 1$/;" kind:variable line:37 -NEW ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ NEW = 1$/;" kind:variable line:45 -PEP_484_style ..\\pythonFiles\\autocomp\\pep526.py /^PEP_484_style = SOMETHING # type: str$/;" kind:variable line:5 -PEP_526_style ..\\pythonFiles\\autocomp\\pep526.py /^PEP_526_style: str = "hello world"$/;" kind:variable line:3 -ProducerThread ..\\pythonFiles\\autocomp\\misc.py /^ class ProducerThread(Thread):$/;" kind:class line:1282 -RLock ..\\pythonFiles\\autocomp\\misc.py /^def RLock(*args, **kwargs):$/;" kind:function line:114 -ROPE_PROJECT_FOLDER ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ROPE_PROJECT_FOLDER = sys.argv[2]$/;" kind:variable line:18 -ROPE_PROJECT_FOLDER ..\\pythonFiles\\sorting\\noconfig\\after.py /^ROPE_PROJECT_FOLDER = sys.argv[2]$/;" kind:variable line:12 -ROPE_PROJECT_FOLDER ..\\pythonFiles\\sorting\\noconfig\\before.py /^ROPE_PROJECT_FOLDER = sys.argv[2]$/;" kind:variable line:9 -ROPE_PROJECT_FOLDER ..\\pythonFiles\\sorting\\noconfig\\original.py /^ROPE_PROJECT_FOLDER = sys.argv[2]$/;" kind:variable line:9 -Random ..\\pythonFiles\\autocomp\\misc.py /^class Random(_random.Random):$/;" kind:class line:1331 -RefactorProgress ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^class RefactorProgress():$/;" kind:class line:21 -RenameRefactor ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^class RenameRefactor(BaseRefactoring):$/;" kind:class line:101 -RopeRefactoring ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^class RopeRefactoring(object):$/;" kind:class line:162 -Semaphore ..\\pythonFiles\\autocomp\\misc.py /^def Semaphore(*args, **kwargs):$/;" kind:function line:412 -TOOLS ..\\pythonFiles\\jupyter\\cells.py /^TOOLS = "pan,wheel_zoom,box_zoom,reset,save,box_select"$/;" kind:variable line:68 -Test_CheckMyApp ..\\pythonFiles\\testFiles\\standard\\tests\\test_pytest.py /^class Test_CheckMyApp:$/;" kind:class line:6 -Test_CheckMyApp ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_pytest.py /^class Test_CheckMyApp:$/;" kind:class line:6 -Test_CheckMyApp ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_pytest.py /^class Test_CheckMyApp:$/;" kind:class line:6 -Test_Current_Working_Directory ..\\pythonFiles\\testFiles\\cwd\\src\\tests\\test_cwd.py /^class Test_Current_Working_Directory(unittest.TestCase):$/;" kind:class line:6 -Test_NestedClassA ..\\pythonFiles\\testFiles\\standard\\tests\\test_pytest.py /^ class Test_NestedClassA:$/;" kind:class line:13 -Test_NestedClassA ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_pytest.py /^ class Test_NestedClassA:$/;" kind:class line:13 -Test_NestedClassA ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_pytest.py /^ class Test_NestedClassA:$/;" kind:class line:13 -Test_Root_test1 ..\\pythonFiles\\testFiles\\single\\test_root.py /^class Test_Root_test1(unittest.TestCase):$/;" kind:class line:6 -Test_Root_test1 ..\\pythonFiles\\testFiles\\standard\\test_root.py /^class Test_Root_test1(unittest.TestCase):$/;" kind:class line:6 -Test_Root_test1 ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\test_root.py /^class Test_Root_test1(unittest.TestCase):$/;" kind:class line:6 -Test_nested_classB_Of_A ..\\pythonFiles\\testFiles\\standard\\tests\\test_pytest.py /^ class Test_nested_classB_Of_A:$/;" kind:class line:16 -Test_nested_classB_Of_A ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_pytest.py /^ class Test_nested_classB_Of_A:$/;" kind:class line:16 -Test_nested_classB_Of_A ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_pytest.py /^ class Test_nested_classB_Of_A:$/;" kind:class line:16 -Test_test1 ..\\pythonFiles\\testFiles\\single\\tests\\test_one.py /^class Test_test1(unittest.TestCase):$/;" kind:class line:6 -Test_test1 ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_one.py /^class Test_test1(unittest.TestCase):$/;" kind:class line:6 -Test_test1 ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_unittest_one.py /^class Test_test1(unittest.TestCase):$/;" kind:class line:6 -Test_test1 ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_one.py /^class Test_test1(unittest.TestCase):$/;" kind:class line:6 -Test_test2 ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_two.py /^class Test_test2(unittest.TestCase):$/;" kind:class line:3 -Test_test2 ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_two.py /^class Test_test2(unittest.TestCase):$/;" kind:class line:3 -Test_test2a ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_two.py /^class Test_test2a(unittest.TestCase):$/;" kind:class line:17 -Test_test2a ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_two.py /^class Test_test2a(unittest.TestCase):$/;" kind:class line:17 -Test_test2a1 ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_two.py /^ class Test_test2a1(unittest.TestCase):$/;" kind:class line:24 -Test_test2a1 ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_two.py /^ class Test_test2a1(unittest.TestCase):$/;" kind:class line:24 -Test_test3 ..\\pythonFiles\\testFiles\\standard\\tests\\unittest_three_test.py /^class Test_test3(unittest.TestCase):$/;" kind:class line:4 -Test_test3 ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\unittest_three_test.py /^class Test_test3(unittest.TestCase):$/;" kind:class line:4 -Test_test_one_1 ..\\pythonFiles\\testFiles\\specificTest\\tests\\test_unittest_one.py /^class Test_test_one_1(unittest.TestCase):$/;" kind:class line:3 -Test_test_one_2 ..\\pythonFiles\\testFiles\\specificTest\\tests\\test_unittest_one.py /^class Test_test_one_2(unittest.TestCase):$/;" kind:class line:14 -Test_test_two_1 ..\\pythonFiles\\testFiles\\specificTest\\tests\\test_unittest_two.py /^class Test_test_two_1(unittest.TestCase):$/;" kind:class line:3 -Test_test_two_2 ..\\pythonFiles\\testFiles\\specificTest\\tests\\test_unittest_two.py /^class Test_test_two_2(unittest.TestCase):$/;" kind:class line:14 -Thread ..\\pythonFiles\\autocomp\\misc.py /^class Thread(_Verbose):$/;" kind:class line:640 -ThreadError ..\\pythonFiles\\autocomp\\misc.py /^ThreadError = thread.error$/;" kind:variable line:38 -Timer ..\\pythonFiles\\autocomp\\misc.py /^def Timer(*args, **kwargs):$/;" kind:function line:1046 -VERSION ..\\pythonFiles\\autocomp\\misc.py /^ VERSION = 3 # used by getstate\/setstate$/;" kind:variable line:1345 -WORKSPACE_ROOT ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^WORKSPACE_ROOT = sys.argv[1]$/;" kind:variable line:17 -WORKSPACE_ROOT ..\\pythonFiles\\sorting\\noconfig\\after.py /^WORKSPACE_ROOT = sys.argv[1]$/;" kind:variable line:11 -WORKSPACE_ROOT ..\\pythonFiles\\sorting\\noconfig\\before.py /^WORKSPACE_ROOT = sys.argv[1]$/;" kind:variable line:8 -WORKSPACE_ROOT ..\\pythonFiles\\sorting\\noconfig\\original.py /^WORKSPACE_ROOT = sys.argv[1]$/;" kind:variable line:8 -Workspace2Class ..\\pythonFiles\\symbolFiles\\workspace2File.py /^class Workspace2Class(object):$/;" kind:class line:5 -_BoundedSemaphore ..\\pythonFiles\\autocomp\\misc.py /^class _BoundedSemaphore(_Semaphore):$/;" kind:class line:515 -_Condition ..\\pythonFiles\\autocomp\\misc.py /^class _Condition(_Verbose):$/;" kind:class line:255 -_DummyThread ..\\pythonFiles\\autocomp\\misc.py /^class _DummyThread(Thread):$/;" kind:class line:1128 -_Event ..\\pythonFiles\\autocomp\\misc.py /^class _Event(_Verbose):$/;" kind:class line:552 -_MainThread ..\\pythonFiles\\autocomp\\misc.py /^class _MainThread(Thread):$/;" kind:class line:1088 -_RLock ..\\pythonFiles\\autocomp\\misc.py /^class _RLock(_Verbose):$/;" kind:class line:125 -_Semaphore ..\\pythonFiles\\autocomp\\misc.py /^class _Semaphore(_Verbose):$/;" kind:class line:423 -_Timer ..\\pythonFiles\\autocomp\\misc.py /^class _Timer(Thread):$/;" kind:class line:1058 -_VERBOSE ..\\pythonFiles\\autocomp\\misc.py /^_VERBOSE = False$/;" kind:variable line:53 -_Verbose ..\\pythonFiles\\autocomp\\misc.py /^ class _Verbose(object):$/;" kind:class line:57 -_Verbose ..\\pythonFiles\\autocomp\\misc.py /^ class _Verbose(object):$/;" kind:class line:79 -__all__ ..\\pythonFiles\\autocomp\\misc.py /^__all__ = ['activeCount', 'active_count', 'Condition', 'currentThread',$/;" kind:variable line:30 -__bootstrap ..\\pythonFiles\\autocomp\\misc.py /^ def __bootstrap(self):$/;" kind:member line:769 -__bootstrap_inner ..\\pythonFiles\\autocomp\\misc.py /^ def __bootstrap_inner(self):$/;" kind:member line:792 -__delete ..\\pythonFiles\\autocomp\\misc.py /^ def __delete(self):$/;" kind:member line:876 -__enter__ ..\\pythonFiles\\autocomp\\misc.py /^ __enter__ = acquire$/;" kind:variable line:185 -__enter__ ..\\pythonFiles\\autocomp\\misc.py /^ __enter__ = acquire$/;" kind:variable line:477 -__enter__ ..\\pythonFiles\\autocomp\\misc.py /^ def __enter__(self):$/;" kind:member line:285 -__exc_clear ..\\pythonFiles\\autocomp\\misc.py /^ __exc_clear = _sys.exc_clear$/;" kind:variable line:654 -__exc_info ..\\pythonFiles\\autocomp\\misc.py /^ __exc_info = _sys.exc_info$/;" kind:variable line:651 -__exit__ ..\\pythonFiles\\autocomp\\misc.py /^ def __exit__(self, *args):$/;" kind:member line:288 -__exit__ ..\\pythonFiles\\autocomp\\misc.py /^ def __exit__(self, t, v, tb):$/;" kind:member line:215 -__exit__ ..\\pythonFiles\\autocomp\\misc.py /^ def __exit__(self, t, v, tb):$/;" kind:member line:493 -__getstate__ ..\\pythonFiles\\autocomp\\misc.py /^ def __getstate__(self): # for pickle$/;" kind:member line:1422 -__init__ ..\\multiRootWkspc\\disableLinters\\file.py /^ def __init__(self):$/;" kind:member line:8 -__init__ ..\\multiRootWkspc\\parent\\child\\file.py /^ def __init__(self):$/;" kind:member line:8 -__init__ ..\\multiRootWkspc\\workspace1\\file.py /^ def __init__(self):$/;" kind:member line:8 -__init__ ..\\multiRootWkspc\\workspace2\\file.py /^ def __init__(self):$/;" kind:member line:8 -__init__ ..\\multiRootWkspc\\workspace3\\file.py /^ def __init__(self):$/;" kind:member line:8 -__init__ ..\\pythonFiles\\autocomp\\misc.py /^ def __init__(self, limit):$/;" kind:member line:1252 -__init__ ..\\pythonFiles\\autocomp\\misc.py /^ def __init__(self, queue, count):$/;" kind:member line:1300 -__init__ ..\\pythonFiles\\autocomp\\misc.py /^ def __init__(self, queue, quota):$/;" kind:member line:1284 -__init__ ..\\pythonFiles\\autocomp\\misc.py /^ def __init__(self, verbose=None):$/;" kind:member line:59 -__init__ ..\\pythonFiles\\autocomp\\misc.py /^ def __init__(self, verbose=None):$/;" kind:member line:80 -__init__ ..\\pythonFiles\\autocomp\\misc.py /^ def __init__(self):$/;" kind:member line:1090 -__init__ ..\\pythonFiles\\autocomp\\misc.py /^ def __init__(self):$/;" kind:member line:1130 -__init__ ..\\pythonFiles\\autocomp\\misc.py /^ def __init__(self, group=None, target=None, name=None,$/;" kind:member line:656 -__init__ ..\\pythonFiles\\autocomp\\misc.py /^ def __init__(self, interval, function, args=[], kwargs={}):$/;" kind:member line:1067 -__init__ ..\\pythonFiles\\autocomp\\misc.py /^ def __init__(self, lock=None, verbose=None):$/;" kind:member line:260 -__init__ ..\\pythonFiles\\autocomp\\misc.py /^ def __init__(self, value=1, verbose=None):$/;" kind:member line:433 -__init__ ..\\pythonFiles\\autocomp\\misc.py /^ def __init__(self, value=1, verbose=None):$/;" kind:member line:521 -__init__ ..\\pythonFiles\\autocomp\\misc.py /^ def __init__(self, verbose=None):$/;" kind:member line:132 -__init__ ..\\pythonFiles\\autocomp\\misc.py /^ def __init__(self, verbose=None):$/;" kind:member line:561 -__init__ ..\\pythonFiles\\autocomp\\misc.py /^ def __init__(self, x=None):$/;" kind:member line:1347 -__init__ ..\\pythonFiles\\autocomp\\one.py /^ def __init__(self, file_path=None, file_contents=None):$/;" kind:member line:14 -__init__ ..\\pythonFiles\\definition\\await.test.py /^ def __init__(self):$/;" kind:member line:4 -__init__ ..\\pythonFiles\\definition\\one.py /^ def __init__(self, file_path=None, file_contents=None):$/;" kind:member line:14 -__init__ ..\\pythonFiles\\formatting\\fileToFormat.py /^ def __init__ ( self, bar ):$/;" kind:member line:13 -__init__ ..\\pythonFiles\\jupyter\\cells.py /^ def __init__(self, mean=0.0, std=1, size=1000):$/;" kind:member line:104 -__init__ ..\\pythonFiles\\linting\\file.py /^ def __init__(self):$/;" kind:member line:8 -__init__ ..\\pythonFiles\\linting\\flake8config\\file.py /^ def __init__(self):$/;" kind:member line:8 -__init__ ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def __init__(self):$/;" kind:member line:8 -__init__ ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def __init__(self):$/;" kind:member line:8 -__init__ ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def __init__(self):$/;" kind:member line:8 -__init__ ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def __init__(self):$/;" kind:member line:164 -__init__ ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def __init__(self, filePath, fileMode=ChangeType.EDIT, diff=""):$/;" kind:member line:48 -__init__ ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def __init__(self, name='Task Name', message=None, percent=0):$/;" kind:member line:26 -__init__ ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def __init__(self, project, resource, name="Extract Method", progressCallback=None, startOff/;" kind:member line:146 -__init__ ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def __init__(self, project, resource, name="Extract Variable", progressCallback=None, startO/;" kind:member line:122 -__init__ ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def __init__(self, project, resource, name="Refactor", progressCallback=None):$/;" kind:member line:59 -__init__ ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def __init__(self, project, resource, name="Rename", progressCallback=None, startOffset=None/;" kind:member line:103 -__init__ ..\\pythonFiles\\symbolFiles\\childFile.py /^ def __init__(self):$/;" kind:member line:8 -__init__ ..\\pythonFiles\\symbolFiles\\file.py /^ def __init__(self):$/;" kind:member line:8 -__init__ ..\\pythonFiles\\symbolFiles\\workspace2File.py /^ def __init__(self):$/;" kind:member line:8 -__init__.py ..\\pythonFiles\\autoimport\\two\\__init__.py 1;" kind:file line:1 -__initialized ..\\pythonFiles\\autocomp\\misc.py /^ __initialized = False$/;" kind:variable line:646 -__reduce__ ..\\pythonFiles\\autocomp\\misc.py /^ def __reduce__(self):$/;" kind:member line:1428 -__repr__ ..\\pythonFiles\\autocomp\\misc.py /^ def __repr__(self):$/;" kind:member line:138 -__repr__ ..\\pythonFiles\\autocomp\\misc.py /^ def __repr__(self):$/;" kind:member line:291 -__repr__ ..\\pythonFiles\\autocomp\\misc.py /^ def __repr__(self):$/;" kind:member line:713 -__revision__ ..\\multiRootWkspc\\disableLinters\\file.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ ..\\multiRootWkspc\\parent\\child\\file.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ ..\\multiRootWkspc\\workspace1\\file.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ ..\\multiRootWkspc\\workspace2\\file.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ ..\\multiRootWkspc\\workspace3\\file.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ ..\\pythonFiles\\linting\\file.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ ..\\pythonFiles\\linting\\flake8config\\file.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ ..\\pythonFiles\\linting\\pylintconfig\\file.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ ..\\pythonFiles\\symbolFiles\\childFile.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ ..\\pythonFiles\\symbolFiles\\file.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ ..\\pythonFiles\\symbolFiles\\workspace2File.py /^__revision__ = None$/;" kind:variable line:3 -__setstate__ ..\\pythonFiles\\autocomp\\misc.py /^ def __setstate__(self, state): # for pickle$/;" kind:member line:1425 -__stop ..\\pythonFiles\\autocomp\\misc.py /^ def __stop(self):$/;" kind:member line:866 -_acquire_restore ..\\pythonFiles\\autocomp\\misc.py /^ def _acquire_restore(self, count_owner):$/;" kind:member line:220 -_acquire_restore ..\\pythonFiles\\autocomp\\misc.py /^ def _acquire_restore(self, x):$/;" kind:member line:297 -_active ..\\pythonFiles\\autocomp\\misc.py /^_active = {} # maps thread id to Thread object$/;" kind:variable line:634 -_active_limbo_lock ..\\pythonFiles\\autocomp\\misc.py /^_active_limbo_lock = _allocate_lock()$/;" kind:variable line:633 -_after_fork ..\\pythonFiles\\autocomp\\misc.py /^def _after_fork():$/;" kind:function line:1211 -_allocate_lock ..\\pythonFiles\\autocomp\\misc.py /^_allocate_lock = thread.allocate_lock$/;" kind:variable line:36 -_block ..\\pythonFiles\\autocomp\\misc.py /^ def _block(self):$/;" kind:member line:705 -_count ..\\pythonFiles\\autocomp\\misc.py /^from itertools import count as _count$/;" kind:unknown line:14 -_counter ..\\pythonFiles\\autocomp\\misc.py /^_counter = _count().next$/;" kind:variable line:627 -_deque ..\\pythonFiles\\autocomp\\misc.py /^from collections import deque as _deque$/;" kind:unknown line:13 -_deserialize ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def _deserialize(self, request):$/;" kind:member line:204 -_enumerate ..\\pythonFiles\\autocomp\\misc.py /^def _enumerate():$/;" kind:function line:1179 -_exitfunc ..\\pythonFiles\\autocomp\\misc.py /^ def _exitfunc(self):$/;" kind:member line:1100 -_extractMethod ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def _extractMethod(self, filePath, start, end, newName):$/;" kind:member line:183 -_extractVariable ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def _extractVariable(self, filePath, start, end, newName):$/;" kind:member line:168 -_figure_data ..\\pythonFiles\\jupyter\\cells.py /^ def _figure_data(self, format):$/;" kind:member line:112 -_format_exc ..\\pythonFiles\\autocomp\\misc.py /^from traceback import format_exc as _format_exc$/;" kind:unknown line:16 -_get_ident ..\\pythonFiles\\autocomp\\misc.py /^_get_ident = thread.get_ident$/;" kind:variable line:37 -_is_owned ..\\pythonFiles\\autocomp\\misc.py /^ def _is_owned(self):$/;" kind:member line:238 -_is_owned ..\\pythonFiles\\autocomp\\misc.py /^ def _is_owned(self):$/;" kind:member line:300 -_limbo ..\\pythonFiles\\autocomp\\misc.py /^_limbo = {}$/;" kind:variable line:635 -_newname ..\\pythonFiles\\autocomp\\misc.py /^def _newname(template="Thread-%d"):$/;" kind:function line:629 -_note ..\\pythonFiles\\autocomp\\misc.py /^ def _note(self, *args):$/;" kind:member line:82 -_note ..\\pythonFiles\\autocomp\\misc.py /^ def _note(self, format, *args):$/;" kind:member line:64 -_pickSomeNonDaemonThread ..\\pythonFiles\\autocomp\\misc.py /^def _pickSomeNonDaemonThread():$/;" kind:function line:1113 -_process_request ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def _process_request(self, request):$/;" kind:member line:215 -_profile_hook ..\\pythonFiles\\autocomp\\misc.py /^_profile_hook = None$/;" kind:variable line:87 -_randbelow ..\\pythonFiles\\autocomp\\misc.py /^ def _randbelow(self, n, int=int, maxsize=1< int:$/;" kind:function line:6 -after.py ..\\pythonFiles\\sorting\\noconfig\\after.py 1;" kind:file line:1 -after.py ..\\pythonFiles\\sorting\\withconfig\\after.py 1;" kind:file line:1 -ask_ok ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py /^ def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):$/;" kind:member line:263 -ask_ok ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py /^def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):$/;" kind:function line:124 -ask_ok ..\\pythonFiles\\typeFormatFiles\\elseBlocks4.py /^ def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):$/;" kind:member line:263 -ask_ok ..\\pythonFiles\\typeFormatFiles\\elseBlocks4.py /^def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):$/;" kind:function line:124 -ask_ok ..\\pythonFiles\\typeFormatFiles\\elseBlocksTab.py /^ def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):$/;" kind:member line:263 -ask_ok ..\\pythonFiles\\typeFormatFiles\\elseBlocksTab.py /^def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):$/;" kind:function line:124 -await.test.py ..\\pythonFiles\\definition\\await.test.py 1;" kind:file line:1 -ax ..\\pythonFiles\\jupyter\\cells.py /^fig, ax = plt.subplots(subplot_kw=dict(axisbg='#EEEEEE'))$/;" kind:variable line:39 -b ..\\pythonFiles\\autocomp\\pep526.py /^ b: int = 0$/;" kind:variable line:18 -b ..\\pythonFiles\\typeFormatFiles\\elseBlocksFirstLine2.py /^ b = 3$/;" kind:variable line:3 -b ..\\pythonFiles\\typeFormatFiles\\elseBlocksFirstLine4.py /^ b = 3$/;" kind:variable line:3 -b ..\\pythonFiles\\typeFormatFiles\\elseBlocksFirstLineTab.py /^ b = 3$/;" kind:variable line:3 -bar ..\\pythonFiles\\autocomp\\four.py /^ def bar():$/;" kind:member line:11 -bar ..\\pythonFiles\\definition\\four.py /^ def bar():$/;" kind:member line:11 -before.1.py ..\\pythonFiles\\sorting\\withconfig\\before.1.py 1;" kind:file line:1 -before.py ..\\pythonFiles\\sorting\\noconfig\\before.py 1;" kind:file line:1 -before.py ..\\pythonFiles\\sorting\\withconfig\\before.py 1;" kind:file line:1 -betavariate ..\\pythonFiles\\autocomp\\misc.py /^ def betavariate(self, alpha, beta):$/;" kind:member line:1862 -calculate_cash_flows ..\\pythonFiles\\definition\\decorators.py /^def calculate_cash_flows(remaining_loan_term, remaining_io_term,$/;" kind:function line:20 -cancel ..\\pythonFiles\\autocomp\\misc.py /^ def cancel(self):$/;" kind:member line:1075 -cells.py ..\\pythonFiles\\jupyter\\cells.py 1;" kind:file line:1 -childFile.py ..\\pythonFiles\\symbolFiles\\childFile.py 1;" kind:file line:1 -choice ..\\pythonFiles\\autocomp\\misc.py /^ def choice(self, seq):$/;" kind:member line:1513 -clear ..\\pythonFiles\\autocomp\\misc.py /^ def clear(self):$/;" kind:member line:590 -content ..\\pythonFiles\\autocomp\\doc.py /^ content = line.upper()$/;" kind:variable line:6 -ct ..\\pythonFiles\\autocomp\\two.py /^class ct:$/;" kind:class line:1 -ct ..\\pythonFiles\\definition\\two.py /^class ct:$/;" kind:class line:1 -currentThread ..\\pythonFiles\\autocomp\\misc.py /^def currentThread():$/;" kind:function line:1152 -current_thread ..\\pythonFiles\\autocomp\\misc.py /^current_thread = currentThread$/;" kind:variable line:1165 -daemon ..\\pythonFiles\\autocomp\\misc.py /^ def daemon(self):$/;" kind:member line:1009 -daemon ..\\pythonFiles\\autocomp\\misc.py /^ def daemon(self, daemonic):$/;" kind:member line:1025 -deco.py ..\\pythonFiles\\autocomp\\deco.py 1;" kind:file line:1 -decorators.py ..\\pythonFiles\\definition\\decorators.py 1;" kind:file line:1 -description ..\\pythonFiles\\autocomp\\one.py /^ description = "Run isort on modules registered in setuptools"$/;" kind:variable line:11 -description ..\\pythonFiles\\definition\\one.py /^ description = "Run isort on modules registered in setuptools"$/;" kind:variable line:11 -df ..\\pythonFiles\\jupyter\\cells.py /^df = df.cumsum()$/;" kind:variable line:87 -df ..\\pythonFiles\\jupyter\\cells.py /^df = pd.DataFrame(np.random.randn(1000, 4), index=ts.index,$/;" kind:variable line:85 -divide ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py /^ def divide(x, y):$/;" kind:member line:329 -divide ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py /^def divide(x, y):$/;" kind:function line:190 -divide ..\\pythonFiles\\typeFormatFiles\\elseBlocks4.py /^ def divide(x, y):$/;" kind:member line:329 -divide ..\\pythonFiles\\typeFormatFiles\\elseBlocks4.py /^def divide(x, y):$/;" kind:function line:190 -divide ..\\pythonFiles\\typeFormatFiles\\elseBlocksTab.py /^ def divide(x, y):$/;" kind:member line:329 -divide ..\\pythonFiles\\typeFormatFiles\\elseBlocksTab.py /^def divide(x, y):$/;" kind:function line:190 -divide ..\\pythonFiles\\typeFormatFiles\\tryBlocks2.py /^def divide(x, y):$/;" kind:function line:188 -divide ..\\pythonFiles\\typeFormatFiles\\tryBlocks2.py /^def divide(x, y):$/;" kind:function line:199 -divide ..\\pythonFiles\\typeFormatFiles\\tryBlocks4.py /^def divide(x, y):$/;" kind:function line:188 -divide ..\\pythonFiles\\typeFormatFiles\\tryBlocks4.py /^def divide(x, y):$/;" kind:function line:199 -divide ..\\pythonFiles\\typeFormatFiles\\tryBlocksTab.py /^def divide(x, y):$/;" kind:function line:188 -divide ..\\pythonFiles\\typeFormatFiles\\tryBlocksTab.py /^def divide(x, y):$/;" kind:function line:199 -doc.py ..\\pythonFiles\\autocomp\\doc.py 1;" kind:file line:1 -dummy.py ..\\pythonFiles\\dummy.py 1;" kind:file line:1 -elseBlocks2.py ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py 1;" kind:file line:1 -elseBlocks4.py ..\\pythonFiles\\typeFormatFiles\\elseBlocks4.py 1;" kind:file line:1 -elseBlocksFirstLine2.py ..\\pythonFiles\\typeFormatFiles\\elseBlocksFirstLine2.py 1;" kind:file line:1 -elseBlocksFirstLine4.py ..\\pythonFiles\\typeFormatFiles\\elseBlocksFirstLine4.py 1;" kind:file line:1 -elseBlocksFirstLineTab.py ..\\pythonFiles\\typeFormatFiles\\elseBlocksFirstLineTab.py 1;" kind:file line:1 -elseBlocksTab.py ..\\pythonFiles\\typeFormatFiles\\elseBlocksTab.py 1;" kind:file line:1 -enumerate ..\\pythonFiles\\autocomp\\misc.py /^def enumerate():$/;" kind:function line:1183 -example1 ..\\pythonFiles\\formatting\\fileToFormat.py /^def example1():$/;" kind:function line:3 -example2 ..\\pythonFiles\\formatting\\fileToFormat.py /^def example2(): return {'has_key() is deprecated':True}.has_key({'f':2}.has_key(''));$/;" kind:function line:11 -expovariate ..\\pythonFiles\\autocomp\\misc.py /^ def expovariate(self, lambd):$/;" kind:member line:1670 -fig ..\\pythonFiles\\jupyter\\cells.py /^fig, ax = plt.subplots(subplot_kw=dict(axisbg='#EEEEEE'))$/;" kind:variable line:39 -file.py ..\\multiRootWkspc\\disableLinters\\file.py 1;" kind:file line:1 -file.py ..\\multiRootWkspc\\parent\\child\\file.py 1;" kind:file line:1 -file.py ..\\multiRootWkspc\\workspace1\\file.py 1;" kind:file line:1 -file.py ..\\multiRootWkspc\\workspace2\\file.py 1;" kind:file line:1 -file.py ..\\multiRootWkspc\\workspace3\\file.py 1;" kind:file line:1 -file.py ..\\pythonFiles\\linting\\file.py 1;" kind:file line:1 -file.py ..\\pythonFiles\\linting\\flake8config\\file.py 1;" kind:file line:1 -file.py ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py 1;" kind:file line:1 -file.py ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py 1;" kind:file line:1 -file.py ..\\pythonFiles\\linting\\pylintconfig\\file.py 1;" kind:file line:1 -file.py ..\\pythonFiles\\symbolFiles\\file.py 1;" kind:file line:1 -fileToFormat.py ..\\pythonFiles\\formatting\\fileToFormat.py 1;" kind:file line:1 -five.py ..\\pythonFiles\\autocomp\\five.py 1;" kind:file line:1 -five.py ..\\pythonFiles\\definition\\five.py 1;" kind:file line:1 -four.py ..\\pythonFiles\\autocomp\\four.py 1;" kind:file line:1 -four.py ..\\pythonFiles\\definition\\four.py 1;" kind:file line:1 -fun ..\\pythonFiles\\autocomp\\two.py /^ def fun():$/;" kind:member line:2 -fun ..\\pythonFiles\\definition\\two.py /^ def fun():$/;" kind:member line:2 -function1 ..\\pythonFiles\\definition\\one.py /^def function1():$/;" kind:function line:33 -function2 ..\\pythonFiles\\definition\\one.py /^def function2():$/;" kind:function line:37 -function3 ..\\pythonFiles\\definition\\one.py /^def function3():$/;" kind:function line:40 -function4 ..\\pythonFiles\\definition\\one.py /^def function4():$/;" kind:function line:43 -gammavariate ..\\pythonFiles\\autocomp\\misc.py /^ def gammavariate(self, alpha, beta):$/;" kind:member line:1737 -gauss ..\\pythonFiles\\autocomp\\misc.py /^ def gauss(self, mu, sigma):$/;" kind:member line:1809 -get ..\\pythonFiles\\autocomp\\misc.py /^ def get(self):$/;" kind:member line:1271 -getName ..\\pythonFiles\\autocomp\\misc.py /^ def getName(self):$/;" kind:member line:1038 -getstate ..\\pythonFiles\\autocomp\\misc.py /^ def getstate(self):$/;" kind:member line:1388 -greeting ..\\pythonFiles\\autocomp\\pep484.py /^def greeting(name: str) -> str:$/;" kind:function line:2 -hoverTest.py ..\\pythonFiles\\autocomp\\hoverTest.py 1;" kind:file line:1 -ident ..\\pythonFiles\\autocomp\\misc.py /^ def ident(self):$/;" kind:member line:984 -identity ..\\pythonFiles\\definition\\decorators.py /^def identity(ob):$/;" kind:function line:1 -imp.py ..\\pythonFiles\\autocomp\\imp.py 1;" kind:file line:1 -instant_print ..\\pythonFiles\\autocomp\\lamb.py /^instant_print = lambda x: [print(x), sys.stdout.flush(), sys.stderr.flush()]$/;" kind:function line:1 -isAlive ..\\pythonFiles\\autocomp\\misc.py /^ def isAlive(self):$/;" kind:member line:995 -isDaemon ..\\pythonFiles\\autocomp\\misc.py /^ def isDaemon(self):$/;" kind:member line:1032 -isSet ..\\pythonFiles\\autocomp\\misc.py /^ def isSet(self):$/;" kind:member line:570 -is_alive ..\\pythonFiles\\autocomp\\misc.py /^ is_alive = isAlive$/;" kind:variable line:1006 -is_set ..\\pythonFiles\\autocomp\\misc.py /^ is_set = isSet$/;" kind:variable line:574 -join ..\\pythonFiles\\autocomp\\misc.py /^ def join(self, timeout=None):$/;" kind:member line:1146 -join ..\\pythonFiles\\autocomp\\misc.py /^ def join(self, timeout=None):$/;" kind:member line:911 -lamb.py ..\\pythonFiles\\autocomp\\lamb.py 1;" kind:file line:1 -local ..\\pythonFiles\\autocomp\\misc.py /^ from thread import _local as local$/;" kind:unknown line:1206 -lognormvariate ..\\pythonFiles\\autocomp\\misc.py /^ def lognormvariate(self, mu, sigma):$/;" kind:member line:1658 -meth1 ..\\multiRootWkspc\\disableLinters\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth1 ..\\multiRootWkspc\\parent\\child\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth1 ..\\multiRootWkspc\\workspace1\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth1 ..\\multiRootWkspc\\workspace2\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth1 ..\\multiRootWkspc\\workspace3\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth1 ..\\pythonFiles\\linting\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth1 ..\\pythonFiles\\linting\\flake8config\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth1 ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth1 ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth1 ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth1 ..\\pythonFiles\\symbolFiles\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth1OfChild ..\\pythonFiles\\symbolFiles\\childFile.py /^ def meth1OfChild(self, arg):$/;" kind:member line:11 -meth1OfWorkspace2 ..\\pythonFiles\\symbolFiles\\workspace2File.py /^ def meth1OfWorkspace2(self, arg):$/;" kind:member line:11 -meth2 ..\\multiRootWkspc\\disableLinters\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth2 ..\\multiRootWkspc\\parent\\child\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth2 ..\\multiRootWkspc\\workspace1\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth2 ..\\multiRootWkspc\\workspace2\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth2 ..\\multiRootWkspc\\workspace3\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth2 ..\\pythonFiles\\linting\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth2 ..\\pythonFiles\\linting\\flake8config\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth2 ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth2 ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth2 ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth2 ..\\pythonFiles\\symbolFiles\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth3 ..\\multiRootWkspc\\disableLinters\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth3 ..\\multiRootWkspc\\parent\\child\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth3 ..\\multiRootWkspc\\workspace1\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth3 ..\\multiRootWkspc\\workspace2\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth3 ..\\multiRootWkspc\\workspace3\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth3 ..\\pythonFiles\\linting\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth3 ..\\pythonFiles\\linting\\flake8config\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth3 ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth3 ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth3 ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth3 ..\\pythonFiles\\symbolFiles\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth4 ..\\multiRootWkspc\\disableLinters\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth4 ..\\multiRootWkspc\\parent\\child\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth4 ..\\multiRootWkspc\\workspace1\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth4 ..\\multiRootWkspc\\workspace2\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth4 ..\\multiRootWkspc\\workspace3\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth4 ..\\pythonFiles\\linting\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth4 ..\\pythonFiles\\linting\\flake8config\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth4 ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth4 ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth4 ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth4 ..\\pythonFiles\\symbolFiles\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth5 ..\\multiRootWkspc\\disableLinters\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth5 ..\\multiRootWkspc\\parent\\child\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth5 ..\\multiRootWkspc\\workspace1\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth5 ..\\multiRootWkspc\\workspace2\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth5 ..\\multiRootWkspc\\workspace3\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth5 ..\\pythonFiles\\linting\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth5 ..\\pythonFiles\\linting\\flake8config\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth5 ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth5 ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth5 ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth5 ..\\pythonFiles\\symbolFiles\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth6 ..\\multiRootWkspc\\disableLinters\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth6 ..\\multiRootWkspc\\parent\\child\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth6 ..\\multiRootWkspc\\workspace1\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth6 ..\\multiRootWkspc\\workspace2\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth6 ..\\multiRootWkspc\\workspace3\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth6 ..\\pythonFiles\\linting\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth6 ..\\pythonFiles\\linting\\flake8config\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth6 ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth6 ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth6 ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth6 ..\\pythonFiles\\symbolFiles\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth7 ..\\multiRootWkspc\\disableLinters\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth7 ..\\multiRootWkspc\\parent\\child\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth7 ..\\multiRootWkspc\\workspace1\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth7 ..\\multiRootWkspc\\workspace2\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth7 ..\\multiRootWkspc\\workspace3\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth7 ..\\pythonFiles\\linting\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth7 ..\\pythonFiles\\linting\\flake8config\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth7 ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth7 ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth7 ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth7 ..\\pythonFiles\\symbolFiles\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth8 ..\\multiRootWkspc\\disableLinters\\file.py /^ def meth8(self):$/;" kind:member line:80 -meth8 ..\\multiRootWkspc\\parent\\child\\file.py /^ def meth8(self):$/;" kind:member line:80 -meth8 ..\\multiRootWkspc\\workspace1\\file.py /^ def meth8(self):$/;" kind:member line:80 -meth8 ..\\multiRootWkspc\\workspace2\\file.py /^ def meth8(self):$/;" kind:member line:80 -meth8 ..\\multiRootWkspc\\workspace3\\file.py /^ def meth8(self):$/;" kind:member line:80 -meth8 ..\\pythonFiles\\linting\\file.py /^ def meth8(self):$/;" kind:member line:80 -meth8 ..\\pythonFiles\\linting\\flake8config\\file.py /^ def meth8(self):$/;" kind:member line:80 -meth8 ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def meth8(self):$/;" kind:member line:80 -meth8 ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def meth8(self):$/;" kind:member line:80 -meth8 ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def meth8(self):$/;" kind:member line:80 -meth8 ..\\pythonFiles\\symbolFiles\\file.py /^ def meth8(self):$/;" kind:member line:80 -method1 ..\\pythonFiles\\autocomp\\one.py /^ def method1(self):$/;" kind:member line:18 -method1 ..\\pythonFiles\\definition\\one.py /^ def method1(self):$/;" kind:member line:18 -method2 ..\\pythonFiles\\autocomp\\one.py /^ def method2(self):$/;" kind:member line:24 -method2 ..\\pythonFiles\\definition\\one.py /^ def method2(self):$/;" kind:member line:24 -minus ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py /^ def minus():$/;" kind:member line:287 -minus ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py /^def minus():$/;" kind:function line:148 -minus ..\\pythonFiles\\typeFormatFiles\\elseBlocks4.py /^ def minus():$/;" kind:member line:287 -minus ..\\pythonFiles\\typeFormatFiles\\elseBlocks4.py /^def minus():$/;" kind:function line:148 -minus ..\\pythonFiles\\typeFormatFiles\\elseBlocksTab.py /^ def minus():$/;" kind:member line:287 -minus ..\\pythonFiles\\typeFormatFiles\\elseBlocksTab.py /^def minus():$/;" kind:function line:148 -minus ..\\pythonFiles\\typeFormatFiles\\tryBlocks2.py /^def minus():$/;" kind:function line:100 -minus ..\\pythonFiles\\typeFormatFiles\\tryBlocks2.py /^def minus():$/;" kind:function line:91 -minus ..\\pythonFiles\\typeFormatFiles\\tryBlocks4.py /^def minus():$/;" kind:function line:100 -minus ..\\pythonFiles\\typeFormatFiles\\tryBlocks4.py /^def minus():$/;" kind:function line:91 -minus ..\\pythonFiles\\typeFormatFiles\\tryBlocksTab.py /^def minus():$/;" kind:function line:100 -minus ..\\pythonFiles\\typeFormatFiles\\tryBlocksTab.py /^def minus():$/;" kind:function line:91 -misc.py ..\\pythonFiles\\autocomp\\misc.py 1;" kind:file line:1 -mpl ..\\pythonFiles\\jupyter\\cells.py /^import matplotlib as mpl$/;" kind:namespace line:4 -mpl ..\\pythonFiles\\jupyter\\cells.py /^import matplotlib as mpl$/;" kind:namespace line:94 -myfunc ..\\pythonFiles\\definition\\decorators.py /^def myfunc():$/;" kind:function line:5 -name ..\\pythonFiles\\autocomp\\misc.py /^ def name(self):$/;" kind:member line:968 -name ..\\pythonFiles\\autocomp\\misc.py /^ def name(self, name):$/;" kind:member line:979 -non_parametrized_username ..\\pythonFiles\\testFiles\\standard\\tests\\test_another_pytest.py /^def non_parametrized_username(request):$/;" kind:function line:10 -non_parametrized_username ..\\pythonFiles\\testFiles\\standard\\tests\\test_pytest.py /^def non_parametrized_username(request):$/;" kind:function line:33 -non_parametrized_username ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_pytest.py /^def non_parametrized_username(request):$/;" kind:function line:33 -non_parametrized_username ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_another_pytest.py /^def non_parametrized_username(request):$/;" kind:function line:10 -non_parametrized_username ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_pytest.py /^def non_parametrized_username(request):$/;" kind:function line:33 -normalvariate ..\\pythonFiles\\autocomp\\misc.py /^ def normalvariate(self, mu, sigma):$/;" kind:member line:1633 -notify ..\\pythonFiles\\autocomp\\misc.py /^ def notify(self, n=1):$/;" kind:member line:373 -notifyAll ..\\pythonFiles\\autocomp\\misc.py /^ def notifyAll(self):$/;" kind:member line:400 -notify_all ..\\pythonFiles\\autocomp\\misc.py /^ notify_all = notifyAll$/;" kind:variable line:409 -np ..\\pythonFiles\\jupyter\\cells.py /^import numpy as np$/;" kind:namespace line:34 -np ..\\pythonFiles\\jupyter\\cells.py /^import numpy as np$/;" kind:namespace line:5 -np ..\\pythonFiles\\jupyter\\cells.py /^import numpy as np$/;" kind:namespace line:63 -np ..\\pythonFiles\\jupyter\\cells.py /^import numpy as np$/;" kind:namespace line:78 -np ..\\pythonFiles\\jupyter\\cells.py /^import numpy as np$/;" kind:namespace line:97 -obj ..\\pythonFiles\\autocomp\\one.py /^obj = Class1()$/;" kind:variable line:30 -obj ..\\pythonFiles\\definition\\one.py /^obj = Class1()$/;" kind:variable line:30 -onRefactor ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def onRefactor(self):$/;" kind:member line:109 -onRefactor ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def onRefactor(self):$/;" kind:member line:131 -onRefactor ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def onRefactor(self):$/;" kind:member line:149 -onRefactor ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def onRefactor(self):$/;" kind:member line:94 -one ..\\pythonFiles\\typeFormatFiles\\tryBlocks2.py /^def one():$/;" kind:function line:134 -one ..\\pythonFiles\\typeFormatFiles\\tryBlocks2.py /^def one():$/;" kind:function line:150 -one ..\\pythonFiles\\typeFormatFiles\\tryBlocks4.py /^def one():$/;" kind:function line:134 -one ..\\pythonFiles\\typeFormatFiles\\tryBlocks4.py /^def one():$/;" kind:function line:150 -one ..\\pythonFiles\\typeFormatFiles\\tryBlocksTab.py /^def one():$/;" kind:function line:134 -one ..\\pythonFiles\\typeFormatFiles\\tryBlocksTab.py /^def one():$/;" kind:function line:150 -one.py ..\\pythonFiles\\autocomp\\one.py 1;" kind:file line:1 -one.py ..\\pythonFiles\\autoimport\\one.py 1;" kind:file line:1 -one.py ..\\pythonFiles\\definition\\one.py 1;" kind:file line:1 -one.py ..\\pythonFiles\\docstrings\\one.py 1;" kind:file line:1 -original.1.py ..\\pythonFiles\\sorting\\withconfig\\original.1.py 1;" kind:file line:1 -original.py ..\\pythonFiles\\sorting\\noconfig\\original.py 1;" kind:file line:1 -original.py ..\\pythonFiles\\sorting\\withconfig\\original.py 1;" kind:file line:1 -p1 ..\\pythonFiles\\jupyter\\cells.py /^p1 = figure(title="Legend Example", tools=TOOLS)$/;" kind:variable line:70 -parametrized_username ..\\pythonFiles\\testFiles\\standard\\tests\\test_another_pytest.py /^def parametrized_username():$/;" kind:function line:6 -parametrized_username ..\\pythonFiles\\testFiles\\standard\\tests\\test_pytest.py /^def parametrized_username():$/;" kind:function line:29 -parametrized_username ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_pytest.py /^def parametrized_username():$/;" kind:function line:29 -parametrized_username ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_another_pytest.py /^def parametrized_username():$/;" kind:function line:6 -parametrized_username ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_pytest.py /^def parametrized_username():$/;" kind:function line:29 -paretovariate ..\\pythonFiles\\autocomp\\misc.py /^ def paretovariate(self, alpha):$/;" kind:member line:1880 -pd ..\\pythonFiles\\jupyter\\cells.py /^import pandas as pd$/;" kind:namespace line:77 -pep484.py ..\\pythonFiles\\autocomp\\pep484.py 1;" kind:file line:1 -pep526.py ..\\pythonFiles\\autocomp\\pep526.py 1;" kind:file line:1 -plain.py ..\\pythonFiles\\shebang\\plain.py 1;" kind:file line:1 -plt ..\\pythonFiles\\jupyter\\cells.py /^from matplotlib import pyplot as plt$/;" kind:unknown line:80 -plt ..\\pythonFiles\\jupyter\\cells.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:3 -plt ..\\pythonFiles\\jupyter\\cells.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:33 -plt ..\\pythonFiles\\jupyter\\cells.py /^import matplotlib.pyplot as plt$/;" kind:namespace line:93 -print_hello ..\\pythonFiles\\hover\\stringFormat.py /^def print_hello(name):$/;" kind:function line:2 -put ..\\pythonFiles\\autocomp\\misc.py /^ def put(self, item):$/;" kind:member line:1260 -randint ..\\pythonFiles\\autocomp\\misc.py /^ def randint(self, a, b):$/;" kind:member line:1477 -randrange ..\\pythonFiles\\autocomp\\misc.py /^ def randrange(self, start, stop=None, step=1, _int=int):$/;" kind:member line:1433 -refactor ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def refactor(self):$/;" kind:member line:87 -refactor.py ..\\pythonFiles\\refactoring\\standAlone\\refactor.py 1;" kind:file line:1 -release ..\\pythonFiles\\autocomp\\misc.py /^ def release(self):$/;" kind:member line:187 -release ..\\pythonFiles\\autocomp\\misc.py /^ def release(self):$/;" kind:member line:479 -release ..\\pythonFiles\\autocomp\\misc.py /^ def release(self):$/;" kind:member line:525 -rnd ..\\pythonFiles\\autocomp\\hoverTest.py /^rnd = random.Random()$/;" kind:variable line:7 -rnd2 ..\\pythonFiles\\autocomp\\hoverTest.py /^rnd2 = misc.Random()$/;" kind:variable line:12 -run ..\\pythonFiles\\autocomp\\misc.py /^ def run(self):$/;" kind:member line:1289 -run ..\\pythonFiles\\autocomp\\misc.py /^ def run(self):$/;" kind:member line:1305 -run ..\\pythonFiles\\autocomp\\misc.py /^ def run(self):$/;" kind:member line:1079 -run ..\\pythonFiles\\autocomp\\misc.py /^ def run(self):$/;" kind:member line:752 -sample ..\\pythonFiles\\autocomp\\misc.py /^ def sample(self, population, k):$/;" kind:member line:1543 -scatter ..\\pythonFiles\\jupyter\\cells.py /^scatter = ax.scatter(np.random.normal(size=N),$/;" kind:variable line:43 -seed ..\\pythonFiles\\autocomp\\misc.py /^ def seed(self, a=None, version=2):$/;" kind:member line:1356 -set ..\\pythonFiles\\autocomp\\misc.py /^ def set(self):$/;" kind:member line:576 -setDaemon ..\\pythonFiles\\autocomp\\misc.py /^ def setDaemon(self, daemonic):$/;" kind:member line:1035 -setName ..\\pythonFiles\\autocomp\\misc.py /^ def setName(self, name):$/;" kind:member line:1041 -setprofile ..\\pythonFiles\\autocomp\\misc.py /^def setprofile(func):$/;" kind:function line:90 -setstate ..\\pythonFiles\\autocomp\\misc.py /^ def setstate(self, state):$/;" kind:member line:1392 -settrace ..\\pythonFiles\\autocomp\\misc.py /^def settrace(func):$/;" kind:function line:100 -shebang.py ..\\pythonFiles\\shebang\\shebang.py 1;" kind:file line:1 -shebangEnv.py ..\\pythonFiles\\shebang\\shebangEnv.py 1;" kind:file line:1 -shebangInvalid.py ..\\pythonFiles\\shebang\\shebangInvalid.py 1;" kind:file line:1 -showMessage ..\\pythonFiles\\autocomp\\four.py /^def showMessage():$/;" kind:function line:19 -showMessage ..\\pythonFiles\\definition\\four.py /^def showMessage():$/;" kind:function line:19 -shuffle ..\\pythonFiles\\autocomp\\misc.py /^ def shuffle(self, x, random=None):$/;" kind:member line:1521 -start ..\\pythonFiles\\autocomp\\misc.py /^ def start(self):$/;" kind:member line:726 -stop ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def stop(self):$/;" kind:member line:84 -stringFormat.py ..\\pythonFiles\\hover\\stringFormat.py 1;" kind:file line:1 -t ..\\pythonFiles\\autocomp\\hoverTest.py /^t = misc.Thread()$/;" kind:variable line:15 -test ..\\pythonFiles\\definition\\await.test.py /^ async def test(self):$/;" kind:member line:7 -test ..\\pythonFiles\\sorting\\noconfig\\after.py /^def test():$/;" kind:function line:15 -test ..\\pythonFiles\\sorting\\noconfig\\before.py /^def test():$/;" kind:function line:12 -test ..\\pythonFiles\\sorting\\noconfig\\original.py /^def test():$/;" kind:function line:12 -test ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py /^ def test():$/;" kind:member line:201 -test ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py /^def test():$/;" kind:function line:62 -test ..\\pythonFiles\\typeFormatFiles\\elseBlocks4.py /^ def test():$/;" kind:member line:201 -test ..\\pythonFiles\\typeFormatFiles\\elseBlocks4.py /^def test():$/;" kind:function line:62 -test ..\\pythonFiles\\typeFormatFiles\\elseBlocksTab.py /^ def test():$/;" kind:member line:201 -test ..\\pythonFiles\\typeFormatFiles\\elseBlocksTab.py /^def test():$/;" kind:function line:62 -test2 ..\\pythonFiles\\definition\\await.test.py /^ async def test2(self):$/;" kind:member line:10 -test_1_1_1 ..\\pythonFiles\\testFiles\\specificTest\\tests\\test_unittest_one.py /^ def test_1_1_1(self):$/;" kind:member line:4 -test_1_1_1 ..\\pythonFiles\\testFiles\\specificTest\\tests\\test_unittest_two.py /^ def test_1_1_1(self):$/;" kind:member line:4 -test_1_1_2 ..\\pythonFiles\\testFiles\\specificTest\\tests\\test_unittest_one.py /^ def test_1_1_2(self):$/;" kind:member line:7 -test_1_1_2 ..\\pythonFiles\\testFiles\\specificTest\\tests\\test_unittest_two.py /^ def test_1_1_2(self):$/;" kind:member line:7 -test_1_1_3 ..\\pythonFiles\\testFiles\\specificTest\\tests\\test_unittest_one.py /^ def test_1_1_3(self):$/;" kind:member line:11 -test_1_1_3 ..\\pythonFiles\\testFiles\\specificTest\\tests\\test_unittest_two.py /^ def test_1_1_3(self):$/;" kind:member line:11 -test_1_2_1 ..\\pythonFiles\\testFiles\\specificTest\\tests\\test_unittest_one.py /^ def test_1_2_1(self):$/;" kind:member line:15 -test_222A2 ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_two.py /^ def test_222A2(self):$/;" kind:member line:18 -test_222A2 ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_two.py /^ def test_222A2(self):$/;" kind:member line:18 -test_222A2wow ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_two.py /^ def test_222A2wow(self):$/;" kind:member line:25 -test_222A2wow ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_two.py /^ def test_222A2wow(self):$/;" kind:member line:25 -test_222B2 ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_two.py /^ def test_222B2(self):$/;" kind:member line:21 -test_222B2 ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_two.py /^ def test_222B2(self):$/;" kind:member line:21 -test_222B2wow ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_two.py /^ def test_222B2wow(self):$/;" kind:member line:28 -test_222B2wow ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_two.py /^ def test_222B2wow(self):$/;" kind:member line:28 -test_2_1_1 ..\\pythonFiles\\testFiles\\specificTest\\tests\\test_unittest_two.py /^ def test_2_1_1(self):$/;" kind:member line:15 -test_A ..\\pythonFiles\\testFiles\\single\\tests\\test_one.py /^ def test_A(self):$/;" kind:member line:7 -test_A ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_one.py /^ def test_A(self):$/;" kind:member line:7 -test_A ..\\pythonFiles\\testFiles\\standard\\tests\\unittest_three_test.py /^ def test_A(self):$/;" kind:member line:5 -test_A ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_unittest_one.py /^ def test_A(self):$/;" kind:member line:7 -test_A ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_one.py /^ def test_A(self):$/;" kind:member line:7 -test_A ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\unittest_three_test.py /^ def test_A(self):$/;" kind:member line:5 -test_A2 ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_two.py /^ def test_A2(self):$/;" kind:member line:4 -test_A2 ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_two.py /^ def test_A2(self):$/;" kind:member line:4 -test_B ..\\pythonFiles\\testFiles\\single\\tests\\test_one.py /^ def test_B(self):$/;" kind:member line:10 -test_B ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_one.py /^ def test_B(self):$/;" kind:member line:10 -test_B ..\\pythonFiles\\testFiles\\standard\\tests\\unittest_three_test.py /^ def test_B(self):$/;" kind:member line:8 -test_B ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_unittest_one.py /^ def test_B(self):$/;" kind:member line:10 -test_B ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_one.py /^ def test_B(self):$/;" kind:member line:10 -test_B ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\unittest_three_test.py /^ def test_B(self):$/;" kind:member line:8 -test_B2 ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_two.py /^ def test_B2(self):$/;" kind:member line:7 -test_B2 ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_two.py /^ def test_B2(self):$/;" kind:member line:7 -test_C2 ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_two.py /^ def test_C2(self):$/;" kind:member line:10 -test_C2 ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_two.py /^ def test_C2(self):$/;" kind:member line:10 -test_D2 ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_two.py /^ def test_D2(self):$/;" kind:member line:13 -test_D2 ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_two.py /^ def test_D2(self):$/;" kind:member line:13 -test_Root_A ..\\pythonFiles\\testFiles\\single\\test_root.py /^ def test_Root_A(self):$/;" kind:member line:7 -test_Root_A ..\\pythonFiles\\testFiles\\standard\\test_root.py /^ def test_Root_A(self):$/;" kind:member line:7 -test_Root_A ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\test_root.py /^ def test_Root_A(self):$/;" kind:member line:7 -test_Root_B ..\\pythonFiles\\testFiles\\single\\test_root.py /^ def test_Root_B(self):$/;" kind:member line:10 -test_Root_B ..\\pythonFiles\\testFiles\\standard\\test_root.py /^ def test_Root_B(self):$/;" kind:member line:10 -test_Root_B ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\test_root.py /^ def test_Root_B(self):$/;" kind:member line:10 -test_Root_c ..\\pythonFiles\\testFiles\\single\\test_root.py /^ def test_Root_c(self):$/;" kind:member line:14 -test_Root_c ..\\pythonFiles\\testFiles\\standard\\test_root.py /^ def test_Root_c(self):$/;" kind:member line:14 -test_Root_c ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\test_root.py /^ def test_Root_c(self):$/;" kind:member line:14 -test_another_pytest.py ..\\pythonFiles\\testFiles\\standard\\tests\\test_another_pytest.py 1;" kind:file line:1 -test_another_pytest.py ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_another_pytest.py 1;" kind:file line:1 -test_c ..\\pythonFiles\\testFiles\\single\\tests\\test_one.py /^ def test_c(self):$/;" kind:member line:14 -test_c ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_one.py /^ def test_c(self):$/;" kind:member line:14 -test_c ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_unittest_one.py /^ def test_c(self):$/;" kind:member line:14 -test_c ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_one.py /^ def test_c(self):$/;" kind:member line:14 -test_complex_check ..\\pythonFiles\\testFiles\\standard\\tests\\test_pytest.py /^ def test_complex_check(self):$/;" kind:member line:10 -test_complex_check ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_pytest.py /^ def test_complex_check(self):$/;" kind:member line:10 -test_complex_check ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_pytest.py /^ def test_complex_check(self):$/;" kind:member line:10 -test_complex_check2 ..\\pythonFiles\\testFiles\\standard\\tests\\test_pytest.py /^ def test_complex_check2(self):$/;" kind:member line:24 -test_complex_check2 ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_pytest.py /^ def test_complex_check2(self):$/;" kind:member line:24 -test_complex_check2 ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_pytest.py /^ def test_complex_check2(self):$/;" kind:member line:24 -test_cwd ..\\pythonFiles\\testFiles\\cwd\\src\\tests\\test_cwd.py /^ def test_cwd(self):$/;" kind:member line:7 -test_cwd.py ..\\pythonFiles\\testFiles\\cwd\\src\\tests\\test_cwd.py 1;" kind:file line:1 -test_d ..\\pythonFiles\\testFiles\\standard\\tests\\test_pytest.py /^ def test_d(self):$/;" kind:member line:17 -test_d ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_pytest.py /^ def test_d(self):$/;" kind:member line:17 -test_d ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_pytest.py /^ def test_d(self):$/;" kind:member line:17 -test_nested_class_methodB ..\\pythonFiles\\testFiles\\standard\\tests\\test_pytest.py /^ def test_nested_class_methodB(self):$/;" kind:member line:14 -test_nested_class_methodB ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_pytest.py /^ def test_nested_class_methodB(self):$/;" kind:member line:14 -test_nested_class_methodB ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_pytest.py /^ def test_nested_class_methodB(self):$/;" kind:member line:14 -test_nested_class_methodC ..\\pythonFiles\\testFiles\\standard\\tests\\test_pytest.py /^ def test_nested_class_methodC(self):$/;" kind:member line:19 -test_nested_class_methodC ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_pytest.py /^ def test_nested_class_methodC(self):$/;" kind:member line:19 -test_nested_class_methodC ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_pytest.py /^ def test_nested_class_methodC(self):$/;" kind:member line:19 -test_one.py ..\\pythonFiles\\testFiles\\single\\tests\\test_one.py 1;" kind:file line:1 -test_parametrized_username ..\\pythonFiles\\testFiles\\standard\\tests\\test_another_pytest.py /^def test_parametrized_username(non_parametrized_username):$/;" kind:function line:16 -test_parametrized_username ..\\pythonFiles\\testFiles\\standard\\tests\\test_pytest.py /^def test_parametrized_username(non_parametrized_username):$/;" kind:function line:39 -test_parametrized_username ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_pytest.py /^def test_parametrized_username(non_parametrized_username):$/;" kind:function line:39 -test_parametrized_username ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_another_pytest.py /^def test_parametrized_username(non_parametrized_username):$/;" kind:function line:16 -test_parametrized_username ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_pytest.py /^def test_parametrized_username(non_parametrized_username):$/;" kind:function line:39 -test_pytest.py ..\\pythonFiles\\testFiles\\standard\\tests\\test_pytest.py 1;" kind:file line:1 -test_pytest.py ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_pytest.py 1;" kind:file line:1 -test_pytest.py ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_pytest.py 1;" kind:file line:1 -test_root.py ..\\pythonFiles\\testFiles\\single\\test_root.py 1;" kind:file line:1 -test_root.py ..\\pythonFiles\\testFiles\\standard\\test_root.py 1;" kind:file line:1 -test_root.py ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\test_root.py 1;" kind:file line:1 -test_simple_check ..\\pythonFiles\\testFiles\\standard\\tests\\test_pytest.py /^ def test_simple_check(self):$/;" kind:member line:8 -test_simple_check ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_pytest.py /^ def test_simple_check(self):$/;" kind:member line:8 -test_simple_check ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_pytest.py /^ def test_simple_check(self):$/;" kind:member line:8 -test_simple_check2 ..\\pythonFiles\\testFiles\\standard\\tests\\test_pytest.py /^ def test_simple_check2(self):$/;" kind:member line:22 -test_simple_check2 ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_pytest.py /^ def test_simple_check2(self):$/;" kind:member line:22 -test_simple_check2 ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_pytest.py /^ def test_simple_check2(self):$/;" kind:member line:22 -test_unittest_one.py ..\\pythonFiles\\testFiles\\specificTest\\tests\\test_unittest_one.py 1;" kind:file line:1 -test_unittest_one.py ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_one.py 1;" kind:file line:1 -test_unittest_one.py ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_unittest_one.py 1;" kind:file line:1 -test_unittest_one.py ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_one.py 1;" kind:file line:1 -test_unittest_two.py ..\\pythonFiles\\testFiles\\specificTest\\tests\\test_unittest_two.py 1;" kind:file line:1 -test_unittest_two.py ..\\pythonFiles\\testFiles\\standard\\tests\\test_unittest_two.py 1;" kind:file line:1 -test_unittest_two.py ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_unittest_two.py 1;" kind:file line:1 -test_username ..\\pythonFiles\\testFiles\\standard\\tests\\test_another_pytest.py /^def test_username(parametrized_username):$/;" kind:function line:13 -test_username ..\\pythonFiles\\testFiles\\standard\\tests\\test_pytest.py /^def test_username(parametrized_username):$/;" kind:function line:36 -test_username ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\other\\test_pytest.py /^def test_username(parametrized_username):$/;" kind:function line:36 -test_username ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_another_pytest.py /^def test_username(parametrized_username):$/;" kind:function line:13 -test_username ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\test_pytest.py /^def test_username(parametrized_username):$/;" kind:function line:36 -testthis ..\\pythonFiles\\definition\\await.test.py /^async def testthis():$/;" kind:function line:13 -three.py ..\\pythonFiles\\autocomp\\three.py 1;" kind:file line:1 -three.py ..\\pythonFiles\\autoimport\\two\\three.py 1;" kind:file line:1 -three.py ..\\pythonFiles\\definition\\three.py 1;" kind:file line:1 -triangular ..\\pythonFiles\\autocomp\\misc.py /^ def triangular(self, low=0.0, high=1.0, mode=None):$/;" kind:member line:1611 -tryBlocks2.py ..\\pythonFiles\\typeFormatFiles\\tryBlocks2.py 1;" kind:file line:1 -tryBlocks4.py ..\\pythonFiles\\typeFormatFiles\\tryBlocks4.py 1;" kind:file line:1 -tryBlocksTab.py ..\\pythonFiles\\typeFormatFiles\\tryBlocksTab.py 1;" kind:file line:1 -ts ..\\pythonFiles\\jupyter\\cells.py /^ts = pd.Series(np.random.randn(1000),$/;" kind:variable line:82 -ts ..\\pythonFiles\\jupyter\\cells.py /^ts = ts.cumsum()$/;" kind:variable line:84 -two ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py /^ def two():$/;" kind:member line:308 -two ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py /^def two():$/;" kind:function line:169 -two ..\\pythonFiles\\typeFormatFiles\\elseBlocks4.py /^ def two():$/;" kind:member line:308 -two ..\\pythonFiles\\typeFormatFiles\\elseBlocks4.py /^def two():$/;" kind:function line:169 -two ..\\pythonFiles\\typeFormatFiles\\elseBlocksTab.py /^ def two():$/;" kind:member line:308 -two ..\\pythonFiles\\typeFormatFiles\\elseBlocksTab.py /^def two():$/;" kind:function line:169 -two ..\\pythonFiles\\typeFormatFiles\\tryBlocks2.py /^def two():$/;" kind:function line:166 -two ..\\pythonFiles\\typeFormatFiles\\tryBlocks2.py /^def two():$/;" kind:function line:177 -two ..\\pythonFiles\\typeFormatFiles\\tryBlocks4.py /^def two():$/;" kind:function line:166 -two ..\\pythonFiles\\typeFormatFiles\\tryBlocks4.py /^def two():$/;" kind:function line:177 -two ..\\pythonFiles\\typeFormatFiles\\tryBlocksTab.py /^def two():$/;" kind:function line:166 -two ..\\pythonFiles\\typeFormatFiles\\tryBlocksTab.py /^def two():$/;" kind:function line:177 -two.py ..\\pythonFiles\\autocomp\\two.py 1;" kind:file line:1 -two.py ..\\pythonFiles\\definition\\two.py 1;" kind:file line:1 -uniform ..\\pythonFiles\\autocomp\\misc.py /^ def uniform(self, a, b):$/;" kind:member line:1605 -unittest_three_test.py ..\\pythonFiles\\testFiles\\standard\\tests\\unittest_three_test.py 1;" kind:file line:1 -unittest_three_test.py ..\\pythonFiles\\testFiles\\unittestsWithConfigs\\tests\\unittest_three_test.py 1;" kind:file line:1 -user_options ..\\pythonFiles\\autocomp\\one.py /^ user_options = []$/;" kind:variable line:12 -user_options ..\\pythonFiles\\definition\\one.py /^ user_options = []$/;" kind:variable line:12 -var ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py /^var = 100$/;" kind:variable line:1 -var ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py /^var = 100$/;" kind:variable line:15 -var ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py /^var = 100$/;" kind:variable line:29 -var ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py /^var = 100$/;" kind:variable line:339 -var ..\\pythonFiles\\typeFormatFiles\\elseBlocks2.py /^var = 100$/;" kind:variable line:353 -var ..\\pythonFiles\\typeFormatFiles\\elseBlocks4.py /^ var = 100$/;" kind:variable line:339 -var ..\\pythonFiles\\typeFormatFiles\\elseBlocks4.py /^var = 100$/;" kind:variable line:1 -var ..\\pythonFiles\\typeFormatFiles\\elseBlocks4.py /^var = 100$/;" kind:variable line:15 -var ..\\pythonFiles\\typeFormatFiles\\elseBlocks4.py /^var = 100$/;" kind:variable line:29 -var ..\\pythonFiles\\typeFormatFiles\\elseBlocksTab.py /^ var = 100$/;" kind:variable line:339 -var ..\\pythonFiles\\typeFormatFiles\\elseBlocksTab.py /^var = 100$/;" kind:variable line:1 -var ..\\pythonFiles\\typeFormatFiles\\elseBlocksTab.py /^var = 100$/;" kind:variable line:15 -var ..\\pythonFiles\\typeFormatFiles\\elseBlocksTab.py /^var = 100$/;" kind:variable line:29 -vonmisesvariate ..\\pythonFiles\\autocomp\\misc.py /^ def vonmisesvariate(self, mu, kappa):$/;" kind:member line:1689 -wait ..\\pythonFiles\\autocomp\\misc.py /^ def wait(self, timeout=None):$/;" kind:member line:309 -wait ..\\pythonFiles\\autocomp\\misc.py /^ def wait(self, timeout=None):$/;" kind:member line:603 -watch ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def watch(self):$/;" kind:member line:234 -weibullvariate ..\\pythonFiles\\autocomp\\misc.py /^ def weibullvariate(self, alpha, beta):$/;" kind:member line:1889 -workspace2File.py ..\\pythonFiles\\symbolFiles\\workspace2File.py 1;" kind:file line:1 -x ..\\pythonFiles\\jupyter\\cells.py /^x = Gaussian(2.0, 1.0)$/;" kind:variable line:131 -x ..\\pythonFiles\\jupyter\\cells.py /^x = np.linspace(0, 20, 100)$/;" kind:variable line:7 -x ..\\pythonFiles\\jupyter\\cells.py /^x = np.linspace(0, 4 * np.pi, 100)$/;" kind:variable line:65 -y ..\\pythonFiles\\jupyter\\cells.py /^y = np.sin(x)$/;" kind:variable line:66 -zero ..\\pythonFiles\\typeFormatFiles\\tryBlocks2.py /^def zero():$/;" kind:function line:110 -zero ..\\pythonFiles\\typeFormatFiles\\tryBlocks2.py /^def zero():$/;" kind:function line:122 -zero ..\\pythonFiles\\typeFormatFiles\\tryBlocks4.py /^def zero():$/;" kind:function line:110 -zero ..\\pythonFiles\\typeFormatFiles\\tryBlocks4.py /^def zero():$/;" kind:function line:122 -zero ..\\pythonFiles\\typeFormatFiles\\tryBlocksTab.py /^def zero():$/;" kind:function line:110 -zero ..\\pythonFiles\\typeFormatFiles\\tryBlocksTab.py /^def zero():$/;" kind:function line:122 diff --git a/src/test/common/configSettings.test.ts b/src/test/common/configSettings.test.ts index b104ff2fd1e1..6125d343f2c4 100644 --- a/src/test/common/configSettings.test.ts +++ b/src/test/common/configSettings.test.ts @@ -2,7 +2,6 @@ import * as assert from 'assert'; import * as path from 'path'; import * as vscode from 'vscode'; import { IS_WINDOWS } from '../../client/common/platform/constants'; -import { IWorkspaceSymbolSettings } from '../../client/common/types'; import { SystemVariables } from '../../client/common/variables/systemVariables'; import { getExtensionSettings } from '../common'; import { initialize } from './../initialize'; @@ -34,24 +33,6 @@ suite('Configuration Settings', () => { pythonSettingValue.toUpperCase(), `Setting ${key} not the same`, ); - } else if (key === 'workspaceSymbols' && IS_WINDOWS) { - const workspaceSettings = (pythonSettingValue as {}) as IWorkspaceSymbolSettings; - const workspaceSttings = (settingValue as {}) as IWorkspaceSymbolSettings; - assert.equal( - workspaceSettings.tagFilePath.toUpperCase(), - workspaceSttings.tagFilePath.toUpperCase(), - `Setting ${key} not the same`, - ); - - const workspaceSettingsWithoutPath = { ...workspaceSettings }; - workspaceSettingsWithoutPath.tagFilePath = ''; - const pythonSettingValueWithoutPath = { ...((pythonSettingValue as {}) as IWorkspaceSymbolSettings) }; - pythonSettingValueWithoutPath.tagFilePath = ''; - assert.deepEqual( - workspaceSettingsWithoutPath, - pythonSettingValueWithoutPath, - `Setting ${key} not the same`, - ); } }); diff --git a/src/test/common/configSettings/configSettings.unit.test.ts b/src/test/common/configSettings/configSettings.unit.test.ts index 20fe922fc90b..d4a463244c45 100644 --- a/src/test/common/configSettings/configSettings.unit.test.ts +++ b/src/test/common/configSettings/configSettings.unit.test.ts @@ -21,7 +21,6 @@ import { ILoggingSettings, ISortImportSettings, ITerminalSettings, - IWorkspaceSymbolSettings, } from '../../../client/common/types'; import { noop } from '../../../client/common/utils/misc'; import * as EnvFileTelemetry from '../../../client/telemetry/envFileTelemetry'; @@ -107,9 +106,6 @@ suite('Python Settings', async () => { config.setup((c) => c.get('sortImports')).returns(() => sourceSettings.sortImports); config.setup((c) => c.get('formatting')).returns(() => sourceSettings.formatting); config.setup((c) => c.get('autoComplete')).returns(() => sourceSettings.autoComplete); - config - .setup((c) => c.get('workspaceSymbols')) - .returns(() => sourceSettings.workspaceSymbols); config.setup((c) => c.get('testing')).returns(() => sourceSettings.testing); config.setup((c) => c.get('terminal')).returns(() => sourceSettings.terminal); config.setup((c) => c.get('experiments')).returns(() => sourceSettings.experiments); diff --git a/src/test/common/installer.test.ts b/src/test/common/installer.test.ts index c8f46a1aca4c..fda23dc0ed6f 100644 --- a/src/test/common/installer.test.ts +++ b/src/test/common/installer.test.ts @@ -45,7 +45,6 @@ import { import { InstallationChannelManager } from '../../client/common/installer/channelManager'; import { ProductInstaller } from '../../client/common/installer/productInstaller'; import { - CTagsProductPathService, FormatterProductPathService, LinterProductPathService, RefactoringLibraryProductPathService, @@ -176,11 +175,6 @@ suite('Installer', () => { ioc.registerMockProcessTypes(); ioc.serviceManager.addSingletonInstance(IsWindows, false); ioc.serviceManager.addSingletonInstance(IProductService, new ProductService()); - ioc.serviceManager.addSingleton( - IProductPathService, - CTagsProductPathService, - ProductType.WorkspaceSymbols, - ); ioc.serviceManager.addSingleton( IProductPathService, FormatterProductPathService, @@ -325,7 +319,7 @@ suite('Installer', () => { new MockModuleInstaller('two', true), ); ioc.serviceManager.addSingletonInstance(ITerminalHelper, instance(mock(TerminalHelper))); - if (prod.value === Product.ctags || prod.value === Product.unittest || prod.value === Product.isort) { + if (prod.value === Product.unittest || prod.value === Product.isort) { return undefined; } await testCheckingIfProductIsInstalled(prod.value); @@ -363,7 +357,7 @@ suite('Installer', () => { new MockModuleInstaller('two', true), ); ioc.serviceManager.addSingletonInstance(ITerminalHelper, instance(mock(TerminalHelper))); - if (prod.value === Product.unittest || prod.value === Product.ctags || prod.value === Product.isort) { + if (prod.value === Product.unittest || prod.value === Product.isort) { return undefined; } await testInstallingProduct(prod.value); diff --git a/src/test/common/installer/installer.invalidPath.unit.test.ts b/src/test/common/installer/installer.invalidPath.unit.test.ts index bcafbd69be50..29566fa936b1 100644 --- a/src/test/common/installer/installer.invalidPath.unit.test.ts +++ b/src/test/common/installer/installer.invalidPath.unit.test.ts @@ -80,7 +80,6 @@ suite('Module Installer - Invalid Paths', () => { switch (product.value) { case Product.isort: - case Product.ctags: case Product.rope: case Product.unittest: { return; diff --git a/src/test/common/installer/installer.unit.test.ts b/src/test/common/installer/installer.unit.test.ts index 3610f467b51e..4ebac0bed867 100644 --- a/src/test/common/installer/installer.unit.test.ts +++ b/src/test/common/installer/installer.unit.test.ts @@ -17,15 +17,7 @@ import { ConfigurationService } from '../../../client/common/configuration/servi import { Commands } from '../../../client/common/constants'; import { ExperimentService } from '../../../client/common/experiments/service'; import '../../../client/common/extensions'; -import { - CTagsInstallationScript, - CTagsInstaller, - FormatterInstaller, - LinterInstaller, - ProductInstaller, -} from '../../../client/common/installer/productInstaller'; -import { ProductNames } from '../../../client/common/installer/productNames'; -import { LinterProductPathService } from '../../../client/common/installer/productPath'; +import { FormatterInstaller, ProductInstaller } from '../../../client/common/installer/productInstaller'; import { ProductService } from '../../../client/common/installer/productService'; import { IInstallationChannelManager, @@ -33,7 +25,6 @@ import { IProductPathService, IProductService, } from '../../../client/common/installer/types'; -import { IPlatformService } from '../../../client/common/platform/types'; import { ExecutionResult, IProcessService, @@ -41,7 +32,6 @@ import { IPythonExecutionFactory, IPythonExecutionService, } from '../../../client/common/process/types'; -import { ITerminalService, ITerminalServiceFactory } from '../../../client/common/terminal/types'; import { IConfigurationService, IDisposableRegistry, @@ -193,114 +183,6 @@ suite('Module Installer only', () => { case Product.isort: { return; } - case Product.ctags: { - test(`If platform is Windows, for module installer ${product.name} (${ - resource ? 'With a resource' : 'without a resource' - }), print the instructions to install Ctags into the output channel`, async () => { - const platformService = TypeMoq.Mock.ofType(); - serviceContainer - .setup((c) => c.get(TypeMoq.It.isValue(IPlatformService))) - .returns(() => platformService.object); - platformService.setup((p) => p.isWindows).returns(() => true); - outputChannel.setup((o) => o.appendLine(TypeMoq.It.isAny())).returns(() => undefined); - outputChannel - .setup((o) => - o.appendLine( - 'Install Universal Ctags Win32 to enable support for Workspace Symbols', - ), - ) - .returns(() => undefined) - .verifiable(TypeMoq.Times.once()); - outputChannel - .setup((o) => o.show()) - .returns(() => undefined) - .verifiable(TypeMoq.Times.once()); - const response = await installer.install(product.value, resource); - expect(response).to.be.equal(InstallerResponse.Ignore); - outputChannel.verifyAll(); - }); - test(`If platform is not Windows, for module installer ${product.name} (${ - resource ? 'With a resource' : 'without a resource' - }), install Ctags using the corresponding script`, async () => { - const platformService = TypeMoq.Mock.ofType(); - serviceContainer - .setup((c) => c.get(TypeMoq.It.isValue(IPlatformService))) - .returns(() => platformService.object); - platformService.setup((p) => p.isWindows).returns(() => false); - const terminalService = TypeMoq.Mock.ofType(); - const terminalServiceFactory = TypeMoq.Mock.ofType(); - serviceContainer - .setup((c) => c.get(TypeMoq.It.isValue(ITerminalServiceFactory))) - .returns(() => terminalServiceFactory.object); - terminalServiceFactory - .setup((p) => p.getTerminalService({ resource })) - .returns(() => terminalService.object); - terminalService - .setup((t) => t.sendCommand(CTagsInstallationScript, [])) - .returns(() => Promise.resolve()) - .verifiable(TypeMoq.Times.once()); - const response = await installer.install(product.value, resource); - expect(response).to.be.equal(InstallerResponse.Ignore); - terminalService.verifyAll(); - }); - test(`If platform is not Windows, for module installer ${product.name} (${ - resource ? 'With a resource' : 'without a resource' - }), but installing Ctags fails with Error, log error and return`, async () => { - const platformService = TypeMoq.Mock.ofType(); - serviceContainer - .setup((c) => c.get(TypeMoq.It.isValue(IPlatformService))) - .returns(() => platformService.object); - platformService.setup((p) => p.isWindows).returns(() => false); - const terminalService = TypeMoq.Mock.ofType(); - const terminalServiceFactory = TypeMoq.Mock.ofType(); - serviceContainer - .setup((c) => c.get(TypeMoq.It.isValue(ITerminalServiceFactory))) - .returns(() => terminalServiceFactory.object); - terminalServiceFactory - .setup((p) => p.getTerminalService({ resource })) - .returns(() => terminalService.object); - terminalService - .setup((t) => t.sendCommand(CTagsInstallationScript, [])) - .returns(() => Promise.reject(new Error('Kaboom'))) - .verifiable(TypeMoq.Times.once()); - const response = await installer.install(product.value, resource); - expect(response).to.be.equal(InstallerResponse.Ignore); - terminalService.verifyAll(); - }); - test(`If 'Yes' is selected on the install prompt for the the module installer ${ - product.name - } (${ - resource ? 'With a resource' : 'without a resource' - }), install module and return response`, async () => { - app.setup((a) => - a.showErrorMessage(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), - ) - .returns(() => Promise.resolve('Yes')) - .verifiable(TypeMoq.Times.once()); - const install = sinon.stub(CTagsInstaller.prototype, 'install'); - install.resolves(InstallerResponse.Installed); - const response = await installer.promptToInstall(product.value, resource); - expect(response).to.be.equal(InstallerResponse.Installed); - app.verifyAll(); - assert.ok(install.calledOnceWith(product.value, resource)); - }); - test(`If 'No' is selected on the install prompt for the module installer ${product.name} (${ - resource ? 'With a resource' : 'without a resource' - }), return ignore response`, async () => { - app.setup((a) => - a.showErrorMessage(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), - ) - .returns(() => Promise.resolve('No')) - .verifiable(TypeMoq.Times.once()); - const install = sinon.stub(CTagsInstaller.prototype, 'install'); - install.resolves(InstallerResponse.Installed); - const response = await installer.promptToInstall(product.value, resource); - expect(response).to.be.equal(InstallerResponse.Ignore); - app.verifyAll(); - assert.ok(install.notCalled); - }); - return; - } case Product.unittest: { test(`Ensure resource info is passed into the module installer ${product.name} (${ resource ? 'With a resource' : 'without a resource' diff --git a/src/test/common/installer/productPath.unit.test.ts b/src/test/common/installer/productPath.unit.test.ts index a01fd5a40c0f..b86d9ea52e29 100644 --- a/src/test/common/installer/productPath.unit.test.ts +++ b/src/test/common/installer/productPath.unit.test.ts @@ -12,7 +12,6 @@ import '../../../client/common/extensions'; import { ProductInstaller } from '../../../client/common/installer/productInstaller'; import { BaseProductPathsService, - CTagsProductPathService, FormatterProductPathService, LinterProductPathService, RefactoringLibraryProductPathService, @@ -25,7 +24,6 @@ import { IFormattingSettings, IInstaller, IPythonSettings, - IWorkspaceSymbolSettings, Product, ProductType, } from '../../../client/common/types'; @@ -49,7 +47,6 @@ suite('Product Path', () => { let serviceContainer: TypeMoq.IMock; let formattingSettings: TypeMoq.IMock; let unitTestSettings: TypeMoq.IMock; - let workspaceSymnbolSettings: TypeMoq.IMock; let configService: TypeMoq.IMock; let productInstaller: ProductInstaller; setup(function () { @@ -60,7 +57,6 @@ suite('Product Path', () => { configService = TypeMoq.Mock.ofType(); formattingSettings = TypeMoq.Mock.ofType(); unitTestSettings = TypeMoq.Mock.ofType(); - workspaceSymnbolSettings = TypeMoq.Mock.ofType(); productInstaller = new ProductInstaller( serviceContainer.object, @@ -69,7 +65,6 @@ suite('Product Path', () => { const pythonSettings = TypeMoq.Mock.ofType(); pythonSettings.setup((p) => p.formatting).returns(() => formattingSettings.object); pythonSettings.setup((p) => p.testing).returns(() => unitTestSettings.object); - pythonSettings.setup((p) => p.workspaceSymbols).returns(() => workspaceSymnbolSettings.object); configService .setup((s) => s.getSettings(TypeMoq.It.isValue(resource))) .returns(() => pythonSettings.object); @@ -79,7 +74,6 @@ suite('Product Path', () => { serviceContainer .setup((s) => s.get(TypeMoq.It.isValue(IInstaller), TypeMoq.It.isAny())) .returns(() => productInstaller); - serviceContainer .setup((c) => c.get(TypeMoq.It.isValue(IProductService), TypeMoq.It.isAny())) .returns(() => new ProductService()); @@ -182,23 +176,6 @@ suite('Product Path', () => { }); break; } - case ProductType.WorkspaceSymbols: { - test(`Ensure path is returned for ${product.name} (${ - resource ? 'With a resource' : 'without a resource' - })`, async () => { - const productPathService = new CTagsProductPathService(serviceContainer.object); - const expectedPath = 'Some Path'; - workspaceSymnbolSettings - .setup((w) => w.ctagsPath) - .returns(() => expectedPath) - .verifiable(TypeMoq.Times.atLeastOnce()); - - const value = productPathService.getExecutableNameFromSettings(product.value, resource); - expect(value).to.be.equal(expectedPath); - workspaceSymnbolSettings.verifyAll(); - }); - break; - } case ProductType.TestFramework: { test(`Ensure path is returned for ${product.name} (${ resource ? 'With a resource' : 'without a resource' diff --git a/src/test/common/installer/serviceRegistry.unit.test.ts b/src/test/common/installer/serviceRegistry.unit.test.ts index 2cc02576e290..de4d117238e6 100644 --- a/src/test/common/installer/serviceRegistry.unit.test.ts +++ b/src/test/common/installer/serviceRegistry.unit.test.ts @@ -13,7 +13,6 @@ import { PipEnvInstaller } from '../../../client/common/installer/pipEnvInstalle import { PipInstaller } from '../../../client/common/installer/pipInstaller'; import { PoetryInstaller } from '../../../client/common/installer/poetryInstaller'; import { - CTagsProductPathService, FormatterProductPathService, LinterProductPathService, RefactoringLibraryProductPathService, @@ -69,13 +68,6 @@ suite('Common installer Service Registry', () => { ).once(); verify(serviceManager.addSingleton(IProductService, ProductService)).once(); - verify( - serviceManager.addSingleton( - IProductPathService, - CTagsProductPathService, - ProductType.WorkspaceSymbols, - ), - ).once(); verify( serviceManager.addSingleton( IProductPathService, diff --git a/src/test/linters/lint.multiroot.test.ts b/src/test/linters/lint.multiroot.test.ts index 0c088d4c28cb..771fbf8d0528 100644 --- a/src/test/linters/lint.multiroot.test.ts +++ b/src/test/linters/lint.multiroot.test.ts @@ -4,7 +4,6 @@ import { CancellationTokenSource, ConfigurationTarget, OutputChannel, Uri, works import { LanguageServerType } from '../../client/activation/types'; import { PythonSettings } from '../../client/common/configSettings'; import { - CTagsProductPathService, FormatterProductPathService, LinterProductPathService, RefactoringLibraryProductPathService, @@ -53,11 +52,6 @@ suite('Multiroot Linting', () => { await ioc.registerMockInterpreterTypes(); ioc.registerInterpreterStorageTypes(); ioc.serviceManager.addSingletonInstance(IProductService, new ProductService()); - ioc.serviceManager.addSingleton( - IProductPathService, - CTagsProductPathService, - ProductType.WorkspaceSymbols, - ); ioc.serviceManager.addSingleton( IProductPathService, FormatterProductPathService, diff --git a/src/test/linters/lint.test.ts b/src/test/linters/lint.test.ts index 40ec41bdb5c9..5e12e8b94f69 100644 --- a/src/test/linters/lint.test.ts +++ b/src/test/linters/lint.test.ts @@ -8,7 +8,6 @@ import { ConfigurationTarget, Uri } from 'vscode'; import { WorkspaceService } from '../../client/common/application/workspace'; import { Product } from '../../client/common/installer/productInstaller'; import { - CTagsProductPathService, FormatterProductPathService, LinterProductPathService, RefactoringLibraryProductPathService, @@ -61,11 +60,6 @@ suite('Linting Settings', () => { linterManager = new LinterManager(ioc.serviceContainer, new WorkspaceService()); configService = ioc.serviceContainer.get(IConfigurationService); ioc.serviceManager.addSingletonInstance(IProductService, new ProductService()); - ioc.serviceManager.addSingleton( - IProductPathService, - CTagsProductPathService, - ProductType.WorkspaceSymbols, - ); ioc.serviceManager.addSingleton( IProductPathService, FormatterProductPathService, diff --git a/src/test/linters/linterManager.unit.test.ts b/src/test/linters/linterManager.unit.test.ts index 85409edd05d7..d2d9babb8187 100644 --- a/src/test/linters/linterManager.unit.test.ts +++ b/src/test/linters/linterManager.unit.test.ts @@ -138,7 +138,7 @@ suite('Linting - Linter Manager', () => { return []; }; - await linterManager.setActiveLintersAsync([Product.ctags, Product.pytest], resource); + await linterManager.setActiveLintersAsync([Product.pytest], resource); expect(getActiveLintersInvoked).to.be.equal(false, 'Should not be invoked'); }); diff --git a/src/test/multiRootWkspc/disableLinters/.vscode/tags b/src/test/multiRootWkspc/disableLinters/.vscode/tags deleted file mode 100644 index 4739b4629cfb..000000000000 --- a/src/test/multiRootWkspc/disableLinters/.vscode/tags +++ /dev/null @@ -1,19 +0,0 @@ -!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ -!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ -!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ -!_TAG_PROGRAM_AUTHOR Universal Ctags Team // -!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ -!_TAG_PROGRAM_URL https://ctags.io/ /official site/ -!_TAG_PROGRAM_VERSION 0.0.0 /f9e6e3c1/ -Foo ..\\file.py /^class Foo(object):$/;" kind:class line:5 -__init__ ..\\file.py /^ def __init__(self):$/;" kind:member line:8 -__revision__ ..\\file.py /^__revision__ = None$/;" kind:variable line:3 -file.py ..\\file.py 1;" kind:file line:1 -meth1 ..\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth2 ..\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth3 ..\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth4 ..\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth5 ..\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth6 ..\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth7 ..\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth8 ..\\file.py /^ def meth8(self):$/;" kind:member line:80 diff --git a/src/test/multiRootWkspc/parent/child/.vscode/tags b/src/test/multiRootWkspc/parent/child/.vscode/tags deleted file mode 100644 index e6791c755b0f..000000000000 --- a/src/test/multiRootWkspc/parent/child/.vscode/tags +++ /dev/null @@ -1,24 +0,0 @@ -!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ -!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ -!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ -!_TAG_PROGRAM_AUTHOR Universal Ctags Team // -!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ -!_TAG_PROGRAM_URL https://ctags.io/ /official site/ -!_TAG_PROGRAM_VERSION 0.0.0 /f9e6e3c1/ -Child2Class ..\\childFile.py /^class Child2Class(object):$/;" kind:class line:5 -Foo ..\\file.py /^class Foo(object):$/;" kind:class line:5 -__init__ ..\\childFile.py /^ def __init__(self):$/;" kind:member line:8 -__init__ ..\\file.py /^ def __init__(self):$/;" kind:member line:8 -__revision__ ..\\childFile.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ ..\\file.py /^__revision__ = None$/;" kind:variable line:3 -childFile.py ..\\childFile.py 1;" kind:file line:1 -file.py ..\\file.py 1;" kind:file line:1 -meth1 ..\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth1OfChild ..\\childFile.py /^ def meth1OfChild(self, arg):$/;" kind:member line:11 -meth2 ..\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth3 ..\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth4 ..\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth5 ..\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth6 ..\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth7 ..\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth8 ..\\file.py /^ def meth8(self):$/;" kind:member line:80 diff --git a/src/test/multiRootWkspc/workspace1/.vscode/tags b/src/test/multiRootWkspc/workspace1/.vscode/tags deleted file mode 100644 index 4739b4629cfb..000000000000 --- a/src/test/multiRootWkspc/workspace1/.vscode/tags +++ /dev/null @@ -1,19 +0,0 @@ -!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ -!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ -!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ -!_TAG_PROGRAM_AUTHOR Universal Ctags Team // -!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ -!_TAG_PROGRAM_URL https://ctags.io/ /official site/ -!_TAG_PROGRAM_VERSION 0.0.0 /f9e6e3c1/ -Foo ..\\file.py /^class Foo(object):$/;" kind:class line:5 -__init__ ..\\file.py /^ def __init__(self):$/;" kind:member line:8 -__revision__ ..\\file.py /^__revision__ = None$/;" kind:variable line:3 -file.py ..\\file.py 1;" kind:file line:1 -meth1 ..\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth2 ..\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth3 ..\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth4 ..\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth5 ..\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth6 ..\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth7 ..\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth8 ..\\file.py /^ def meth8(self):$/;" kind:member line:80 diff --git a/src/test/multiRootWkspc/workspace2/workspace2.tags.file b/src/test/multiRootWkspc/workspace2/workspace2.tags.file deleted file mode 100644 index 2d54e7ed7c7b..000000000000 --- a/src/test/multiRootWkspc/workspace2/workspace2.tags.file +++ /dev/null @@ -1,24 +0,0 @@ -!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ -!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ -!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ -!_TAG_PROGRAM_AUTHOR Universal Ctags Team // -!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ -!_TAG_PROGRAM_URL https://ctags.io/ /official site/ -!_TAG_PROGRAM_VERSION 0.0.0 /f9e6e3c1/ -Foo C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\file.py /^class Foo(object):$/;" kind:class line:5 -Workspace2Class C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\workspace2File.py /^class Workspace2Class(object):$/;" kind:class line:5 -__init__ C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\file.py /^ def __init__(self):$/;" kind:member line:8 -__init__ C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\workspace2File.py /^ def __init__(self):$/;" kind:member line:8 -__revision__ C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\file.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\workspace2File.py /^__revision__ = None$/;" kind:variable line:3 -file.py C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\file.py 1;" kind:file line:1 -meth1 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth1OfWorkspace2 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\workspace2File.py /^ def meth1OfWorkspace2(self, arg):$/;" kind:member line:11 -meth2 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth3 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth4 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth5 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth6 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth7 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth8 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\file.py /^ def meth8(self):$/;" kind:member line:80 -workspace2File.py C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace2\\workspace2File.py 1;" kind:file line:1 diff --git a/src/test/multiRootWkspc/workspace3/workspace3.tags.file b/src/test/multiRootWkspc/workspace3/workspace3.tags.file deleted file mode 100644 index 9a141392d6ae..000000000000 --- a/src/test/multiRootWkspc/workspace3/workspace3.tags.file +++ /dev/null @@ -1,19 +0,0 @@ -!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ -!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ -!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ -!_TAG_PROGRAM_AUTHOR Universal Ctags Team // -!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ -!_TAG_PROGRAM_URL https://ctags.io/ /official site/ -!_TAG_PROGRAM_VERSION 0.0.0 /f9e6e3c1/ -Foo C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace3\\file.py /^class Foo(object):$/;" kind:class line:5 -__init__ C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace3\\file.py /^ def __init__(self):$/;" kind:member line:8 -__revision__ C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace3\\file.py /^__revision__ = None$/;" kind:variable line:3 -file.py C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace3\\file.py 1;" kind:file line:1 -meth1 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace3\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth2 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace3\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth3 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace3\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth4 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace3\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth5 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace3\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth6 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace3\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth7 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace3\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth8 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\test\\multiRootWkspc\\workspace3\\file.py /^ def meth8(self):$/;" kind:member line:80 diff --git a/src/test/workspaceSymbols/common.ts b/src/test/workspaceSymbols/common.ts deleted file mode 100644 index 765c586cc4da..000000000000 --- a/src/test/workspaceSymbols/common.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ConfigurationTarget, Uri, workspace } from 'vscode'; -import { PythonSettings } from '../../client/common/configSettings'; - -export async function enableDisableWorkspaceSymbols( - resource: Uri, - enabled: boolean, - configTarget: ConfigurationTarget, -) { - const settings = workspace.getConfiguration('python', resource); - await settings.update('workspaceSymbols.enabled', enabled, configTarget); - PythonSettings.dispose(); -} diff --git a/src/test/workspaceSymbols/generator.unit.test.ts b/src/test/workspaceSymbols/generator.unit.test.ts deleted file mode 100644 index fdd8785836d3..000000000000 --- a/src/test/workspaceSymbols/generator.unit.test.ts +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -'use strict'; - -import { expect, use } from 'chai'; -import * as chaiAsPromised from 'chai-as-promised'; -import * as path from 'path'; -import { anything, instance, mock, verify, when } from 'ts-mockito'; -import * as typemoq from 'typemoq'; -import { Uri } from 'vscode'; -import { ApplicationShell } from '../../client/common/application/applicationShell'; -import { IApplicationShell } from '../../client/common/application/types'; -import { ConfigurationService } from '../../client/common/configuration/service'; -import { FileSystem } from '../../client/common/platform/fileSystem'; -import { IFileSystem } from '../../client/common/platform/types'; -import { ProcessService } from '../../client/common/process/proc'; -import { IProcessService, IProcessServiceFactory, Output } from '../../client/common/process/types'; -import { IConfigurationService, IOutputChannel, IPythonSettings } from '../../client/common/types'; -import { Generator } from '../../client/workspaceSymbols/generator'; -use(chaiAsPromised); - -suite('Workspace Symbols Generator', () => { - let configurationService: IConfigurationService; - let pythonSettings: typemoq.IMock; - let generator: Generator; - let factory: typemoq.IMock; - let shell: IApplicationShell; - let processService: IProcessService; - let fs: IFileSystem; - const folderUri = Uri.parse(path.join('a', 'b', 'c')); - setup(() => { - pythonSettings = typemoq.Mock.ofType(); - configurationService = mock(ConfigurationService); - factory = typemoq.Mock.ofType(); - shell = mock(ApplicationShell); - fs = mock(FileSystem); - processService = mock(ProcessService); - factory.setup((f) => f.create(typemoq.It.isAny())).returns(() => Promise.resolve(instance(processService))); - when(configurationService.getSettings(anything())).thenReturn(pythonSettings.object); - const outputChannel = typemoq.Mock.ofType(); - generator = new Generator( - folderUri, - outputChannel.object, - instance(shell), - instance(fs), - factory.object, - instance(configurationService), - ); - }); - test('should be disabled', () => { - const workspaceSymbols = { enabled: false } as any; - pythonSettings.setup((p) => p.workspaceSymbols).returns(() => workspaceSymbols); - - expect(generator.enabled).to.be.equal(false, 'not disabled'); - }); - test('should be enabled', () => { - const workspaceSymbols = { enabled: true } as any; - pythonSettings.setup((p) => p.workspaceSymbols).returns(() => workspaceSymbols); - - expect(generator.enabled).to.be.equal(true, 'not enabled'); - }); - test('Check tagFilePath', () => { - const workspaceSymbols = { tagFilePath: '1234' } as any; - pythonSettings.setup((p) => p.workspaceSymbols).returns(() => workspaceSymbols); - - expect(generator.tagFilePath).to.be.equal('1234'); - }); - test('Throw error when generating tags', async () => { - const ctagsPath = 'CTAG_PATH'; - const workspaceSymbols = { - enabled: true, - tagFilePath: '1234', - exclusionPatterns: [], - ctagsPath, - } as any; - pythonSettings.setup((p) => p.workspaceSymbols).returns(() => workspaceSymbols); - when(fs.directoryExists(anything())).thenResolve(true); - const observable = { - out: { - subscribe: (cb: (out: Output) => void, _errorCb: any, done: Function) => { - cb({ source: 'stderr', out: 'KABOOM' }); - done(); - }, - }, - }; - when(processService.execObservable(ctagsPath, anything(), anything())).thenReturn(observable as any); - - const promise = generator.generateWorkspaceTags(); - await expect(promise).to.eventually.be.rejectedWith('KABOOM'); - verify(shell.setStatusBarMessage(anything(), anything())).once(); - }); - test('Does not throw error when generating tags', async () => { - const ctagsPath = 'CTAG_PATH'; - const workspaceSymbols = { - enabled: true, - tagFilePath: '1234', - exclusionPatterns: [], - ctagsPath, - } as any; - pythonSettings.setup((p) => p.workspaceSymbols).returns(() => workspaceSymbols); - when(fs.directoryExists(anything())).thenResolve(true); - const observable = { - out: { - subscribe: (cb: (out: Output) => void, _errorCb: any, done: Function) => { - cb({ source: 'stdout', out: '' }); - done(); - }, - }, - }; - when(processService.execObservable(ctagsPath, anything(), anything())).thenReturn(observable as any); - - await generator.generateWorkspaceTags(); - verify(shell.setStatusBarMessage(anything(), anything())).once(); - }); -}); diff --git a/src/test/workspaceSymbols/main.unit.test.ts b/src/test/workspaceSymbols/main.unit.test.ts deleted file mode 100644 index d6113658aa39..000000000000 --- a/src/test/workspaceSymbols/main.unit.test.ts +++ /dev/null @@ -1,224 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -'use strict'; - -import * as assert from 'assert'; -import { expect, use } from 'chai'; -import * as chaiAsPromised from 'chai-as-promised'; -import { anyString, anything, instance, mock, reset, verify, when } from 'ts-mockito'; -import { EventEmitter, TextDocument, Uri, WorkspaceFolder } from 'vscode'; -import { ApplicationShell } from '../../client/common/application/applicationShell'; -import { CommandManager } from '../../client/common/application/commandManager'; -import { DocumentManager } from '../../client/common/application/documentManager'; -import { - IApplicationShell, - ICommandManager, - IDocumentManager, - IWorkspaceService, -} from '../../client/common/application/types'; -import { WorkspaceService } from '../../client/common/application/workspace'; -import { ConfigurationService } from '../../client/common/configuration/service'; -import { Commands, STANDARD_OUTPUT_CHANNEL } from '../../client/common/constants'; -import { FileSystem } from '../../client/common/platform/fileSystem'; -import { IFileSystem } from '../../client/common/platform/types'; -import { ProcessService } from '../../client/common/process/proc'; -import { ProcessServiceFactory } from '../../client/common/process/processFactory'; -import { IProcessService, IProcessServiceFactory, Output } from '../../client/common/process/types'; -import { IConfigurationService, IOutputChannel } from '../../client/common/types'; -import { sleep } from '../../client/common/utils/async'; -import { ServiceContainer } from '../../client/ioc/container'; -import { IServiceContainer } from '../../client/ioc/types'; -import { WorkspaceSymbols } from '../../client/workspaceSymbols/main'; -import { MockOutputChannel } from '../mockClasses'; - -use(chaiAsPromised); - -suite('Workspace symbols main', () => { - const mockDisposable = { - dispose: () => { - return; - }, - }; - const ctagsPath = 'CTAG_PATH'; - const observable = { - out: { - subscribe: (cb: (out: Output) => void, _errorCb: any, done: Function) => { - cb({ source: 'stdout', out: '' }); - done(); - }, - }, - }; - - let outputChannel: IOutputChannel; - let commandManager: ICommandManager; - let fileSystem: IFileSystem; - let workspaceService: IWorkspaceService; - let processServiceFactory: IProcessServiceFactory; - let processService: IProcessService; - let applicationShell: IApplicationShell; - let configurationService: IConfigurationService; - let documentManager: IDocumentManager; - let serviceContainer: IServiceContainer; - let workspaceFolders: WorkspaceFolder[]; - let workspaceSymbols: WorkspaceSymbols; - let shellOutput: string; - let eventEmitter: EventEmitter; - - setup(() => { - eventEmitter = new EventEmitter(); - shellOutput = ''; - workspaceFolders = [{ name: 'root', index: 0, uri: Uri.file('folder') }]; - - outputChannel = mock(MockOutputChannel); - commandManager = mock(CommandManager); - fileSystem = mock(FileSystem); - workspaceService = mock(WorkspaceService); - processServiceFactory = mock(ProcessServiceFactory); - processService = mock(ProcessService); - applicationShell = mock(ApplicationShell); - configurationService = mock(ConfigurationService); - documentManager = mock(DocumentManager); - serviceContainer = mock(ServiceContainer); - - when(workspaceService.onDidChangeWorkspaceFolders).thenReturn(() => mockDisposable as any); - when(documentManager.onDidSaveTextDocument).thenReturn(eventEmitter.event); - when(commandManager.registerCommand(anything(), anything())).thenReturn(mockDisposable as any); - when(fileSystem.directoryExists(anything())).thenResolve(true); - when(fileSystem.fileExists(anything())).thenResolve(false); - when(processServiceFactory.create()).thenResolve(instance(processService)); - when(processService.execObservable(ctagsPath, anything(), anything())).thenReturn(observable as any); - when(applicationShell.setStatusBarMessage(anyString(), anything())).thenCall((text: string) => { - shellOutput += text; - return mockDisposable; - }); - - when(serviceContainer.get(IOutputChannel, STANDARD_OUTPUT_CHANNEL)).thenReturn( - instance(outputChannel), - ); - when(serviceContainer.get(ICommandManager)).thenReturn(instance(commandManager)); - when(serviceContainer.get(IFileSystem)).thenReturn(instance(fileSystem)); - when(serviceContainer.get(IWorkspaceService)).thenReturn(instance(workspaceService)); - when(serviceContainer.get(IProcessServiceFactory)).thenReturn( - instance(processServiceFactory), - ); - when(serviceContainer.get(IApplicationShell)).thenReturn(instance(applicationShell)); - when(serviceContainer.get(IConfigurationService)).thenReturn( - instance(configurationService), - ); - when(serviceContainer.get(IDocumentManager)).thenReturn(instance(documentManager)); - }); - - teardown(() => { - workspaceSymbols.dispose(); - }); - - test('Should not rebuild on start if the setting is disabled', () => { - when(workspaceService.workspaceFolders).thenReturn(workspaceFolders); - when(configurationService.getSettings(anything())).thenReturn({ - workspaceSymbols: { rebuildOnStart: false }, - } as any); - - workspaceSymbols = new WorkspaceSymbols(instance(serviceContainer)); - - assert.equal(shellOutput, ''); - }); - - test("Should not rebuild on start if we don't have a workspace folder", () => { - when(workspaceService.workspaceFolders).thenReturn([]); - when(configurationService.getSettings(anything())).thenReturn({ - workspaceSymbols: { rebuildOnStart: false }, - } as any); - - workspaceSymbols = new WorkspaceSymbols(instance(serviceContainer)); - - assert.equal(shellOutput, ''); - }); - - test('Should rebuild on start if the setting is enabled and we have a workspace folder', async () => { - when(workspaceService.workspaceFolders).thenReturn(workspaceFolders); - when(configurationService.getSettings(anything())).thenReturn({ - workspaceSymbols: { - ctagsPath, - enabled: true, - exclusionPatterns: [], - rebuildOnStart: true, - tagFilePath: 'foo', - }, - } as any); - - workspaceSymbols = new WorkspaceSymbols(instance(serviceContainer)); - await sleep(1); - - assert.equal(shellOutput, 'Generating Tags'); - }); - - test('Should rebuild on save if the setting is enabled', async () => { - when(workspaceService.workspaceFolders).thenReturn(workspaceFolders); - when(workspaceService.getWorkspaceFolder(anything())).thenReturn(workspaceFolders[0]); - when(configurationService.getSettings(anything())).thenReturn({ - workspaceSymbols: { - ctagsPath, - enabled: true, - exclusionPatterns: [], - rebuildOnFileSave: true, - tagFilePath: 'foo', - }, - } as any); - - workspaceSymbols = new WorkspaceSymbols(instance(serviceContainer)); - eventEmitter.fire({ uri: Uri.file('folder') } as any); - await sleep(1); - - assert.equal(shellOutput, 'Generating Tags'); - }); - - test('Command `Build Workspace symbols` is registered with the correct callback handlers and executing it returns `undefined` list if generating workspace tags fails with error', async () => { - let buildWorkspaceSymbolsHandler!: Function; - when(workspaceService.workspaceFolders).thenReturn(workspaceFolders); - when(workspaceService.getWorkspaceFolder(anything())).thenReturn(workspaceFolders[0]); - when(configurationService.getSettings(anything())).thenReturn({ - workspaceSymbols: { - ctagsPath, - enabled: true, - exclusionPatterns: [], - rebuildOnFileSave: true, - tagFilePath: 'foo', - }, - } as any); - reset(commandManager); - when(commandManager.registerCommand(anything(), anything())).thenCall((commandID, cb) => { - expect(commandID).to.equal(Commands.Build_Workspace_Symbols); - buildWorkspaceSymbolsHandler = cb; - return mockDisposable; - }); - reset(applicationShell); - when(applicationShell.setStatusBarMessage(anyString(), anything())).thenThrow( - new Error('Generating workspace tags failed with Error'), - ); - - workspaceSymbols = new WorkspaceSymbols(instance(serviceContainer)); - expect(buildWorkspaceSymbolsHandler).to.not.equal(undefined, 'Handler not registered'); - const symbols = await buildWorkspaceSymbolsHandler(); - - verify(commandManager.registerCommand(anything(), anything())).once(); - assert.deepEqual(symbols, [undefined]); - }); - - test('Should not rebuild on save if the setting is disabled', () => { - when(workspaceService.workspaceFolders).thenReturn(workspaceFolders); - when(configurationService.getSettings(anything())).thenReturn({ - workspaceSymbols: { - ctagsPath, - enabled: true, - exclusionPatterns: [], - rebuildOnFileSave: false, - tagFilePath: 'foo', - }, - } as any); - - workspaceSymbols = new WorkspaceSymbols(instance(serviceContainer)); - - assert.equal(shellOutput, ''); - }); -}); diff --git a/src/test/workspaceSymbols/provider.unit.test.ts b/src/test/workspaceSymbols/provider.unit.test.ts deleted file mode 100644 index fc179238b53c..000000000000 --- a/src/test/workspaceSymbols/provider.unit.test.ts +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -'use strict'; - -import * as assert from 'assert'; -import { expect, use } from 'chai'; -import * as chaiAsPromised from 'chai-as-promised'; -import * as path from 'path'; -import { anything, instance, mock, verify, when } from 'ts-mockito'; -import { CancellationTokenSource, Uri } from 'vscode'; -import { CommandManager } from '../../client/common/application/commandManager'; -import { ICommandManager } from '../../client/common/application/types'; -import { Commands } from '../../client/common/constants'; -import { FileSystem } from '../../client/common/platform/fileSystem'; -import { IFileSystem } from '../../client/common/platform/types'; -import { Generator } from '../../client/workspaceSymbols/generator'; -import { WorkspaceSymbolProvider } from '../../client/workspaceSymbols/provider'; -use(chaiAsPromised); - -const workspaceUri = Uri.file(path.join(__dirname, '..', '..', '..', 'src', 'test')); - -suite('Workspace Symbols Provider', () => { - let generator: Generator; - let fs: IFileSystem; - let commandManager: ICommandManager; - setup(() => { - fs = mock(FileSystem); - commandManager = mock(CommandManager); - generator = mock(Generator); - }); - test('Returns 0 tags without any generators', async () => { - const provider = new WorkspaceSymbolProvider(instance(fs), instance(commandManager), []); - - const tags = await provider.provideWorkspaceSymbols('', new CancellationTokenSource().token); - - expect(tags).to.be.lengthOf(0); - }); - test("Builds tags when a tag file doesn't exist", async () => { - const provider = new WorkspaceSymbolProvider(instance(fs), instance(commandManager), [instance(generator)]); - const tagFilePath = 'No existing tagFilePath'; - when(generator.tagFilePath).thenReturn(tagFilePath); - when(fs.fileExists(tagFilePath)).thenResolve(false); - when(commandManager.executeCommand(Commands.Build_Workspace_Symbols, true, anything())).thenResolve(); - - const tags = await provider.provideWorkspaceSymbols('', new CancellationTokenSource().token); - - expect(tags).to.be.lengthOf(0); - verify(commandManager.executeCommand(Commands.Build_Workspace_Symbols, true, anything())).once(); - }); - test("Builds tags when a tag file doesn't exist", async () => { - const provider = new WorkspaceSymbolProvider(instance(fs), instance(commandManager), [instance(generator)]); - const tagFilePath = 'No existing tagFilePath'; - when(generator.tagFilePath).thenReturn(tagFilePath); - when(fs.fileExists(tagFilePath)).thenResolve(false); - when(commandManager.executeCommand(Commands.Build_Workspace_Symbols, true, anything())).thenResolve(); - - const tags = await provider.provideWorkspaceSymbols('', new CancellationTokenSource().token); - - expect(tags).to.be.lengthOf(0); - verify(commandManager.executeCommand(Commands.Build_Workspace_Symbols, true, anything())).once(); - }); - test('Symbols should not be returned when disabled', async () => { - const provider = new WorkspaceSymbolProvider(instance(fs), instance(commandManager), [instance(generator)]); - const tagFilePath = 'existing tagFilePath'; - when(generator.tagFilePath).thenReturn(tagFilePath); - when(generator.enabled).thenReturn(false); - when(fs.fileExists(tagFilePath)).thenResolve(true); - when(commandManager.executeCommand(Commands.Build_Workspace_Symbols, true, anything())).thenResolve(); - - const tags = await provider.provideWorkspaceSymbols('', new CancellationTokenSource().token); - - expect(tags).to.be.lengthOf(0); - verify(commandManager.executeCommand(Commands.Build_Workspace_Symbols, true, anything())).never(); - }); - test('symbols should be returned when enabled and vice versa', async () => { - const provider = new WorkspaceSymbolProvider(instance(fs), instance(commandManager), [instance(generator)]); - const tagFilePath = path.join(workspaceUri.fsPath, '.vscode', 'tags'); - when(generator.tagFilePath).thenReturn(tagFilePath); - when(generator.workspaceFolder).thenReturn(workspaceUri); - when(generator.enabled).thenReturn(true); - when(fs.fileExists(tagFilePath)).thenResolve(true); - when(commandManager.executeCommand(Commands.Build_Workspace_Symbols, true, anything())).thenResolve(); - - const tags = await provider.provideWorkspaceSymbols('', new CancellationTokenSource().token); - - expect(tags.length).to.be.greaterThan(99); - verify(commandManager.executeCommand(Commands.Build_Workspace_Symbols, true, anything())).never(); - }); - test('symbols should be filtered correctly', async () => { - const provider = new WorkspaceSymbolProvider(instance(fs), instance(commandManager), [instance(generator)]); - const tagFilePath = path.join(workspaceUri.fsPath, '.vscode', 'tags'); - when(generator.tagFilePath).thenReturn(tagFilePath); - when(generator.workspaceFolder).thenReturn(workspaceUri); - when(generator.enabled).thenReturn(true); - when(fs.fileExists(tagFilePath)).thenResolve(true); - when(commandManager.executeCommand(Commands.Build_Workspace_Symbols, true, anything())).thenResolve(); - - const symbols = await provider.provideWorkspaceSymbols('meth1Of', new CancellationTokenSource().token); - - expect(symbols).to.be.length.greaterThan(0); - verify(commandManager.executeCommand(Commands.Build_Workspace_Symbols, true, anything())).never(); - - assert.equal(symbols.length >= 2, true, 'Incorrect number of symbols returned'); - assert.notEqual( - symbols.findIndex((sym) => sym.location.uri.fsPath.endsWith('childFile.py')), - -1, - 'File with symbol not found in child workspace folder', - ); - assert.notEqual( - symbols.findIndex((sym) => sym.location.uri.fsPath.endsWith('workspace2File.py')), - -1, - 'File with symbol not found in child workspace folder', - ); - - const symbolsForMeth = await provider.provideWorkspaceSymbols('meth', new CancellationTokenSource().token); - assert.equal(symbolsForMeth.length >= 10, true, 'Incorrect number of symbols returned'); - assert.notEqual( - symbolsForMeth.findIndex((sym) => sym.location.uri.fsPath.endsWith('childFile.py')), - -1, - 'Symbols not returned for childFile.py', - ); - assert.notEqual( - symbolsForMeth.findIndex((sym) => sym.location.uri.fsPath.endsWith('workspace2File.py')), - -1, - 'Symbols not returned for workspace2File.py', - ); - assert.notEqual( - symbolsForMeth.findIndex((sym) => sym.location.uri.fsPath.endsWith('file.py')), - -1, - 'Symbols not returned for file.py', - ); - }); -}); diff --git a/src/testMultiRootWkspc/disableLinters/.vscode/tags b/src/testMultiRootWkspc/disableLinters/.vscode/tags deleted file mode 100644 index 4739b4629cfb..000000000000 --- a/src/testMultiRootWkspc/disableLinters/.vscode/tags +++ /dev/null @@ -1,19 +0,0 @@ -!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ -!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ -!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ -!_TAG_PROGRAM_AUTHOR Universal Ctags Team // -!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ -!_TAG_PROGRAM_URL https://ctags.io/ /official site/ -!_TAG_PROGRAM_VERSION 0.0.0 /f9e6e3c1/ -Foo ..\\file.py /^class Foo(object):$/;" kind:class line:5 -__init__ ..\\file.py /^ def __init__(self):$/;" kind:member line:8 -__revision__ ..\\file.py /^__revision__ = None$/;" kind:variable line:3 -file.py ..\\file.py 1;" kind:file line:1 -meth1 ..\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth2 ..\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth3 ..\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth4 ..\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth5 ..\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth6 ..\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth7 ..\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth8 ..\\file.py /^ def meth8(self):$/;" kind:member line:80 diff --git a/src/testMultiRootWkspc/parent/child/.vscode/tags b/src/testMultiRootWkspc/parent/child/.vscode/tags deleted file mode 100644 index e6791c755b0f..000000000000 --- a/src/testMultiRootWkspc/parent/child/.vscode/tags +++ /dev/null @@ -1,24 +0,0 @@ -!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ -!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ -!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ -!_TAG_PROGRAM_AUTHOR Universal Ctags Team // -!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ -!_TAG_PROGRAM_URL https://ctags.io/ /official site/ -!_TAG_PROGRAM_VERSION 0.0.0 /f9e6e3c1/ -Child2Class ..\\childFile.py /^class Child2Class(object):$/;" kind:class line:5 -Foo ..\\file.py /^class Foo(object):$/;" kind:class line:5 -__init__ ..\\childFile.py /^ def __init__(self):$/;" kind:member line:8 -__init__ ..\\file.py /^ def __init__(self):$/;" kind:member line:8 -__revision__ ..\\childFile.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ ..\\file.py /^__revision__ = None$/;" kind:variable line:3 -childFile.py ..\\childFile.py 1;" kind:file line:1 -file.py ..\\file.py 1;" kind:file line:1 -meth1 ..\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth1OfChild ..\\childFile.py /^ def meth1OfChild(self, arg):$/;" kind:member line:11 -meth2 ..\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth3 ..\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth4 ..\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth5 ..\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth6 ..\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth7 ..\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth8 ..\\file.py /^ def meth8(self):$/;" kind:member line:80 diff --git a/src/testMultiRootWkspc/workspace1/.vscode/tags b/src/testMultiRootWkspc/workspace1/.vscode/tags deleted file mode 100644 index 4739b4629cfb..000000000000 --- a/src/testMultiRootWkspc/workspace1/.vscode/tags +++ /dev/null @@ -1,19 +0,0 @@ -!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ -!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ -!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ -!_TAG_PROGRAM_AUTHOR Universal Ctags Team // -!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ -!_TAG_PROGRAM_URL https://ctags.io/ /official site/ -!_TAG_PROGRAM_VERSION 0.0.0 /f9e6e3c1/ -Foo ..\\file.py /^class Foo(object):$/;" kind:class line:5 -__init__ ..\\file.py /^ def __init__(self):$/;" kind:member line:8 -__revision__ ..\\file.py /^__revision__ = None$/;" kind:variable line:3 -file.py ..\\file.py 1;" kind:file line:1 -meth1 ..\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth2 ..\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth3 ..\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth4 ..\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth5 ..\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth6 ..\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth7 ..\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth8 ..\\file.py /^ def meth8(self):$/;" kind:member line:80 diff --git a/src/testMultiRootWkspc/workspace2/workspace2.tags.file b/src/testMultiRootWkspc/workspace2/workspace2.tags.file deleted file mode 100644 index 375785e2a94e..000000000000 --- a/src/testMultiRootWkspc/workspace2/workspace2.tags.file +++ /dev/null @@ -1,24 +0,0 @@ -!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ -!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ -!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ -!_TAG_PROGRAM_AUTHOR Universal Ctags Team // -!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ -!_TAG_PROGRAM_URL https://ctags.io/ /official site/ -!_TAG_PROGRAM_VERSION 0.0.0 /f9e6e3c1/ -Foo C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\file.py /^class Foo(object):$/;" kind:class line:5 -Workspace2Class C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\workspace2File.py /^class Workspace2Class(object):$/;" kind:class line:5 -__init__ C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\file.py /^ def __init__(self):$/;" kind:member line:8 -__init__ C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\workspace2File.py /^ def __init__(self):$/;" kind:member line:8 -__revision__ C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\file.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\workspace2File.py /^__revision__ = None$/;" kind:variable line:3 -file.py C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\file.py 1;" kind:file line:1 -meth1 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth1OfWorkspace2 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\workspace2File.py /^ def meth1OfWorkspace2(self, arg):$/;" kind:member line:11 -meth2 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth3 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth4 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth5 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth6 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth7 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth8 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\file.py /^ def meth8(self):$/;" kind:member line:80 -workspace2File.py C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace2\\workspace2File.py 1;" kind:file line:1 diff --git a/src/testMultiRootWkspc/workspace3/workspace3.tags.file b/src/testMultiRootWkspc/workspace3/workspace3.tags.file deleted file mode 100644 index 3a65841e2aff..000000000000 --- a/src/testMultiRootWkspc/workspace3/workspace3.tags.file +++ /dev/null @@ -1,19 +0,0 @@ -!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ -!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ -!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ -!_TAG_PROGRAM_AUTHOR Universal Ctags Team // -!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ -!_TAG_PROGRAM_URL https://ctags.io/ /official site/ -!_TAG_PROGRAM_VERSION 0.0.0 /f9e6e3c1/ -Foo C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace3\\file.py /^class Foo(object):$/;" kind:class line:5 -__init__ C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace3\\file.py /^ def __init__(self):$/;" kind:member line:8 -__revision__ C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace3\\file.py /^__revision__ = None$/;" kind:variable line:3 -file.py C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace3\\file.py 1;" kind:file line:1 -meth1 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace3\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth2 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace3\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth3 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace3\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth4 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace3\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth5 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace3\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth6 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace3\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth7 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace3\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth8 C:\\Users\\dojayama\\.vscode\\extensions\\pythonVSCode\\src\\testMultiRootWkspc\\workspace3\\file.py /^ def meth8(self):$/;" kind:member line:80 From 1bc8b07172592098fcfb0135e5b04c85b888e813 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Wed, 28 Apr 2021 19:52:50 -0700 Subject: [PATCH 02/13] Remove rope (#16064) --- .github/test_plan.md | 8 - build/conda-functional-requirements.txt | 1 - build/test-requirements.txt | 1 - package.nls.de.json | 2 - package.nls.es.json | 2 - package.nls.fr.json | 2 - package.nls.it.json | 2 - package.nls.ja.json | 2 - package.nls.json | 2 - package.nls.ko-kr.json | 2 - package.nls.nl.json | 2 - package.nls.pl.json | 2 - package.nls.pt-br.json | 2 - package.nls.ru.json | 2 - package.nls.tr.json | 2 - package.nls.zh-cn.json | 2 - package.nls.zh-tw.json | 2 - pythonFiles/refactor.py | 395 ------------------ src/client/activation/jedi.ts | 16 +- src/client/common/constants.ts | 2 - .../common/installer/moduleInstaller.ts | 2 - .../common/installer/productInstaller.ts | 19 - src/client/common/installer/productNames.ts | 1 - src/client/common/installer/productPath.ts | 10 - src/client/common/installer/productService.ts | 1 - .../common/installer/serviceRegistry.ts | 6 - .../common/process/internal/scripts/index.ts | 19 - src/client/common/types.ts | 1 - src/client/extensionActivation.ts | 5 - src/client/providers/renameProvider.ts | 93 ----- .../providers/simpleRefactorProvider.ts | 223 ---------- src/client/refactor/proxy.ts | 206 --------- src/test/common/installer.test.ts | 6 - .../installer.invalidPath.unit.test.ts | 1 - .../common/installer/productPath.unit.test.ts | 13 - .../installer/serviceRegistry.unit.test.ts | 8 - src/test/linters/lint.multiroot.test.ts | 6 - src/test/linters/lint.test.ts | 6 - .../source folder/with empty line.py | 8 - .../source folder/without empty line.py | 8 - .../refactoring/standAlone/refactor.py | 245 ----------- .../extension.refactor.extract.method.test.ts | 201 --------- .../extension.refactor.extract.var.test.ts | 202 --------- src/test/refactor/rename.test.ts | 202 --------- 44 files changed, 4 insertions(+), 1939 deletions(-) delete mode 100644 pythonFiles/refactor.py delete mode 100644 src/client/providers/renameProvider.ts delete mode 100644 src/client/providers/simpleRefactorProvider.ts delete mode 100644 src/client/refactor/proxy.ts delete mode 100644 src/test/pythonFiles/refactoring/source folder/with empty line.py delete mode 100644 src/test/pythonFiles/refactoring/source folder/without empty line.py delete mode 100644 src/test/pythonFiles/refactoring/standAlone/refactor.py delete mode 100644 src/test/refactor/extension.refactor.extract.method.test.ts delete mode 100644 src/test/refactor/extension.refactor.extract.var.test.ts delete mode 100644 src/test/refactor/rename.test.ts diff --git a/.github/test_plan.md b/.github/test_plan.md index bafe2aadb43c..3f43f8d08d59 100644 --- a/.github/test_plan.md +++ b/.github/test_plan.md @@ -224,14 +224,6 @@ def foo():pass - [ ] yapf - [ ] `"editor.formatOnType": true` works and has expected results -#### [Refactoring](https://code.visualstudio.com/docs/python/editing#_refactoring) - -- [ ] [`Extract Variable`](https://code.visualstudio.com/docs/python/editing#_extract-variable) works - - [ ] You are prompted to install `rope` if it is not already available -- [ ] [`Extract method`](https://code.visualstudio.com/docs/python/editing#_extract-method) works - - [ ] You are prompted to install `rope` if it is not already available -- [ ] [`Sort Imports`](https://code.visualstudio.com/docs/python/editing#_sort-imports) works - ### [Debugging](https://code.visualstudio.com/docs/python/debugging) - [ ] [Configurations](https://code.visualstudio.com/docs/python/debugging#_debugging-specific-app-types) work (see [`package.json`](https://github.com/Microsoft/vscode-python/blob/main/package.json) and the `"configurationSnippets"` section for all of the possible configurations) diff --git a/build/conda-functional-requirements.txt b/build/conda-functional-requirements.txt index 4237bde6d759..276e241bbf0f 100644 --- a/build/conda-functional-requirements.txt +++ b/build/conda-functional-requirements.txt @@ -11,7 +11,6 @@ pycodestyle pydocstyle nose pytest==4.6.9 # Last version of pytest with Python 2.7 support -rope fastapi ; python_version>='3.6' uvicorn ; python_version>='3.6' flask diff --git a/build/test-requirements.txt b/build/test-requirements.txt index 9bb14d923427..1365e808bc34 100644 --- a/build/test-requirements.txt +++ b/build/test-requirements.txt @@ -10,7 +10,6 @@ pycodestyle pydocstyle prospector ; python_version > '2.7' pytest<6 ; python_version > '2.7' # Tests currently fail against pytest 6. -rope flask fastapi ; python_version > '2.7' uvicorn ; python_version > '2.7' diff --git a/package.nls.de.json b/package.nls.de.json index dd638e16398b..b90e40507ec4 100644 --- a/package.nls.de.json +++ b/package.nls.de.json @@ -5,8 +5,6 @@ "python.command.python.buildWorkspaceSymbols.title": "Arbeitsplatz-Symbole erstellen", "python.command.python.execInTerminal.title": "Python-Datei im Terminal ausführen", "python.command.python.setInterpreter.title": "Interpreter auswählen", - "python.command.python.refactorExtractVariable.title": "Variable extrahieren", - "python.command.python.refactorExtractMethod.title": "Methode extrahieren", "python.command.python.execSelectionInTerminal.title": "Selektion/Reihe in Python-Terminal ausführen", "python.command.python.execSelectionInDjangoShell.title": "Selektion/Reihe in Django-Shell ausführen", "python.command.python.goToPythonObject.title": "Gehe zu Python-Objekt", diff --git a/package.nls.es.json b/package.nls.es.json index c75644b838a0..72ca91e0d605 100644 --- a/package.nls.es.json +++ b/package.nls.es.json @@ -5,8 +5,6 @@ "python.command.python.buildWorkspaceSymbols.title": "Compilar símbolos del área de trabajo", "python.command.python.execInTerminal.title": "Ejecutar archivo Python en la terminal", "python.command.python.setInterpreter.title": "Seleccionar intérprete", - "python.command.python.refactorExtractVariable.title": "Extraer variable", - "python.command.python.refactorExtractMethod.title": "Extraer método", "python.command.python.execSelectionInTerminal.title": "Ejecutar línea/selección en la terminal", "python.command.python.execSelectionInDjangoShell.title": "Ejecutar línea/selección en el intérprete de Django", "python.command.python.goToPythonObject.title": "Ir al objeto de Python", diff --git a/package.nls.fr.json b/package.nls.fr.json index f79d28bd4911..325fa34da48e 100644 --- a/package.nls.fr.json +++ b/package.nls.fr.json @@ -5,8 +5,6 @@ "python.command.python.buildWorkspaceSymbols.title": "Construire les symboles de l'espace de travail", "python.command.python.execInTerminal.title": "Exécuter le script Python dans un terminal", "python.command.python.setInterpreter.title": "Sélectionner l'interpreteur", - "python.command.python.refactorExtractVariable.title": "Extraire la variable", - "python.command.python.refactorExtractMethod.title": "Extraire la méthode", "python.command.python.execSelectionInTerminal.title": "Exécuter la ligne/sélection dans un terminal Python", "python.command.python.execSelectionInDjangoShell.title": "Exécuter la ligne/sélection dans un shell Django", "python.command.python.goToPythonObject.title": "Se rendre à l'objet Python", diff --git a/package.nls.it.json b/package.nls.it.json index a88f39eb11a4..4a2d4880461a 100644 --- a/package.nls.it.json +++ b/package.nls.it.json @@ -5,8 +5,6 @@ "python.command.python.buildWorkspaceSymbols.title": "Compila simboli dello spazio di lavoro", "python.command.python.execInTerminal.title": "Esegui file Python nel terminale", "python.command.python.setInterpreter.title": "Seleziona interprete", - "python.command.python.refactorExtractVariable.title": "Estrai variable", - "python.command.python.refactorExtractMethod.title": "Estrai metodo", "python.command.python.execSelectionInTerminal.title": "Esegui selezione/linea nel terminale di Python", "python.command.python.execSelectionInDjangoShell.title": "Esegui selezione/linea nella shell Django", "python.command.python.goToPythonObject.title": "Vai a oggetto Python", diff --git a/package.nls.ja.json b/package.nls.ja.json index e10a8e6ea872..998ac4f4f2e0 100644 --- a/package.nls.ja.json +++ b/package.nls.ja.json @@ -4,8 +4,6 @@ "python.command.python.buildWorkspaceSymbols.title": "ワークスペースのシンボルをビルド", "python.command.python.execInTerminal.title": "ターミナルで Python ファイルを実行", "python.command.python.setInterpreter.title": "インタープリターを選択", - "python.command.python.refactorExtractVariable.title": "変数を抽出", - "python.command.python.refactorExtractMethod.title": "メソッドを抽出", "python.command.python.execSelectionInTerminal.title": "Python ターミナルで選択範囲/行を実行", "python.command.python.execSelectionInDjangoShell.title": "Django シェルで選択範囲/行を実行", "python.command.python.goToPythonObject.title": "Python オブジェクトに移動", diff --git a/package.nls.json b/package.nls.json index 072364a27542..74549d988dc4 100644 --- a/package.nls.json +++ b/package.nls.json @@ -9,8 +9,6 @@ "python.command.python.switchToDailyChannel.title": "Switch to Insiders Daily Channel", "python.command.python.switchToWeeklyChannel.title": "Switch to Insiders Weekly Channel", "python.command.python.clearWorkspaceInterpreter.title": "Clear Workspace Interpreter Setting", - "python.command.python.refactorExtractVariable.title": "Extract Variable", - "python.command.python.refactorExtractMethod.title": "Extract Method", "python.command.python.viewOutput.title": "Show Output", "python.command.python.viewLanguageServerOutput.title": "Show Language Server Output", "python.command.python.configureTests.title": "Configure Tests", diff --git a/package.nls.ko-kr.json b/package.nls.ko-kr.json index 910d256f31a5..81d2e6fb56a9 100644 --- a/package.nls.ko-kr.json +++ b/package.nls.ko-kr.json @@ -4,8 +4,6 @@ "python.command.python.buildWorkspaceSymbols.title": "작업 영역 기호 빌드", "python.command.python.execInTerminal.title": "터미널에서 Python 파일 실행", "python.command.python.setInterpreter.title": "인터프리터 선택", - "python.command.python.refactorExtractVariable.title": "변수 추출", - "python.command.python.refactorExtractMethod.title": "메서드 추출", "python.command.python.execSelectionInTerminal.title": "Python 터미널에서 선택 영역/줄 실행", "python.command.python.execSelectionInDjangoShell.title": "Django 셸에서 선택 영역/줄 실행", "python.command.python.goToPythonObject.title": " Python 객체로 이동", diff --git a/package.nls.nl.json b/package.nls.nl.json index a98570ec8035..28ee8f3f126c 100644 --- a/package.nls.nl.json +++ b/package.nls.nl.json @@ -5,8 +5,6 @@ "python.command.python.buildWorkspaceSymbols.title": "Werkruimte-symbolen aanmaken", "python.command.python.execInTerminal.title": "Python-bestand in terminal uitvoeren", "python.command.python.setInterpreter.title": "Interpreter selecteren", - "python.command.python.refactorExtractVariable.title": "Variabelen selecteren", - "python.command.python.refactorExtractMethod.title": "Methode selecteren", "python.command.python.execSelectionInTerminal.title": "Selectie/rij in Python-terminal uitvoeren", "python.command.python.execSelectionInDjangoShell.title": "Selectie/rij in Django-shell uitvoeren", "python.command.python.goToPythonObject.title": "Naar Python-object gaan", diff --git a/package.nls.pl.json b/package.nls.pl.json index fefb0d9f8904..d7f58fd22e1e 100644 --- a/package.nls.pl.json +++ b/package.nls.pl.json @@ -5,8 +5,6 @@ "python.command.python.buildWorkspaceSymbols.title": "Zbuduj symbole dla przestrzeni roboczej", "python.command.python.execInTerminal.title": "Uruchom plik pythonowy w terminalu", "python.command.python.setInterpreter.title": "Wybierz wersję interpretera", - "python.command.python.refactorExtractVariable.title": "Wyodrębnij zmienną", - "python.command.python.refactorExtractMethod.title": "Wyodrębnij metodę", "python.command.python.viewOutput.title": "Pokaż wyniki", "python.command.python.configureTests.title": "Konfiguruj testy jednostkowe", "python.command.python.execSelectionInTerminal.title": "Uruchom zaznaczony obszar w interpreterze Pythona", diff --git a/package.nls.pt-br.json b/package.nls.pt-br.json index 01e8cebfb9ce..2d889beecb69 100644 --- a/package.nls.pt-br.json +++ b/package.nls.pt-br.json @@ -5,8 +5,6 @@ "python.command.python.buildWorkspaceSymbols.title": "Construir Símbolos da Área de Trabalho", "python.command.python.execInTerminal.title": "Executar Arquivo no Terminal", "python.command.python.setInterpreter.title": "Selecionar Interpretador", - "python.command.python.refactorExtractVariable.title": "Extrair Variável", - "python.command.python.refactorExtractMethod.title": "Extrair Método", "python.command.python.execSelectionInTerminal.title": "Executar Seleção/Linha no Terminal", "python.command.python.execSelectionInDjangoShell.title": "Executar Seleção/Linha no Django Shell", "python.command.python.goToPythonObject.title": "Ir para Objeto Python", diff --git a/package.nls.ru.json b/package.nls.ru.json index abb8a67f1d86..afffe4ba8d7b 100644 --- a/package.nls.ru.json +++ b/package.nls.ru.json @@ -4,8 +4,6 @@ "python.command.python.buildWorkspaceSymbols.title": "Собрать символы рабочего пространства", "python.command.python.execInTerminal.title": "Выполнить файл в консоли", "python.command.python.setInterpreter.title": "Выбрать интерпретатор", - "python.command.python.refactorExtractVariable.title": "Извлечь в переменную", - "python.command.python.refactorExtractMethod.title": "Извлечь в метод", "python.command.python.execSelectionInTerminal.title": "Выполнить выбранный текст или текущую строку в консоли", "python.command.python.execSelectionInDjangoShell.title": "Выполнить выбранный текст или текущую строку в оболочке Django", "python.command.python.goToPythonObject.title": "Перейти к объекту Python", diff --git a/package.nls.tr.json b/package.nls.tr.json index e578fd7c9416..bd30e24f641e 100644 --- a/package.nls.tr.json +++ b/package.nls.tr.json @@ -5,8 +5,6 @@ "python.command.python.buildWorkspaceSymbols.title": "Çalışma Alanındaki Sembolleri Derle", "python.command.python.execInTerminal.title": "Terminalde Çalıştır", "python.command.python.setInterpreter.title": "Bir Interpreter Seçin", - "python.command.python.refactorExtractVariable.title": "Değişken Çıkar", - "python.command.python.refactorExtractMethod.title": "Metot Çıkar", "python.command.python.execSelectionInTerminal.title": "Seçimi/Satırı Terminalde Çalıştır", "python.command.python.execSelectionInDjangoShell.title": "Seçimi/Satırı Django Shell'inde Çalıştır", "python.command.python.goToPythonObject.title": "Python Nesnesine Git", diff --git a/package.nls.zh-cn.json b/package.nls.zh-cn.json index bb6e9b4c1704..176e331593db 100644 --- a/package.nls.zh-cn.json +++ b/package.nls.zh-cn.json @@ -9,8 +9,6 @@ "python.command.python.switchToDailyChannel.title": "切换到每日预览版本", "python.command.python.switchToWeeklyChannel.title": "切换到每周预览版本", "python.command.python.clearWorkspaceInterpreter.title": "清除工作区解释器设置", - "python.command.python.refactorExtractVariable.title": "提取变量", - "python.command.python.refactorExtractMethod.title": "提取方法", "python.command.python.viewOutput.title": "显示输出", "python.command.python.viewLanguageServerOutput.title": "显示语言服务器输出", "python.command.python.configureTests.title": "配置单元测试", diff --git a/package.nls.zh-tw.json b/package.nls.zh-tw.json index 2664d32226bf..23a9c53abfb0 100644 --- a/package.nls.zh-tw.json +++ b/package.nls.zh-tw.json @@ -5,8 +5,6 @@ "python.command.python.buildWorkspaceSymbols.title": "建構工作區符號", "python.command.python.execInTerminal.title": "在終端機中執行 Python 檔案", "python.command.python.setInterpreter.title": "選擇直譯器", - "python.command.python.refactorExtractVariable.title": "提取變數", - "python.command.python.refactorExtractMethod.title": "提取方法", "python.command.python.execSelectionInTerminal.title": "在 Python 終端機中執行選定內容/行", "python.command.python.execSelectionInDjangoShell.title": "在 Django Shell 中執行選定內容/行", "python.command.python.goToPythonObject.title": "跳至 Python 物件", diff --git a/pythonFiles/refactor.py b/pythonFiles/refactor.py deleted file mode 100644 index f9d3b29e3b19..000000000000 --- a/pythonFiles/refactor.py +++ /dev/null @@ -1,395 +0,0 @@ -# Arguments are: -# 1. Working directory. -# 2. Rope folder - -import difflib -import io -import json -import os -import sys -import traceback - -try: - import rope - from rope.base import libutils - from rope.refactor.rename import Rename - from rope.refactor.extract import ExtractMethod, ExtractVariable - import rope.base.project - import rope.base.taskhandle -except: - jsonMessage = { - "error": True, - "message": "Rope not installed", - "traceback": "", - "type": "ModuleNotFoundError", - } - sys.stderr.write(json.dumps(jsonMessage)) - sys.stderr.flush() - -WORKSPACE_ROOT = sys.argv[1] -ROPE_PROJECT_FOLDER = ".vscode/.ropeproject" - - -class RefactorProgress: - """ - Refactor progress information - """ - - def __init__(self, name="Task Name", message=None, percent=0): - self.name = name - self.message = message - self.percent = percent - - -class ChangeType: - """ - Change Type Enum - """ - - EDIT = 0 - NEW = 1 - DELETE = 2 - - -class Change: - """ """ - - EDIT = 0 - NEW = 1 - DELETE = 2 - - def __init__(self, filePath, fileMode=ChangeType.EDIT, diff=""): - self.filePath = filePath - self.diff = diff - self.fileMode = fileMode - - -def get_diff(changeset): - """This is a copy of the code form the ChangeSet.get_description method found in Rope.""" - new = changeset.new_contents - old = changeset.old_contents - if old is None: - if changeset.resource.exists(): - old = changeset.resource.read() - else: - old = "" - - # Ensure code has a trailing empty lines, before generating a diff. - # https://github.com/Microsoft/vscode-python/issues/695. - old_lines = old.splitlines(True) - if not old_lines[-1].endswith("\n"): - old_lines[-1] = old_lines[-1] + os.linesep - new = new + os.linesep - - result = difflib.unified_diff( - old_lines, - new.splitlines(True), - "a/" + changeset.resource.path, - "b/" + changeset.resource.path, - ) - return "".join(list(result)) - - -class BaseRefactoring(object): - """ - Base class for refactorings - """ - - def __init__(self, project, resource, name="Refactor", progressCallback=None): - self._progressCallback = progressCallback - self._handle = rope.base.taskhandle.TaskHandle(name) - self._handle.add_observer(self._update_progress) - self.project = project - self.resource = resource - self.changes = [] - - def _update_progress(self): - jobset = self._handle.current_jobset() - if jobset and not self._progressCallback is None: - progress = RefactorProgress() - # getting current job set name - if jobset.get_name() is not None: - progress.name = jobset.get_name() - # getting active job name - if jobset.get_active_job_name() is not None: - progress.message = jobset.get_active_job_name() - # adding done percent - percent = jobset.get_percent_done() - if percent is not None: - progress.percent = percent - if not self._progressCallback is None: - self._progressCallback(progress) - - def stop(self): - self._handle.stop() - - def refactor(self): - try: - self.onRefactor() - except rope.base.exceptions.InterruptedTaskError: - # we can ignore this exception, as user has cancelled refactoring - pass - - def onRefactor(self): - """ - To be implemented by each base class - """ - pass - - -class RenameRefactor(BaseRefactoring): - def __init__( - self, - project, - resource, - name="Rename", - progressCallback=None, - startOffset=None, - newName="new_Name", - ): - BaseRefactoring.__init__(self, project, resource, name, progressCallback) - self._newName = newName - self.startOffset = startOffset - - def onRefactor(self): - renamed = Rename(self.project, self.resource, self.startOffset) - changes = renamed.get_changes(self._newName, task_handle=self._handle) - for item in changes.changes: - if isinstance(item, rope.base.change.ChangeContents): - self.changes.append( - Change(item.resource.real_path, ChangeType.EDIT, get_diff(item)) - ) - else: - raise Exception("Unknown Change") - - -class ExtractVariableRefactor(BaseRefactoring): - def __init__( - self, - project, - resource, - name="Extract Variable", - progressCallback=None, - startOffset=None, - endOffset=None, - newName="new_Name", - similar=False, - global_=False, - ): - BaseRefactoring.__init__(self, project, resource, name, progressCallback) - self._newName = newName - self._startOffset = startOffset - self._endOffset = endOffset - self._similar = similar - self._global = global_ - - def onRefactor(self): - renamed = ExtractVariable( - self.project, self.resource, self._startOffset, self._endOffset - ) - changes = renamed.get_changes(self._newName, self._similar, self._global) - for item in changes.changes: - if isinstance(item, rope.base.change.ChangeContents): - self.changes.append( - Change(item.resource.real_path, ChangeType.EDIT, get_diff(item)) - ) - else: - raise Exception("Unknown Change") - - -class ExtractMethodRefactor(ExtractVariableRefactor): - def __init__( - self, - project, - resource, - name="Extract Method", - progressCallback=None, - startOffset=None, - endOffset=None, - newName="new_Name", - similar=False, - global_=False, - ): - ExtractVariableRefactor.__init__( - self, - project, - resource, - name, - progressCallback, - startOffset=startOffset, - endOffset=endOffset, - newName=newName, - similar=similar, - global_=global_, - ) - - def onRefactor(self): - renamed = ExtractMethod( - self.project, self.resource, self._startOffset, self._endOffset - ) - changes = renamed.get_changes(self._newName, self._similar, self._global) - for item in changes.changes: - if isinstance(item, rope.base.change.ChangeContents): - self.changes.append( - Change(item.resource.real_path, ChangeType.EDIT, get_diff(item)) - ) - else: - raise Exception("Unknown Change") - - -class RopeRefactoring(object): - def __init__(self): - self.default_sys_path = sys.path - self._input = io.open(sys.stdin.fileno(), encoding="utf-8") - - def _rename(self, filePath, start, newName, indent_size): - """ - Renames a variable - """ - project = rope.base.project.Project( - WORKSPACE_ROOT, - ropefolder=ROPE_PROJECT_FOLDER, - save_history=False, - indent_size=indent_size, - ) - resourceToRefactor = libutils.path_to_resource(project, filePath) - refactor = RenameRefactor( - project, resourceToRefactor, startOffset=start, newName=newName - ) - refactor.refactor() - changes = refactor.changes - project.close() - valueToReturn = [] - for change in changes: - valueToReturn.append({"diff": change.diff}) - return valueToReturn - - def _extractVariable(self, filePath, start, end, newName, indent_size): - """ - Extracts a variable - """ - project = rope.base.project.Project( - WORKSPACE_ROOT, - ropefolder=ROPE_PROJECT_FOLDER, - save_history=False, - indent_size=indent_size, - ) - resourceToRefactor = libutils.path_to_resource(project, filePath) - refactor = ExtractVariableRefactor( - project, - resourceToRefactor, - startOffset=start, - endOffset=end, - newName=newName, - similar=True, - ) - refactor.refactor() - changes = refactor.changes - project.close() - valueToReturn = [] - for change in changes: - valueToReturn.append({"diff": change.diff}) - return valueToReturn - - def _extractMethod(self, filePath, start, end, newName, indent_size): - """ - Extracts a method - """ - project = rope.base.project.Project( - WORKSPACE_ROOT, - ropefolder=ROPE_PROJECT_FOLDER, - save_history=False, - indent_size=indent_size, - ) - resourceToRefactor = libutils.path_to_resource(project, filePath) - refactor = ExtractMethodRefactor( - project, - resourceToRefactor, - startOffset=start, - endOffset=end, - newName=newName, - similar=True, - ) - refactor.refactor() - changes = refactor.changes - project.close() - valueToReturn = [] - for change in changes: - valueToReturn.append({"diff": change.diff}) - return valueToReturn - - def _serialize(self, identifier, results): - """ - Serializes the refactor results - """ - return json.dumps({"id": identifier, "results": results}) - - def _deserialize(self, request): - """Deserialize request from VSCode. - - Args: - request: String with raw request from VSCode. - - Returns: - Python dictionary with request data. - """ - return json.loads(request) - - def _process_request(self, request): - """Accept serialized request from VSCode and write response.""" - request = self._deserialize(request) - lookup = request.get("lookup", "") - - if lookup == "": - pass - elif lookup == "rename": - changes = self._rename( - request["file"], - int(request["start"]), - request["name"], - int(request["indent_size"]), - ) - return self._write_response(self._serialize(request["id"], changes)) - elif lookup == "extract_variable": - changes = self._extractVariable( - request["file"], - int(request["start"]), - int(request["end"]), - request["name"], - int(request["indent_size"]), - ) - return self._write_response(self._serialize(request["id"], changes)) - elif lookup == "extract_method": - changes = self._extractMethod( - request["file"], - int(request["start"]), - int(request["end"]), - request["name"], - int(request["indent_size"]), - ) - return self._write_response(self._serialize(request["id"], changes)) - - def _write_response(self, response): - sys.stdout.write(response + "\n") - sys.stdout.flush() - - def watch(self): - self._write_response("STARTED") - while True: - try: - self._process_request(self._input.readline()) - except: - exc_type, exc_value, exc_tb = sys.exc_info() - tb_info = traceback.extract_tb(exc_tb) - jsonMessage = { - "error": True, - "message": str(exc_value), - "traceback": str(tb_info), - "type": str(exc_type), - } - sys.stderr.write(json.dumps(jsonMessage)) - sys.stderr.flush() - - -if __name__ == "__main__": - RopeRefactoring().watch() diff --git a/src/client/activation/jedi.ts b/src/client/activation/jedi.ts index a1d88c2c247f..c3e988c7391c 100644 --- a/src/client/activation/jedi.ts +++ b/src/client/activation/jedi.ts @@ -35,7 +35,6 @@ import { PythonDefinitionProvider } from '../providers/definitionProvider'; import { PythonHoverProvider } from '../providers/hoverProvider'; import { PythonObjectDefinitionProvider } from '../providers/objectDefinitionProvider'; import { PythonReferenceProvider } from '../providers/referenceProvider'; -import { PythonRenameProvider } from '../providers/renameProvider'; import { PythonSignatureProvider } from '../providers/signatureProvider'; import { JediSymbolProvider } from '../providers/symbolProvider'; import { PythonEnvironment } from '../pythonEnvironments/info'; @@ -46,7 +45,7 @@ export class JediExtensionActivator implements ILanguageServerActivator { private readonly context: IExtensionContext; private jediFactory?: JediFactory; private readonly documentSelector: DocumentFilter[]; - private renameProvider: PythonRenameProvider | undefined; + private renameProvider: undefined; private hoverProvider: PythonHoverProvider | undefined; private definitionProvider: PythonDefinitionProvider | undefined; private referenceProvider: PythonReferenceProvider | undefined; @@ -71,7 +70,7 @@ export class JediExtensionActivator implements ILanguageServerActivator { context.subscriptions.push(jediFactory); const serviceContainer = this.serviceManager.get(IServiceContainer); - this.renameProvider = new PythonRenameProvider(this.serviceManager); + this.renameProvider = undefined; this.definitionProvider = new PythonDefinitionProvider(jediFactory); this.hoverProvider = new PythonHoverProvider(jediFactory); this.referenceProvider = new PythonReferenceProvider(jediFactory); @@ -90,7 +89,6 @@ export class JediExtensionActivator implements ILanguageServerActivator { public activate() { if ( this.registrations.length === 0 && - this.renameProvider && this.definitionProvider && this.hoverProvider && this.referenceProvider && @@ -106,7 +104,6 @@ export class JediExtensionActivator implements ILanguageServerActivator { this.objectDefinitionProvider!.goToObjectDefinition(), ), ); - this.registrations.push(languages.registerRenameProvider(this.documentSelector, this.renameProvider)); this.registrations.push( languages.registerDefinitionProvider(this.documentSelector, this.definitionProvider), ); @@ -128,14 +125,9 @@ export class JediExtensionActivator implements ILanguageServerActivator { } } - public provideRenameEdits( - document: TextDocument, - position: Position, - newName: string, - token: CancellationToken, - ): ProviderResult { + public provideRenameEdits(): ProviderResult { if (this.renameProvider) { - return this.renameProvider.provideRenameEdits(document, position, newName, token); + return Promise.resolve(undefined); } } public provideDefinition( diff --git a/src/client/common/constants.ts b/src/client/common/constants.ts index 1b44b27bd406..a23270451b94 100644 --- a/src/client/common/constants.ts +++ b/src/client/common/constants.ts @@ -41,8 +41,6 @@ export namespace Commands { export const Test_Refresh = 'python.refreshTests'; export const Sort_Imports = 'python.sortImports'; export const ViewOutput = 'python.viewOutput'; - export const Refactor_Extract_Variable = 'python.refactorExtractVariable'; - export const Refactor_Extract_Method = 'python.refactorExtractMethod'; export const Build_Workspace_Symbols = 'python.buildWorkspaceSymbols'; export const Start_REPL = 'python.startREPL'; export const Create_Terminal = 'python.createTerminal'; diff --git a/src/client/common/installer/moduleInstaller.ts b/src/client/common/installer/moduleInstaller.ts index 13e5ba12c378..62c1717f8be3 100644 --- a/src/client/common/installer/moduleInstaller.ts +++ b/src/client/common/installer/moduleInstaller.ts @@ -179,8 +179,6 @@ export function translateProductToModule(product: Product): string { return 'flake8'; case Product.unittest: return 'unittest'; - case Product.rope: - return 'rope'; case Product.bandit: return 'bandit'; case Product.jupyter: diff --git a/src/client/common/installer/productInstaller.ts b/src/client/common/installer/productInstaller.ts index 65cc04abb68c..52bae4d7efd6 100644 --- a/src/client/common/installer/productInstaller.ts +++ b/src/client/common/installer/productInstaller.ts @@ -381,23 +381,6 @@ export class TestFrameworkInstaller extends BaseInstaller { } } -class RefactoringLibraryInstaller extends BaseInstaller { - protected async promptToInstallImplementation( - product: Product, - resource?: Uri, - cancel?: CancellationToken, - _flags?: ModuleInstallFlags, - ): Promise { - const productName = ProductNames.get(product)!; - const item = await this.appShell.showErrorMessage( - `Refactoring library ${productName} is not installed. Install?`, - 'Yes', - 'No', - ); - return item === 'Yes' ? this.install(product, resource, cancel) : InstallerResponse.Ignore; - } -} - export class DataScienceInstaller extends BaseInstaller { // Override base installer to support a more DS-friendly streamlined installation. public async install( @@ -570,8 +553,6 @@ export class ProductInstaller implements IInstaller { return new LinterInstaller(this.serviceContainer, this.outputChannel); case ProductType.TestFramework: return new TestFrameworkInstaller(this.serviceContainer, this.outputChannel); - case ProductType.RefactoringLibrary: - return new RefactoringLibraryInstaller(this.serviceContainer, this.outputChannel); case ProductType.DataScience: return new DataScienceInstaller(this.serviceContainer, this.outputChannel); default: diff --git a/src/client/common/installer/productNames.ts b/src/client/common/installer/productNames.ts index bcee1a53a239..be5ed3f97501 100644 --- a/src/client/common/installer/productNames.ts +++ b/src/client/common/installer/productNames.ts @@ -16,7 +16,6 @@ ProductNames.set(Product.pydocstyle, 'pydocstyle'); ProductNames.set(Product.pylint, 'pylint'); ProductNames.set(Product.pytest, 'pytest'); ProductNames.set(Product.yapf, 'yapf'); -ProductNames.set(Product.rope, 'rope'); ProductNames.set(Product.tensorboard, 'tensorboard'); ProductNames.set(Product.torchProfilerInstallName, 'torch-tb-profiler'); ProductNames.set(Product.torchProfilerImportName, 'torch_tb_profiler'); diff --git a/src/client/common/installer/productPath.ts b/src/client/common/installer/productPath.ts index f0055129a434..5c36a6bbd3bd 100644 --- a/src/client/common/installer/productPath.ts +++ b/src/client/common/installer/productPath.ts @@ -78,16 +78,6 @@ export class TestFrameworkProductPathService extends BaseProductPathsService { } } -@injectable() -export class RefactoringLibraryProductPathService extends BaseProductPathsService { - constructor(@inject(IServiceContainer) serviceContainer: IServiceContainer) { - super(serviceContainer); - } - public getExecutableNameFromSettings(product: Product, _?: Uri): string { - return this.productInstaller.translateProductToModuleName(product); - } -} - @injectable() export class DataScienceProductPathService extends BaseProductPathsService { constructor(@inject(IServiceContainer) serviceContainer: IServiceContainer) { diff --git a/src/client/common/installer/productService.ts b/src/client/common/installer/productService.ts index 499ccf07774f..6b8dfe5d35c2 100644 --- a/src/client/common/installer/productService.ts +++ b/src/client/common/installer/productService.ts @@ -25,7 +25,6 @@ export class ProductService implements IProductService { this.ProductTypes.set(Product.autopep8, ProductType.Formatter); this.ProductTypes.set(Product.black, ProductType.Formatter); this.ProductTypes.set(Product.yapf, ProductType.Formatter); - this.ProductTypes.set(Product.rope, ProductType.RefactoringLibrary); this.ProductTypes.set(Product.jupyter, ProductType.DataScience); this.ProductTypes.set(Product.notebook, ProductType.DataScience); this.ProductTypes.set(Product.ipykernel, ProductType.DataScience); diff --git a/src/client/common/installer/serviceRegistry.ts b/src/client/common/installer/serviceRegistry.ts index 7e5cba29f231..fcd247142323 100644 --- a/src/client/common/installer/serviceRegistry.ts +++ b/src/client/common/installer/serviceRegistry.ts @@ -16,7 +16,6 @@ import { DataScienceProductPathService, FormatterProductPathService, LinterProductPathService, - RefactoringLibraryProductPathService, TestFrameworkProductPathService, } from './productPath'; import { ProductService } from './productService'; @@ -59,11 +58,6 @@ export function registerTypes(serviceManager: IServiceManager) { TestFrameworkProductPathService, ProductType.TestFramework, ); - serviceManager.addSingleton( - IProductPathService, - RefactoringLibraryProductPathService, - ProductType.RefactoringLibrary, - ); serviceManager.addSingleton( IProductPathService, DataScienceProductPathService, diff --git a/src/client/common/process/internal/scripts/index.ts b/src/client/common/process/internal/scripts/index.ts index a647222a9641..3a3959479811 100644 --- a/src/client/common/process/internal/scripts/index.ts +++ b/src/client/common/process/internal/scripts/index.ts @@ -93,25 +93,6 @@ export function sortImports(filename: string, sortArgs?: string[]): [string[], ( return [args, parse]; } -// refactor.py - -export function refactor(root: string): [string[], (out: string) => Record[]] { - const script = path.join(SCRIPTS_DIR, 'refactor.py'); - const args = [script, root]; - - // TODO: Make the return type more specific, like we did - // with completion(). - function parse(out: string): Record[] { - // TODO: Also handle "STARTED"? - return out - .split(/\r?\n/g) - .filter((line) => line.length > 0) - .map((resp) => JSON.parse(resp)); - } - - return [args, parse]; -} - // normalizeSelection.py export function normalizeSelection(): [string[], (out: string) => string] { diff --git a/src/client/common/types.ts b/src/client/common/types.ts index 0d6650df7dff..c940fc63cae3 100644 --- a/src/client/common/types.ts +++ b/src/client/common/types.ts @@ -92,7 +92,6 @@ export enum Product { autopep8 = 10, mypy = 11, unittest = 12, - rope = 14, isort = 15, black = 16, bandit = 17, diff --git a/src/client/extensionActivation.ts b/src/client/extensionActivation.ts index 79ec2ec9c1d0..fb9c0abf3326 100644 --- a/src/client/extensionActivation.ts +++ b/src/client/extensionActivation.ts @@ -40,7 +40,6 @@ import { PythonCodeActionProvider } from './providers/codeActionProvider/pythonC import { PythonFormattingEditProvider } from './providers/formatProvider'; import { ReplProvider } from './providers/replProvider'; import { registerTypes as providersRegisterTypes } from './providers/serviceRegistry'; -import { activateSimplePythonRefactorProvider } from './providers/simpleRefactorProvider'; import { TerminalProvider } from './providers/terminalProvider'; import { ISortImportsEditingProvider } from './providers/types'; import { setExtensionInstallTelemetryProperties } from './telemetry/extensionInstallTelemetry'; @@ -101,8 +100,6 @@ async function activateLegacy(ext: ExtensionState): Promise { // register "services" - const standardOutputChannel = serviceManager.get(IOutputChannel, STANDARD_OUTPUT_CHANNEL); - // We need to setup this property before any telemetry is sent const fs = serviceManager.get(IFileSystem); await setExtensionInstallTelemetryProperties(fs); @@ -177,8 +174,6 @@ async function activateLegacy(ext: ExtensionState): Promise { serviceManager.get(ITerminalAutoActivation).register(); const pythonSettings = configuration.getSettings(); - activateSimplePythonRefactorProvider(context, standardOutputChannel, serviceContainer); - const sortImports = serviceContainer.get(ISortImportsEditingProvider); sortImports.registerCommands(); diff --git a/src/client/providers/renameProvider.ts b/src/client/providers/renameProvider.ts deleted file mode 100644 index 8a23a4443ee4..000000000000 --- a/src/client/providers/renameProvider.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { - CancellationToken, - OutputChannel, - Position, - ProviderResult, - RenameProvider, - TextDocument, - Uri, - window, - workspace, - WorkspaceEdit, -} from 'vscode'; -import { STANDARD_OUTPUT_CHANNEL } from '../common/constants'; -import { getWorkspaceEditsFromPatch } from '../common/editor'; -import { traceError } from '../common/logger'; -import { IFileSystem } from '../common/platform/types'; -import { IPythonExecutionFactory } from '../common/process/types'; -import { IInstaller, IOutputChannel, Product } from '../common/types'; -import { IServiceContainer } from '../ioc/types'; -import { RefactorProxy } from '../refactor/proxy'; -import { captureTelemetry } from '../telemetry'; -import { EventName } from '../telemetry/constants'; - -type RenameResponse = { - results: [{ diff: string }]; -}; - -export class PythonRenameProvider implements RenameProvider { - private readonly outputChannel: OutputChannel; - constructor(private serviceContainer: IServiceContainer) { - this.outputChannel = serviceContainer.get(IOutputChannel, STANDARD_OUTPUT_CHANNEL); - } - @captureTelemetry(EventName.REFACTOR_RENAME) - public provideRenameEdits( - document: TextDocument, - position: Position, - newName: string, - _token: CancellationToken, - ): ProviderResult { - return workspace.saveAll(false).then(() => { - return this.doRename(document, position, newName); - }); - } - - private doRename(document: TextDocument, position: Position, newName: string): ProviderResult { - if (document.lineAt(position.line).text.match(/^\s*\/\//)) { - return; - } - if (position.character <= 0) { - return; - } - - const range = document.getWordRangeAtPosition(position); - if (!range || range.isEmpty) { - return; - } - const oldName = document.getText(range); - if (oldName === newName) { - return; - } - - let workspaceFolder = workspace.getWorkspaceFolder(document.uri); - if (!workspaceFolder && Array.isArray(workspace.workspaceFolders) && workspace.workspaceFolders.length > 0) { - workspaceFolder = workspace.workspaceFolders[0]; - } - const workspaceRoot = workspaceFolder ? workspaceFolder.uri.fsPath : __dirname; - - const proxy = new RefactorProxy(workspaceRoot, async () => { - const factory = this.serviceContainer.get(IPythonExecutionFactory); - return factory.create({ resource: Uri.file(workspaceRoot) }); - }); - return proxy - .rename(document, newName, document.uri.fsPath, range) - .then((response) => { - const fileDiffs = response.results.map((fileChanges) => fileChanges.diff); - const fs = this.serviceContainer.get(IFileSystem); - return getWorkspaceEditsFromPatch(fileDiffs, workspaceRoot, fs); - }) - .catch((reason) => { - if (reason === 'Not installed') { - const installer = this.serviceContainer.get(IInstaller); - installer - .promptToInstall(Product.rope, document.uri) - .catch((ex) => traceError('Python Extension: promptToInstall', ex)); - return Promise.reject(''); - } else { - window.showErrorMessage(reason); - this.outputChannel.appendLine(reason); - } - return Promise.reject(reason); - }); - } -} diff --git a/src/client/providers/simpleRefactorProvider.ts b/src/client/providers/simpleRefactorProvider.ts deleted file mode 100644 index ed485e084137..000000000000 --- a/src/client/providers/simpleRefactorProvider.ts +++ /dev/null @@ -1,223 +0,0 @@ -import * as vscode from 'vscode'; -import { Commands } from '../common/constants'; -import { getTextEditsFromPatch } from '../common/editor'; -import { traceError } from '../common/logger'; -import { IPythonExecutionFactory } from '../common/process/types'; -import { IInstaller, Product } from '../common/types'; -import { StopWatch } from '../common/utils/stopWatch'; -import { IServiceContainer } from '../ioc/types'; -import { RefactorProxy } from '../refactor/proxy'; -import { sendTelemetryWhenDone } from '../telemetry'; -import { EventName } from '../telemetry/constants'; - -type RenameResponse = { - results: [{ diff: string }]; -}; - -let installer: IInstaller; - -export function activateSimplePythonRefactorProvider( - context: vscode.ExtensionContext, - outputChannel: vscode.OutputChannel, - serviceContainer: IServiceContainer, -) { - installer = serviceContainer.get(IInstaller); - let disposable = vscode.commands.registerCommand(Commands.Refactor_Extract_Variable, () => { - const stopWatch = new StopWatch(); - const promise = extractVariable( - vscode.window.activeTextEditor!, - vscode.window.activeTextEditor!.selection, - outputChannel, - serviceContainer, - ).catch(() => {}); - sendTelemetryWhenDone(EventName.REFACTOR_EXTRACT_VAR, promise, stopWatch); - }); - context.subscriptions.push(disposable); - - disposable = vscode.commands.registerCommand(Commands.Refactor_Extract_Method, () => { - const stopWatch = new StopWatch(); - const promise = extractMethod( - vscode.window.activeTextEditor!, - vscode.window.activeTextEditor!.selection, - outputChannel, - serviceContainer, - ).catch(() => {}); - sendTelemetryWhenDone(EventName.REFACTOR_EXTRACT_FUNCTION, promise, stopWatch); - }); - context.subscriptions.push(disposable); -} - -// Exported for unit testing -export function extractVariable( - textEditor: vscode.TextEditor, - range: vscode.Range, - outputChannel: vscode.OutputChannel, - serviceContainer: IServiceContainer, -): Promise { - let workspaceFolder = vscode.workspace.getWorkspaceFolder(textEditor.document.uri); - if ( - !workspaceFolder && - Array.isArray(vscode.workspace.workspaceFolders) && - vscode.workspace.workspaceFolders.length > 0 - ) { - workspaceFolder = vscode.workspace.workspaceFolders[0]; - } - const workspaceRoot = workspaceFolder ? workspaceFolder.uri.fsPath : __dirname; - - return validateDocumentForRefactor(textEditor).then(() => { - const newName = `newvariable${new Date().getMilliseconds().toString()}`; - const proxy = new RefactorProxy(workspaceRoot, async () => { - const factory = serviceContainer.get(IPythonExecutionFactory); - return factory.create({ resource: vscode.Uri.file(workspaceRoot) }); - }); - const rename = proxy - .extractVariable( - textEditor.document, - newName, - textEditor.document.uri.fsPath, - range, - textEditor.options, - ) - .then((response) => { - return response.results[0].diff; - }); - - return extractName(textEditor, newName, rename, outputChannel); - }); -} - -// Exported for unit testing -export function extractMethod( - textEditor: vscode.TextEditor, - range: vscode.Range, - outputChannel: vscode.OutputChannel, - serviceContainer: IServiceContainer, -): Promise { - let workspaceFolder = vscode.workspace.getWorkspaceFolder(textEditor.document.uri); - if ( - !workspaceFolder && - Array.isArray(vscode.workspace.workspaceFolders) && - vscode.workspace.workspaceFolders.length > 0 - ) { - workspaceFolder = vscode.workspace.workspaceFolders[0]; - } - const workspaceRoot = workspaceFolder ? workspaceFolder.uri.fsPath : __dirname; - - return validateDocumentForRefactor(textEditor).then(() => { - const newName = `newmethod${new Date().getMilliseconds().toString()}`; - const proxy = new RefactorProxy(workspaceRoot, async () => { - const factory = serviceContainer.get(IPythonExecutionFactory); - return factory.create({ resource: vscode.Uri.file(workspaceRoot) }); - }); - const rename = proxy - .extractMethod( - textEditor.document, - newName, - textEditor.document.uri.fsPath, - range, - textEditor.options, - ) - .then((response) => { - return response.results[0].diff; - }); - - return extractName(textEditor, newName, rename, outputChannel); - }); -} - -function validateDocumentForRefactor(textEditor: vscode.TextEditor): Promise { - if (!textEditor.document.isDirty) { - return Promise.resolve(); - } - - return new Promise((resolve, reject) => { - vscode.window.showInformationMessage('Please save changes before refactoring', 'Save').then((item) => { - if (item === 'Save') { - textEditor.document.save().then(resolve, reject); - } else { - return reject(); - } - }); - }); -} - -function extractName( - textEditor: vscode.TextEditor, - newName: string, - renameResponse: Promise, - outputChannel: vscode.OutputChannel, -): Promise { - let changeStartsAtLine = -1; - return renameResponse - .then((diff) => { - if (diff.length === 0) { - return []; - } - return getTextEditsFromPatch(textEditor.document.getText(), diff); - }) - .then((edits) => { - return textEditor.edit((editBuilder) => { - edits.forEach((edit) => { - if (changeStartsAtLine === -1 || changeStartsAtLine > edit.range.start.line) { - changeStartsAtLine = edit.range.start.line; - } - editBuilder.replace(edit.range, edit.newText); - }); - }); - }) - .then((done) => { - if (done && changeStartsAtLine >= 0) { - let newWordPosition: vscode.Position | undefined; - for (let lineNumber = changeStartsAtLine; lineNumber < textEditor.document.lineCount; lineNumber += 1) { - const line = textEditor.document.lineAt(lineNumber); - const indexOfWord = line.text.indexOf(newName); - if (indexOfWord >= 0) { - newWordPosition = new vscode.Position(line.range.start.line, indexOfWord); - break; - } - } - - if (newWordPosition) { - textEditor.selections = [ - new vscode.Selection( - newWordPosition, - new vscode.Position(newWordPosition.line, newWordPosition.character + newName.length), - ), - ]; - textEditor.revealRange( - new vscode.Range(textEditor.selection.start, textEditor.selection.end), - vscode.TextEditorRevealType.Default, - ); - } - return newWordPosition; - } - return null; - }) - .then((newWordPosition) => { - if (newWordPosition) { - return textEditor.document.save().then(() => { - // Now that we have selected the new variable, lets invoke the rename command - return vscode.commands.executeCommand('editor.action.rename'); - }); - } - }) - .catch((error) => { - if (error === 'Not installed') { - installer - .promptToInstall(Product.rope, textEditor.document.uri) - .catch((ex) => traceError('Python Extension: simpleRefactorProvider.promptToInstall', ex)); - return Promise.reject(''); - } - let errorMessage = `${error}`; - if (typeof error === 'string') { - errorMessage = error; - } - if (typeof error === 'object' && error.message) { - errorMessage = error.message; - } - outputChannel.appendLine(`${'#'.repeat(10)}Refactor Output${'#'.repeat(10)}`); - outputChannel.appendLine(`Error in refactoring:\n${errorMessage}`); - vscode.window.showErrorMessage(`Cannot perform refactoring using selected element(s). (${errorMessage})`); - return Promise.reject(error); - }); -} diff --git a/src/client/refactor/proxy.ts b/src/client/refactor/proxy.ts deleted file mode 100644 index 7f89eef54408..000000000000 --- a/src/client/refactor/proxy.ts +++ /dev/null @@ -1,206 +0,0 @@ -import { ChildProcess } from 'child_process'; -import { Disposable, Position, Range, TextDocument, TextEditorOptions, window } from 'vscode'; -import '../common/extensions'; -import { traceError } from '../common/logger'; -import { IS_WINDOWS } from '../common/platform/constants'; -import * as internalScripts from '../common/process/internal/scripts'; -import { IPythonExecutionService } from '../common/process/types'; -import { createDeferred, Deferred } from '../common/utils/async'; -import { getWindowsLineEndingCount } from '../common/utils/text'; - -export class RefactorProxy extends Disposable { - private _process?: ChildProcess; - private _previousOutData: string = ''; - private _previousStdErrData: string = ''; - private _startedSuccessfully: boolean = false; - private _commandResolve?: (value?: any | PromiseLike) => void; - private _commandReject!: (reason?: any) => void; - private initialized!: Deferred; - constructor( - private workspaceRoot: string, - private getPythonExecutionService: () => Promise, - ) { - super(() => {}); - } - - public dispose() { - try { - this._process!.kill(); - } catch (ex) {} - this._process = undefined; - } - private getOffsetAt(document: TextDocument, position: Position): number { - if (!IS_WINDOWS) { - return document.offsetAt(position); - } - - // get line count - // Rope always uses LF, instead of CRLF on windows, funny isn't it - // So for each line, reduce one characer (for CR) - // But Not all Windows users use CRLF - const offset = document.offsetAt(position); - const winEols = getWindowsLineEndingCount(document, offset); - - return offset - winEols; - } - public rename( - document: TextDocument, - name: string, - filePath: string, - range: Range, - options?: TextEditorOptions, - ): Promise { - if (!options) { - options = window.activeTextEditor!.options; - } - const command = { - lookup: 'rename', - file: filePath, - start: this.getOffsetAt(document, range.start).toString(), - id: '1', - name: name, - indent_size: options.tabSize, - }; - - return this.sendCommand(JSON.stringify(command)); - } - public extractVariable( - document: TextDocument, - name: string, - filePath: string, - range: Range, - options?: TextEditorOptions, - ): Promise { - if (!options) { - options = window.activeTextEditor!.options; - } - const command = { - lookup: 'extract_variable', - file: filePath, - start: this.getOffsetAt(document, range.start).toString(), - end: this.getOffsetAt(document, range.end).toString(), - id: '1', - name: name, - indent_size: options.tabSize, - }; - return this.sendCommand(JSON.stringify(command)); - } - public extractMethod( - document: TextDocument, - name: string, - filePath: string, - range: Range, - options?: TextEditorOptions, - ): Promise { - if (!options) { - options = window.activeTextEditor!.options; - } - // Ensure last line is an empty line - if ( - !document.lineAt(document.lineCount - 1).isEmptyOrWhitespace && - range.start.line === document.lineCount - 1 - ) { - return Promise.reject('Missing blank line at the end of document (PEP8).'); - } - const command = { - lookup: 'extract_method', - file: filePath, - start: this.getOffsetAt(document, range.start).toString(), - end: this.getOffsetAt(document, range.end).toString(), - id: '1', - name: name, - indent_size: options.tabSize, - }; - return this.sendCommand(JSON.stringify(command)); - } - private sendCommand(command: string): Promise { - return this.initialize().then(() => { - return new Promise((resolve, reject) => { - this._commandResolve = resolve; - this._commandReject = reject; - this._process!.stdin?.write(command + '\n'); - }); - }); - } - private async initialize(): Promise { - const pythonProc = await this.getPythonExecutionService(); - this.initialized = createDeferred(); - const [args, parse] = internalScripts.refactor(this.workspaceRoot); - const result = pythonProc.execObservable(args, {}); - this._process = result.proc; - result.out.subscribe( - (output) => { - if (output.source === 'stdout') { - if (!this._startedSuccessfully && output.out.startsWith('STARTED')) { - this._startedSuccessfully = true; - return this.initialized.resolve(); - } - this.onData(output.out, parse); - } else { - this.handleStdError(output.out); - } - }, - (error) => this.handleError(error), - ); - - return this.initialized.promise; - } - private handleStdError(data: string) { - // Possible there was an exception in parsing the data returned - // So append the data then parse it - let dataStr = (this._previousStdErrData = this._previousStdErrData + data + ''); - let errorResponse: { message: string; traceback: string; type: string }[]; - try { - errorResponse = dataStr - .split(/\r?\n/g) - .filter((line) => line.length > 0) - .map((resp) => JSON.parse(resp)); - this._previousStdErrData = ''; - } catch (ex) { - traceError(ex); - // Possible we've only received part of the data, hence don't clear previousData - return; - } - if (typeof errorResponse[0].message !== 'string' || errorResponse[0].message.length === 0) { - errorResponse[0].message = errorResponse[0].traceback.splitLines().pop()!; - } - let errorMessage = errorResponse[0].message + '\n' + errorResponse[0].traceback; - - if (this._startedSuccessfully) { - this._commandReject(`Refactor failed. ${errorMessage}`); - } else { - if (typeof errorResponse[0].type === 'string' && errorResponse[0].type === 'ModuleNotFoundError') { - this.initialized.reject('Not installed'); - return; - } - - this.initialized.reject(`Refactor failed. ${errorMessage}`); - } - } - private handleError(error: Error) { - if (this._startedSuccessfully) { - return this._commandReject(error); - } - this.initialized.reject(error); - } - private onData(data: string, parse: (out: string) => object[]) { - if (!this._commandResolve) { - return; - } - - // Possible there was an exception in parsing the data returned - // So append the data then parse it - let dataStr = (this._previousOutData = this._previousOutData + data + ''); - let response: any; - try { - response = parse(dataStr); - this._previousOutData = ''; - } catch (ex) { - // Possible we've only received part of the data, hence don't clear previousData - return; - } - this.dispose(); - this._commandResolve!(response[0]); - this._commandResolve = undefined; - } -} diff --git a/src/test/common/installer.test.ts b/src/test/common/installer.test.ts index fda23dc0ed6f..acb53da521ac 100644 --- a/src/test/common/installer.test.ts +++ b/src/test/common/installer.test.ts @@ -47,7 +47,6 @@ import { ProductInstaller } from '../../client/common/installer/productInstaller import { FormatterProductPathService, LinterProductPathService, - RefactoringLibraryProductPathService, TestFrameworkProductPathService, } from '../../client/common/installer/productPath'; import { ProductService } from '../../client/common/installer/productService'; @@ -190,11 +189,6 @@ suite('Installer', () => { TestFrameworkProductPathService, ProductType.TestFramework, ); - ioc.serviceManager.addSingleton( - IProductPathService, - RefactoringLibraryProductPathService, - ProductType.RefactoringLibrary, - ); ioc.serviceManager.addSingleton(IActiveResourceService, ActiveResourceService); ioc.serviceManager.addSingleton(IInterpreterPathService, InterpreterPathService); ioc.serviceManager.addSingleton(IExtensions, Extensions); diff --git a/src/test/common/installer/installer.invalidPath.unit.test.ts b/src/test/common/installer/installer.invalidPath.unit.test.ts index 29566fa936b1..bbbd7936091b 100644 --- a/src/test/common/installer/installer.invalidPath.unit.test.ts +++ b/src/test/common/installer/installer.invalidPath.unit.test.ts @@ -80,7 +80,6 @@ suite('Module Installer - Invalid Paths', () => { switch (product.value) { case Product.isort: - case Product.rope: case Product.unittest: { return; } diff --git a/src/test/common/installer/productPath.unit.test.ts b/src/test/common/installer/productPath.unit.test.ts index b86d9ea52e29..82755ed16d37 100644 --- a/src/test/common/installer/productPath.unit.test.ts +++ b/src/test/common/installer/productPath.unit.test.ts @@ -14,7 +14,6 @@ import { BaseProductPathsService, FormatterProductPathService, LinterProductPathService, - RefactoringLibraryProductPathService, TestFrameworkProductPathService, } from '../../../client/common/installer/productPath'; import { ProductService } from '../../../client/common/installer/productService'; @@ -164,18 +163,6 @@ suite('Product Path', () => { }); break; } - case ProductType.RefactoringLibrary: { - test(`Ensure path is returned for ${product.name} (${ - resource ? 'With a resource' : 'without a resource' - })`, async () => { - const productPathService = new RefactoringLibraryProductPathService(serviceContainer.object); - - const value = productPathService.getExecutableNameFromSettings(product.value, resource); - const moduleName = productInstaller.translateProductToModuleName(product.value); - expect(value).to.be.equal(moduleName); - }); - break; - } case ProductType.TestFramework: { test(`Ensure path is returned for ${product.name} (${ resource ? 'With a resource' : 'without a resource' diff --git a/src/test/common/installer/serviceRegistry.unit.test.ts b/src/test/common/installer/serviceRegistry.unit.test.ts index de4d117238e6..7cc45c916774 100644 --- a/src/test/common/installer/serviceRegistry.unit.test.ts +++ b/src/test/common/installer/serviceRegistry.unit.test.ts @@ -15,7 +15,6 @@ import { PoetryInstaller } from '../../../client/common/installer/poetryInstalle import { FormatterProductPathService, LinterProductPathService, - RefactoringLibraryProductPathService, TestFrameworkProductPathService, } from '../../../client/common/installer/productPath'; import { ProductService } from '../../../client/common/installer/productService'; @@ -89,13 +88,6 @@ suite('Common installer Service Registry', () => { ProductType.TestFramework, ), ).once(); - verify( - serviceManager.addSingleton( - IProductPathService, - RefactoringLibraryProductPathService, - ProductType.RefactoringLibrary, - ), - ).once(); verify(serviceManager.addSingleton(IWebviewPanelProvider, WebviewPanelProvider)).once(); }); }); diff --git a/src/test/linters/lint.multiroot.test.ts b/src/test/linters/lint.multiroot.test.ts index 771fbf8d0528..1e64d91ff4af 100644 --- a/src/test/linters/lint.multiroot.test.ts +++ b/src/test/linters/lint.multiroot.test.ts @@ -6,7 +6,6 @@ import { PythonSettings } from '../../client/common/configSettings'; import { FormatterProductPathService, LinterProductPathService, - RefactoringLibraryProductPathService, TestFrameworkProductPathService, } from '../../client/common/installer/productPath'; import { ProductService } from '../../client/common/installer/productService'; @@ -67,11 +66,6 @@ suite('Multiroot Linting', () => { TestFrameworkProductPathService, ProductType.TestFramework, ); - ioc.serviceManager.addSingleton( - IProductPathService, - RefactoringLibraryProductPathService, - ProductType.RefactoringLibrary, - ); } async function createLinter(product: Product): Promise { diff --git a/src/test/linters/lint.test.ts b/src/test/linters/lint.test.ts index 5e12e8b94f69..a4d655bdda98 100644 --- a/src/test/linters/lint.test.ts +++ b/src/test/linters/lint.test.ts @@ -10,7 +10,6 @@ import { Product } from '../../client/common/installer/productInstaller'; import { FormatterProductPathService, LinterProductPathService, - RefactoringLibraryProductPathService, TestFrameworkProductPathService, } from '../../client/common/installer/productPath'; import { ProductService } from '../../client/common/installer/productService'; @@ -75,11 +74,6 @@ suite('Linting Settings', () => { TestFrameworkProductPathService, ProductType.TestFramework, ); - ioc.serviceManager.addSingleton( - IProductPathService, - RefactoringLibraryProductPathService, - ProductType.RefactoringLibrary, - ); } async function resetSettings(lintingEnabled = true) { diff --git a/src/test/pythonFiles/refactoring/source folder/with empty line.py b/src/test/pythonFiles/refactoring/source folder/with empty line.py deleted file mode 100644 index 01ed75727900..000000000000 --- a/src/test/pythonFiles/refactoring/source folder/with empty line.py +++ /dev/null @@ -1,8 +0,0 @@ -import os - -def one(): - return True - -def two(): - if one(): - print("A" + one()) diff --git a/src/test/pythonFiles/refactoring/source folder/without empty line.py b/src/test/pythonFiles/refactoring/source folder/without empty line.py deleted file mode 100644 index a449eb106f5c..000000000000 --- a/src/test/pythonFiles/refactoring/source folder/without empty line.py +++ /dev/null @@ -1,8 +0,0 @@ -import os - -def one(): - return True - -def two(): - if one(): - print("A" + one()) \ No newline at end of file diff --git a/src/test/pythonFiles/refactoring/standAlone/refactor.py b/src/test/pythonFiles/refactoring/standAlone/refactor.py deleted file mode 100644 index ee941dd45ebf..000000000000 --- a/src/test/pythonFiles/refactoring/standAlone/refactor.py +++ /dev/null @@ -1,245 +0,0 @@ -# Arguments are: -# 1. Working directory. -# 2. Rope folder - -import io -import sys -import json -import traceback -import rope - -from rope.base import libutils -from rope.refactor.rename import Rename -from rope.refactor.extract import ExtractMethod, ExtractVariable -import rope.base.project -import rope.base.taskhandle - -WORKSPACE_ROOT = sys.argv[1] -ROPE_PROJECT_FOLDER = sys.argv[2] - - -class RefactorProgress(): - """ - Refactor progress information - """ - - def __init__(self, name='Task Name', message=None, percent=0): - self.name = name - self.message = message - self.percent = percent - - -class ChangeType(): - """ - Change Type Enum - """ - EDIT = 0 - NEW = 1 - DELETE = 2 - - -class Change(): - """ - """ - EDIT = 0 - NEW = 1 - DELETE = 2 - - def __init__(self, filePath, fileMode=ChangeType.EDIT, diff=""): - self.filePath = filePath - self.diff = diff - self.fileMode = fileMode - - -class BaseRefactoring(object): - """ - Base class for refactorings - """ - - def __init__(self, project, resource, name="Refactor", progressCallback=None): - self._progressCallback = progressCallback - self._handle = rope.base.taskhandle.TaskHandle(name) - self._handle.add_observer(self._update_progress) - self.project = project - self.resource = resource - self.changes = [] - - def _update_progress(self): - jobset = self._handle.current_jobset() - if jobset and not self._progressCallback is None: - progress = RefactorProgress() - # getting current job set name - if jobset.get_name() is not None: - progress.name = jobset.get_name() - # getting active job name - if jobset.get_active_job_name() is not None: - progress.message = jobset.get_active_job_name() - # adding done percent - percent = jobset.get_percent_done() - if percent is not None: - progress.percent = percent - if not self._progressCallback is None: - self._progressCallback(progress) - - def stop(self): - self._handle.stop() - - def refactor(self): - try: - self.onRefactor() - except rope.base.exceptions.InterruptedTaskError: - # we can ignore this exception, as user has cancelled refactoring - pass - - def onRefactor(self): - """ - To be implemented by each base class - """ - pass - - -class RenameRefactor(BaseRefactoring): - - def __init__(self, project, resource, name="Rename", progressCallback=None, startOffset=None, newName="new_Name"): - BaseRefactoring.__init__(self, project, resource, - name, progressCallback) - self._newName = newName - self.startOffset = startOffset - - def onRefactor(self): - renamed = Rename(self.project, self.resource, self.startOffset) - changes = renamed.get_changes(self._newName, task_handle=self._handle) - for item in changes.changes: - if isinstance(item, rope.base.change.ChangeContents): - self.changes.append( - Change(item.resource.real_path, ChangeType.EDIT, item.get_description())) - else: - raise Exception('Unknown Change') - - -class ExtractVariableRefactor(BaseRefactoring): - - def __init__(self, project, resource, name="Extract Variable", progressCallback=None, startOffset=None, endOffset=None, newName="new_Name", similar=False, global_=False): - BaseRefactoring.__init__(self, project, resource, - name, progressCallback) - self._newName = newName - self._startOffset = startOffset - self._endOffset = endOffset - self._similar = similar - self._global = global_ - - def onRefactor(self): - renamed = ExtractVariable( - self.project, self.resource, self._startOffset, self._endOffset) - changes = renamed.get_changes( - self._newName, self._similar, self._global) - for item in changes.changes: - if isinstance(item, rope.base.change.ChangeContents): - self.changes.append( - Change(item.resource.real_path, ChangeType.EDIT, item.get_description())) - else: - raise Exception('Unknown Change') - - -class ExtractMethodRefactor(ExtractVariableRefactor): - - def __init__(self, project, resource, name="Extract Method", progressCallback=None, startOffset=None, endOffset=None, newName="new_Name", similar=False, global_=False): - ExtractVariableRefactor.__init__(self, project, resource, - name, progressCallback, startOffset=startOffset, endOffset=endOffset, newName=newName, similar=similar, global_=global_) - def onRefactor(self): - renamed = ExtractMethod( - self.project, self.resource, self._startOffset, self._endOffset) - changes = renamed.get_changes( - self._newName, self._similar, self._global) - for item in changes.changes: - if isinstance(item, rope.base.change.ChangeContents): - self.changes.append( - Change(item.resource.real_path, ChangeType.EDIT, item.get_description())) - else: - raise Exception('Unknown Change') - - -class RopeRefactoring(object): - - def __init__(self): - self.default_sys_path = sys.path - self._input = io.open(sys.stdin.fileno(), encoding='utf-8') - - def _extractVariable(self, filePath, start, end, newName): - """ - Extracts a variable - """ - project = rope.base.project.Project(WORKSPACE_ROOT, ropefolder=ROPE_PROJECT_FOLDER, save_history=False) - resourceToRefactor = libutils.path_to_resource(project, filePath) - refactor = ExtractVariableRefactor(project, resourceToRefactor, startOffset=start, endOffset=end, newName=newName) - refactor.refactor() - changes = refactor.changes - project.close() - valueToReturn = [] - for change in changes: - valueToReturn.append({'diff':change.diff}) - return valueToReturn - - def _extractMethod(self, filePath, start, end, newName): - """ - Extracts a method - """ - project = rope.base.project.Project(WORKSPACE_ROOT, ropefolder=ROPE_PROJECT_FOLDER, save_history=False) - resourceToRefactor = libutils.path_to_resource(project, filePath) - refactor = ExtractMethodRefactor(project, resourceToRefactor, startOffset=start, endOffset=end, newName=newName) - refactor.refactor() - changes = refactor.changes - project.close() - valueToReturn = [] - for change in changes: - valueToReturn.append({'diff':change.diff}) - return valueToReturn - - def _serialize(self, identifier, results): - """ - Serializes the refactor results - """ - return json.dumps({'id': identifier, 'results': results}) - - def _deserialize(self, request): - """Deserialize request from VSCode. - - Args: - request: String with raw request from VSCode. - - Returns: - Python dictionary with request data. - """ - return json.loads(request) - - def _process_request(self, request): - """Accept serialized request from VSCode and write response. - """ - request = self._deserialize(request) - lookup = request.get('lookup', '') - - if lookup == '': - pass - elif lookup == 'extract_variable': - changes = self._extractVariable(request['file'], int(request['start']), int(request['end']), request['name']) - return self._write_response(self._serialize(request['id'], changes)) - elif lookup == 'extract_method': - changes = self._extractMethod(request['file'], int(request['start']), int(request['end']), request['name']) - return self._write_response(self._serialize(request['id'], changes)) - - def _write_response(self, response): - sys.stdout.write(response + '\n') - sys.stdout.flush() - - def watch(self): - self._write_response("STARTED") - while True: - try: - self._process_request(self._input.readline()) - except Exception as ex: - message = ex.message + ' \n' + traceback.format_exc() - sys.stderr.write(str(len(message)) + ':' + message) - sys.stderr.flush() - -if __name__ == '__main__': - RopeRefactoring().watch() diff --git a/src/test/refactor/extension.refactor.extract.method.test.ts b/src/test/refactor/extension.refactor.extract.method.test.ts deleted file mode 100644 index 6fe8b13c57e6..000000000000 --- a/src/test/refactor/extension.refactor.extract.method.test.ts +++ /dev/null @@ -1,201 +0,0 @@ -import * as assert from 'assert'; -import * as fs from 'fs-extra'; -import * as path from 'path'; -import { instance, mock } from 'ts-mockito'; -import { - commands, - Position, - Range, - Selection, - TextEditorCursorStyle, - TextEditorLineNumbersStyle, - TextEditorOptions, - Uri, - window, - workspace, -} from 'vscode'; -import { getTextEditsFromPatch } from '../../client/common/editor'; -import { IPythonExecutionFactory, IPythonExecutionService } from '../../client/common/process/types'; -import { ICondaService, IInterpreterService } from '../../client/interpreter/contracts'; -import { InterpreterService } from '../../client/interpreter/interpreterService'; -import { extractMethod } from '../../client/providers/simpleRefactorProvider'; -import { CondaService } from '../../client/pythonEnvironments/discovery/locators/services/condaService'; -import { RefactorProxy } from '../../client/refactor/proxy'; -import { UnitTestIocContainer } from '../testing/serviceRegistry'; -import { closeActiveWindows, initialize, initializeTest } from './../initialize'; -import { MockOutputChannel } from './../mockClasses'; - -const refactorSourceFile = path.join( - __dirname, - '..', - '..', - '..', - 'src', - 'test', - 'pythonFiles', - 'refactoring', - 'standAlone', - 'refactor.py', -); -const refactorTargetFileDir = path.join( - __dirname, - '..', - '..', - '..', - 'out', - 'test', - 'pythonFiles', - 'refactoring', - 'standAlone', -); - -interface RenameResponse { - results: [{ diff: string }]; -} - -suite('Method Extraction', () => { - // Hack hac hack - const oldExecuteCommand = commands.executeCommand; - const options: TextEditorOptions = { - cursorStyle: TextEditorCursorStyle.Line, - insertSpaces: true, - lineNumbers: TextEditorLineNumbersStyle.Off, - tabSize: 4, - }; - let refactorTargetFile = ''; - let ioc: UnitTestIocContainer; - suiteSetup(initialize); - suiteTeardown(() => { - commands.executeCommand = oldExecuteCommand; - return closeActiveWindows(); - }); - setup(async () => { - await initializeDI(); - refactorTargetFile = path.join(refactorTargetFileDir, `refactor${new Date().getTime()}.py`); - fs.copySync(refactorSourceFile, refactorTargetFile, { overwrite: true }); - await initializeTest(); - (commands as any).executeCommand = (_cmd: any) => Promise.resolve(); - }); - teardown(async () => { - commands.executeCommand = oldExecuteCommand; - try { - await fs.unlink(refactorTargetFile); - } catch {} - await closeActiveWindows(); - }); - async function initializeDI() { - ioc = new UnitTestIocContainer(); - ioc.registerCommonTypes(); - ioc.registerProcessTypes(); - ioc.registerVariableTypes(); - ioc.registerInterpreterStorageTypes(); - await ioc.registerMockInterpreterTypes(); - ioc.serviceManager.rebindInstance(ICondaService, instance(mock(CondaService))); - ioc.serviceManager.rebindInstance(IInterpreterService, instance(mock(InterpreterService))); - } - function createPythonExecGetter(workspaceRoot: string): () => Promise { - return async () => { - const factory = ioc.serviceContainer.get(IPythonExecutionFactory); - return factory.create({ resource: Uri.file(workspaceRoot) }); - }; - } - - async function testingMethodExtraction(shouldError: boolean, startPos: Position, endPos: Position): Promise { - const rangeOfTextToExtract = new Range(startPos, endPos); - const workspaceRoot = path.dirname(refactorTargetFile); - const proxy = new RefactorProxy(workspaceRoot, createPythonExecGetter(workspaceRoot)); - - const DIFF = `--- a/refactor.py\n+++ b/refactor.py\n@@ -237,9 +237,12 @@\n try:\n self._process_request(self._input.readline())\n except Exception as ex:\n- message = ex.message + ' \\n' + traceback.format_exc()\n- sys.stderr.write(str(len(message)) + ':' + message)\n- sys.stderr.flush()\n+ self.myNewMethod(ex)\n+\n+ def myNewMethod(self, ex):\n+ message = ex.message + ' \\n' + traceback.format_exc()\n+ sys.stderr.write(str(len(message)) + ':' + message)\n+ sys.stderr.flush()\n \n if __name__ == '__main__':\n RopeRefactoring().watch()\n`; - const mockTextDoc = await workspace.openTextDocument(refactorTargetFile); - const expectedTextEdits = getTextEditsFromPatch(mockTextDoc.getText(), DIFF); - try { - const response = await proxy.extractMethod( - mockTextDoc, - 'myNewMethod', - refactorTargetFile, - rangeOfTextToExtract, - options, - ); - if (shouldError) { - assert.fail('No error', 'Error', 'Extraction should fail with an error', ''); - } - const textEdits = getTextEditsFromPatch(mockTextDoc.getText(), DIFF); - assert.equal(response.results.length, 1, 'Invalid number of items in response'); - assert.equal(textEdits.length, expectedTextEdits.length, 'Invalid number of Text Edits'); - textEdits.forEach((edit) => { - const foundEdit = expectedTextEdits.filter( - (item) => item.newText === edit.newText && item.range.isEqual(edit.range), - ); - assert.equal(foundEdit.length, 1, 'Edit not found'); - }); - } catch (error) { - if (!shouldError) { - // Wait a minute this shouldn't work, what's going on - assert.equal('Error', 'No error', `${error}`); - } - } - } - - test('Extract Method', async () => { - const startPos = new Position(239, 0); - const endPos = new Position(241, 35); - await testingMethodExtraction(false, startPos, endPos); - }); - - test('Extract Method will fail if complete statements are not selected', async () => { - const startPos = new Position(239, 30); - const endPos = new Position(241, 35); - await testingMethodExtraction(true, startPos, endPos); - }); - - async function testingMethodExtractionEndToEnd( - shouldError: boolean, - startPos: Position, - endPos: Position, - ): Promise { - const ch = new MockOutputChannel('Python'); - const rangeOfTextToExtract = new Range(startPos, endPos); - - const textDocument = await workspace.openTextDocument(refactorTargetFile); - const editor = await window.showTextDocument(textDocument); - - editor.selections = [new Selection(rangeOfTextToExtract.start, rangeOfTextToExtract.end)]; - editor.selection = new Selection(rangeOfTextToExtract.start, rangeOfTextToExtract.end); - - try { - await extractMethod(editor, rangeOfTextToExtract, ch, ioc.serviceContainer); - if (shouldError) { - assert.fail('No error', 'Error', 'Extraction should fail with an error', ''); - } - - const newMethodRefLine = textDocument.lineAt(editor.selection.start); - assert.equal(ch.output.length, 0, 'Output channel is not empty'); - assert.equal( - textDocument - .lineAt(newMethodRefLine.lineNumber + 2) - .text.trim() - .indexOf('def newmethod'), - 0, - 'New Method not created', - ); - assert.equal(newMethodRefLine.text.trim().startsWith('self.newmethod'), true, 'New Method not being used'); - } catch (error) { - if (!shouldError) { - assert.equal('Error', 'No error', `${error}`); - } - } - } - - // This test fails on linux (text document not getting updated in time) - test('Extract Method (end to end)', async () => { - const startPos = new Position(239, 0); - const endPos = new Position(241, 35); - await testingMethodExtractionEndToEnd(false, startPos, endPos); - }); - - test('Extract Method will fail if complete statements are not selected', async () => { - const startPos = new Position(239, 30); - const endPos = new Position(241, 35); - await testingMethodExtractionEndToEnd(true, startPos, endPos); - }); -}); diff --git a/src/test/refactor/extension.refactor.extract.var.test.ts b/src/test/refactor/extension.refactor.extract.var.test.ts deleted file mode 100644 index 737d1eae8026..000000000000 --- a/src/test/refactor/extension.refactor.extract.var.test.ts +++ /dev/null @@ -1,202 +0,0 @@ -import * as assert from 'assert'; -import * as fs from 'fs-extra'; -import * as path from 'path'; -import { - commands, - Position, - Range, - Selection, - TextEditorCursorStyle, - TextEditorLineNumbersStyle, - TextEditorOptions, - Uri, - window, - workspace, -} from 'vscode'; -import { getTextEditsFromPatch } from '../../client/common/editor'; -import { IPythonExecutionFactory, IPythonExecutionService } from '../../client/common/process/types'; -import { extractVariable } from '../../client/providers/simpleRefactorProvider'; -import { RefactorProxy } from '../../client/refactor/proxy'; -import { isPythonVersion } from '../common'; -import { UnitTestIocContainer } from '../testing/serviceRegistry'; -import { closeActiveWindows, initialize, initializeTest, IS_CI_SERVER } from './../initialize'; -import { MockOutputChannel } from './../mockClasses'; - -const refactorSourceFile = path.join( - __dirname, - '..', - '..', - '..', - 'src', - 'test', - 'pythonFiles', - 'refactoring', - 'standAlone', - 'refactor.py', -); -const refactorTargetFileDir = path.join( - __dirname, - '..', - '..', - '..', - 'out', - 'test', - 'pythonFiles', - 'refactoring', - 'standAlone', -); - -interface RenameResponse { - results: [{ diff: string }]; -} - -suite('Variable Extraction', () => { - // Hack hac hack - const oldExecuteCommand = commands.executeCommand; - const options: TextEditorOptions = { - cursorStyle: TextEditorCursorStyle.Line, - insertSpaces: true, - lineNumbers: TextEditorLineNumbersStyle.Off, - tabSize: 4, - }; - let refactorTargetFile = ''; - let ioc: UnitTestIocContainer; - suiteSetup(initialize); - suiteTeardown(() => { - commands.executeCommand = oldExecuteCommand; - return closeActiveWindows(); - }); - setup(async () => { - await initializeDI(); - refactorTargetFile = path.join(refactorTargetFileDir, `refactor${new Date().getTime()}.py`); - fs.copySync(refactorSourceFile, refactorTargetFile, { overwrite: true }); - await initializeTest(); - (commands).executeCommand = (_cmd: any) => Promise.resolve(); - }); - teardown(async () => { - commands.executeCommand = oldExecuteCommand; - try { - await fs.unlink(refactorTargetFile); - } catch {} - await closeActiveWindows(); - }); - async function initializeDI() { - ioc = new UnitTestIocContainer(); - ioc.registerCommonTypes(); - ioc.registerProcessTypes(); - ioc.registerVariableTypes(); - ioc.registerInterpreterStorageTypes(); - await ioc.registerMockInterpreterTypes(); - } - function createPythonExecGetter(workspaceRoot: string): () => Promise { - return async () => { - const factory = ioc.serviceContainer.get(IPythonExecutionFactory); - return factory.create({ resource: Uri.file(workspaceRoot) }); - }; - } - - async function testingVariableExtraction( - shouldError: boolean, - startPos: Position, - endPos: Position, - ): Promise { - const rangeOfTextToExtract = new Range(startPos, endPos); - const workspaceRoot = path.dirname(refactorTargetFile); - const proxy = new RefactorProxy(workspaceRoot, createPythonExecGetter(workspaceRoot)); - - const DIFF = - '--- a/refactor.py\n+++ b/refactor.py\n@@ -232,7 +232,8 @@\n sys.stdout.flush()\n \n def watch(self):\n- self._write_response("STARTED")\n+ myNewVariable = "STARTED"\n+ self._write_response(myNewVariable)\n while True:\n try:\n self._process_request(self._input.readline())\n'; - const mockTextDoc = await workspace.openTextDocument(refactorTargetFile); - const expectedTextEdits = getTextEditsFromPatch(mockTextDoc.getText(), DIFF); - try { - const response = await proxy.extractVariable( - mockTextDoc, - 'myNewVariable', - refactorTargetFile, - rangeOfTextToExtract, - options, - ); - if (shouldError) { - assert.fail('No error', 'Error', 'Extraction should fail with an error', ''); - } - const textEdits = getTextEditsFromPatch(mockTextDoc.getText(), DIFF); - assert.equal(response.results.length, 1, 'Invalid number of items in response'); - assert.equal(textEdits.length, expectedTextEdits.length, 'Invalid number of Text Edits'); - textEdits.forEach((edit) => { - const foundEdit = expectedTextEdits.filter( - (item) => item.newText === edit.newText && item.range.isEqual(edit.range), - ); - assert.equal(foundEdit.length, 1, 'Edit not found'); - }); - } catch (error) { - if (!shouldError) { - assert.equal('Error', 'No error', `${error}`); - } - } - } - - test('Extract Variable', async function () { - if (isPythonVersion('3.7')) { - return this.skip(); - } else { - const startPos = new Position(234, 29); - const endPos = new Position(234, 38); - await testingVariableExtraction(false, startPos, endPos); - } - }); - - test('Extract Variable fails if whole string not selected', async () => { - const startPos = new Position(234, 20); - const endPos = new Position(234, 38); - await testingVariableExtraction(true, startPos, endPos); - }); - - async function testingVariableExtractionEndToEnd( - shouldError: boolean, - startPos: Position, - endPos: Position, - ): Promise { - const ch = new MockOutputChannel('Python'); - const rangeOfTextToExtract = new Range(startPos, endPos); - - const textDocument = await workspace.openTextDocument(refactorTargetFile); - const editor = await window.showTextDocument(textDocument); - - editor.selections = [new Selection(rangeOfTextToExtract.start, rangeOfTextToExtract.end)]; - editor.selection = new Selection(rangeOfTextToExtract.start, rangeOfTextToExtract.end); - try { - await extractVariable(editor, rangeOfTextToExtract, ch, ioc.serviceContainer); - if (shouldError) { - assert.fail('No error', 'Error', 'Extraction should fail with an error', ''); - } - assert.equal(ch.output.length, 0, 'Output channel is not empty'); - - const newVarDefLine = textDocument.lineAt(editor.selection.start); - const newVarRefLine = textDocument.lineAt(newVarDefLine.lineNumber + 1); - - assert.equal(newVarDefLine.text.trim().indexOf('newvariable'), 0, 'New Variable not created'); - assert.equal(newVarDefLine.text.trim().endsWith('= "STARTED"'), true, 'Started Text Assigned to variable'); - assert.equal(newVarRefLine.text.indexOf('(newvariable') >= 0, true, 'New Variable not being used'); - } catch (error) { - if (!shouldError) { - assert.fail('Error', 'No error', `${error}`); - } - } - } - - // This test fails on linux (text document not getting updated in time) - test('Extract Variable (end to end)', async function () { - if (!IS_CI_SERVER) { - return this.skip(); - } - const startPos = new Position(234, 29); - const endPos = new Position(234, 38); - await testingVariableExtractionEndToEnd(false, startPos, endPos); - }); - - test('Extract Variable fails if whole string not selected (end to end)', async () => { - const startPos = new Position(234, 20); - const endPos = new Position(234, 38); - await testingVariableExtractionEndToEnd(true, startPos, endPos); - }); -}); diff --git a/src/test/refactor/rename.test.ts b/src/test/refactor/rename.test.ts deleted file mode 100644 index ebd74f965c9c..000000000000 --- a/src/test/refactor/rename.test.ts +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -'use strict'; - -import { expect } from 'chai'; -import { EOL } from 'os'; -import * as path from 'path'; -import { instance, mock } from 'ts-mockito'; -import * as typeMoq from 'typemoq'; -import { - Range, - TextEditorCursorStyle, - TextEditorLineNumbersStyle, - TextEditorOptions, - Uri, - window, - workspace, -} from 'vscode'; -import { EXTENSION_ROOT_DIR } from '../../client/common/constants'; -import { DiscoveryVariants } from '../../client/common/experiments/groups'; -import '../../client/common/extensions'; -import { BufferDecoder } from '../../client/common/process/decoder'; -import { ProcessService } from '../../client/common/process/proc'; -import { PythonExecutionFactory } from '../../client/common/process/pythonExecutionFactory'; -import { - IProcessLogger, - IProcessServiceFactory, - IPythonExecutionFactory, - IPythonExecutionService, -} from '../../client/common/process/types'; -import { IConfigurationService, IExperimentService, IPythonSettings } from '../../client/common/types'; -import { IEnvironmentActivationService } from '../../client/interpreter/activation/types'; -import { IComponentAdapter, ICondaService, IInterpreterService } from '../../client/interpreter/contracts'; -import { IServiceContainer } from '../../client/ioc/types'; -import { RefactorProxy } from '../../client/refactor/proxy'; -import { PYTHON_PATH } from '../common'; -import { closeActiveWindows, initialize, initializeTest } from '../initialize'; - -type RenameResponse = { - results: [{ diff: string }]; -}; - -suite('Refactor Rename', () => { - const options: TextEditorOptions = { - cursorStyle: TextEditorCursorStyle.Line, - insertSpaces: true, - lineNumbers: TextEditorLineNumbersStyle.Off, - tabSize: 4, - }; - let pythonSettings: typeMoq.IMock; - let serviceContainer: typeMoq.IMock; - suiteSetup(initialize); - setup(async () => { - pythonSettings = typeMoq.Mock.ofType(); - pythonSettings.setup((p) => p.pythonPath).returns(() => PYTHON_PATH); - const configService = typeMoq.Mock.ofType(); - configService.setup((c) => c.getSettings(typeMoq.It.isAny())).returns(() => pythonSettings.object); - const condaService = typeMoq.Mock.ofType(); - const experimentService = typeMoq.Mock.ofType(); - const processServiceFactory = typeMoq.Mock.ofType(); - processServiceFactory - .setup((p) => p.create(typeMoq.It.isAny())) - .returns(() => Promise.resolve(new ProcessService(new BufferDecoder()))); - const interpreterService = typeMoq.Mock.ofType(); - interpreterService.setup((i) => i.hasInterpreters).returns(() => Promise.resolve(true)); - const envActivationService = typeMoq.Mock.ofType(); - envActivationService - .setup((e) => e.getActivatedEnvironmentVariables(typeMoq.It.isAny())) - .returns(() => Promise.resolve(undefined)); - envActivationService - .setup((e) => e.getActivatedEnvironmentVariables(typeMoq.It.isAny(), typeMoq.It.isAny())) - .returns(() => Promise.resolve(undefined)); - envActivationService - .setup((e) => - e.getActivatedEnvironmentVariables(typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny()), - ) - .returns(() => Promise.resolve(undefined)); - serviceContainer = typeMoq.Mock.ofType(); - serviceContainer - .setup((s) => s.get(typeMoq.It.isValue(IConfigurationService), typeMoq.It.isAny())) - .returns(() => configService.object); - serviceContainer - .setup((s) => s.get(typeMoq.It.isValue(IProcessServiceFactory), typeMoq.It.isAny())) - .returns(() => processServiceFactory.object); - serviceContainer - .setup((s) => s.get(typeMoq.It.isValue(IInterpreterService), typeMoq.It.isAny())) - .returns(() => interpreterService.object); - serviceContainer - .setup((s) => s.get(typeMoq.It.isValue(IEnvironmentActivationService), typeMoq.It.isAny())) - .returns(() => envActivationService.object); - - const pyenvs: IComponentAdapter = mock(); - - experimentService - .setup((e) => e.inExperiment(DiscoveryVariants.discoverWithFileWatching)) - .returns(() => Promise.resolve(false)); - - serviceContainer - .setup((s) => s.get(typeMoq.It.isValue(IPythonExecutionFactory), typeMoq.It.isAny())) - .returns( - () => - new PythonExecutionFactory( - serviceContainer.object, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - undefined as any, - processServiceFactory.object, - configService.object, - condaService.object, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - undefined as any, - instance(pyenvs), - experimentService.object, - ), - ); - const processLogger = typeMoq.Mock.ofType(); - processLogger - .setup((p) => p.logProcess(typeMoq.It.isAny(), typeMoq.It.isAny(), typeMoq.It.isAny())) - .returns(() => { - /** No body */ - }); - serviceContainer - .setup((s) => s.get(typeMoq.It.isValue(IProcessLogger), typeMoq.It.isAny())) - .returns(() => processLogger.object); - await initializeTest(); - }); - teardown(closeActiveWindows); - suiteTeardown(closeActiveWindows); - function createPythonExecGetter(workspaceRoot: string): () => Promise { - return async () => { - const factory = serviceContainer.object.get(IPythonExecutionFactory); - return factory.create({ resource: Uri.file(workspaceRoot) }); - }; - } - - test('Rename function in source without a trailing empty line', async () => { - const sourceFile = path.join( - EXTENSION_ROOT_DIR, - 'src', - 'test', - 'pythonFiles', - 'refactoring', - 'source folder', - 'without empty line.py', - ); - const expectedDiff = `--- a/${path.basename(sourceFile)}${EOL}+++ b/${path.basename( - sourceFile, - )}${EOL}@@ -1,8 +1,8 @@${EOL} import os${EOL} ${EOL}-def one():${EOL}+def three():${EOL} return True${EOL} ${EOL} def two():${EOL}- if one():${EOL}- print(\"A\" + one())${EOL}+ if three():${EOL}+ print(\"A\" + three())${EOL}`.splitLines( - { removeEmptyEntries: false, trim: false }, - ); - const workspaceRoot = path.dirname(sourceFile); - - const proxy = new RefactorProxy(workspaceRoot, createPythonExecGetter(workspaceRoot)); - const textDocument = await workspace.openTextDocument(sourceFile); - await window.showTextDocument(textDocument); - - const response = await proxy.rename( - textDocument, - 'three', - sourceFile, - new Range(7, 20, 7, 23), - options, - ); - expect(response.results).to.be.lengthOf(1); - expect(response.results[0].diff.splitLines({ removeEmptyEntries: false, trim: false })).to.be.deep.equal( - expectedDiff, - ); - }); - test('Rename function in source with a trailing empty line', async () => { - const sourceFile = path.join( - EXTENSION_ROOT_DIR, - 'src', - 'test', - 'pythonFiles', - 'refactoring', - 'source folder', - 'with empty line.py', - ); - const expectedDiff = `--- a/${path.basename(sourceFile)}${EOL}+++ b/${path.basename( - sourceFile, - )}${EOL}@@ -1,8 +1,8 @@${EOL} import os${EOL} ${EOL}-def one():${EOL}+def three():${EOL} return True${EOL} ${EOL} def two():${EOL}- if one():${EOL}- print(\"A\" + one())${EOL}+ if three():${EOL}+ print(\"A\" + three())${EOL}`.splitLines( - { removeEmptyEntries: false, trim: false }, - ); - const workspaceRoot = path.dirname(sourceFile); - - const proxy = new RefactorProxy(workspaceRoot, createPythonExecGetter(workspaceRoot)); - const textDocument = await workspace.openTextDocument(sourceFile); - await window.showTextDocument(textDocument); - - const response = await proxy.rename( - textDocument, - 'three', - sourceFile, - new Range(7, 20, 7, 23), - options, - ); - expect(response.results).to.be.lengthOf(1); - expect(response.results[0].diff.splitLines({ removeEmptyEntries: false, trim: false })).to.be.deep.equal( - expectedDiff, - ); - }); -}); From 8e2da37a2ae1464974cfc415038fed2dc863ec85 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Tue, 4 May 2021 09:57:37 -0700 Subject: [PATCH 03/13] Remove default pylint when using jedi (#16074) * Remove default pylint when using jedi * Remove pylint minimal checkers * Remove more pylint config * Restore missed configuration file names * More linting clean up * Fix tests --- .github/test_plan.md | 28 +- package.json | 30 +- src/client/common/configSettings.ts | 1 - src/client/common/types.ts | 1 - src/client/linters/linterAvailability.ts | 22 +- src/client/linters/linterCommands.ts | 4 +- src/client/linters/linterInfo.ts | 37 -- src/client/linters/linterManager.ts | 46 +- src/client/linters/lintingEngine.ts | 4 +- src/client/linters/pylint.ts | 139 +----- src/client/linters/types.ts | 4 +- src/client/providers/linterProvider.ts | 2 +- src/test/.vscode/settings.json | 4 +- src/test/linters/common.ts | 4 +- src/test/linters/lint.args.test.ts | 2 +- src/test/linters/lint.functional.test.ts | 4 - src/test/linters/lint.manager.unit.test.ts | 110 ----- src/test/linters/lint.multilinter.test.ts | 6 +- src/test/linters/lint.provider.test.ts | 2 +- src/test/linters/lint.test.ts | 10 +- src/test/linters/lint.unit.test.ts | 1 - src/test/linters/lintengine.test.ts | 5 +- .../linters/linter.availability.unit.test.ts | 84 +--- src/test/linters/linterCommands.unit.test.ts | 10 +- src/test/linters/linterManager.unit.test.ts | 23 +- src/test/linters/linterinfo.unit.test.ts | 114 ----- src/test/linters/pylint.test.ts | 141 +------ src/test/linters/pylint.unit.test.ts | 397 +----------------- src/test/mockClasses.ts | 1 - 29 files changed, 47 insertions(+), 1189 deletions(-) delete mode 100644 src/test/linters/lint.manager.unit.test.ts delete mode 100644 src/test/linters/linterinfo.unit.test.ts diff --git a/.github/test_plan.md b/.github/test_plan.md index 3f43f8d08d59..4f8af484b383 100644 --- a/.github/test_plan.md +++ b/.github/test_plan.md @@ -141,37 +141,15 @@ SPAM='hello ${WHO}' - [ ] Create a virtual environment - [ ] Install `requests` into the virtual environment -#### Pylint/default linting - -[Prompting to install Pylint is covered under `Environments` above] - -For testing the disablement of the default linting rules for Pylint: - -```ini -# pylintrc -[MESSAGES CONTROL] -enable=bad-names -``` - -```python3 -# example.py -foo = 42 # Marked as a disallowed name. -``` - -- [ ] Installation via the prompt installs Pylint as appropriate - - [ ] Uses `--user` for system-install of Python - - [ ] Installs into a virtual environment environment directly -- [ ] Pylint works -- [ ] `"python.linting.pylintUseMinimalCheckers": false` turns off the default rules w/ no `pylintrc` file present -- [ ] The existence of a `pylintrc` file turns off the default rules - -#### Other linters +#### Linting **Note**: - You can use the `Run Linting` command to run a newly installed linter - When the extension installs a new linter, it turns off all other linters +- [ ] pylint works + - [ ] `Select linter` lists the linter and installs it if necessary - [ ] flake8 works - [ ] `Select linter` lists the linter and installs it if necessary - [ ] mypy works diff --git a/package.json b/package.json index 5738c7aeebed..306a0f69cd41 100644 --- a/package.json +++ b/package.json @@ -343,16 +343,6 @@ "command": "python.launchTensorBoard", "title": "%python.command.python.launchTensorBoard.title%" }, - { - "category": "Python Refactor", - "command": "python.refactorExtractMethod", - "title": "%python.command.python.refactorExtractMethod.title%" - }, - { - "category": "Python Refactor", - "command": "python.refactorExtractVariable", - "title": "%python.command.python.refactorExtractVariable.title%" - }, { "category": "Python", "command": "python.refreshTensorBoard", @@ -1070,7 +1060,7 @@ "type": "string" }, "python.linting.pylintEnabled": { - "default": true, + "default": false, "description": "Whether to lint Python files using pylint.", "scope": "resource", "type": "boolean" @@ -1081,12 +1071,6 @@ "scope": "resource", "type": "string" }, - "python.linting.pylintUseMinimalCheckers": { - "default": true, - "description": "Whether to run Pylint with minimal set of rules.", - "scope": "resource", - "type": "boolean" - }, "python.logging.level": { "default": "error", "description": "The logging level the extension logs at, defaults to 'error'", @@ -1797,18 +1781,6 @@ "group": "Python", "when": "editorFocus && editorLangId == python" }, - { - "command": "python.refactorExtractMethod", - "group": "Refactor", - "title": "Refactor: Extract Method", - "when": "editorHasSelection && editorLangId == python && !notebookEditorFocused" - }, - { - "command": "python.refactorExtractVariable", - "group": "Refactor", - "title": "Refactor: Extract Variable", - "when": "editorHasSelection && editorLangId == python && !notebookEditorFocused" - }, { "command": "python.sortImports", "group": "Refactor", diff --git a/src/client/common/configSettings.ts b/src/client/common/configSettings.ts index ea32412473ac..33c97b8dd54c 100644 --- a/src/client/common/configSettings.ts +++ b/src/client/common/configSettings.ts @@ -405,7 +405,6 @@ export class PythonSettings implements IPythonSettings { error: DiagnosticSeverity.Error, note: DiagnosticSeverity.Hint, }, - pylintUseMinimalCheckers: false, }; this.linting.pylintPath = getAbsolutePath(systemVariables.resolveAny(this.linting.pylintPath), workspaceRoot); this.linting.flake8Path = getAbsolutePath(systemVariables.resolveAny(this.linting.flake8Path), workspaceRoot); diff --git a/src/client/common/types.ts b/src/client/common/types.ts index c940fc63cae3..1fa3542a7b36 100644 --- a/src/client/common/types.ts +++ b/src/client/common/types.ts @@ -266,7 +266,6 @@ export interface ILintingSettings { banditEnabled: boolean; banditArgs: string[]; banditPath: string; - readonly pylintUseMinimalCheckers: boolean; } export interface IFormattingSettings { readonly provider: string; diff --git a/src/client/linters/linterAvailability.ts b/src/client/linters/linterAvailability.ts index 2f60096ea00e..73e9a01d2c9f 100644 --- a/src/client/linters/linterAvailability.ts +++ b/src/client/linters/linterAvailability.ts @@ -6,11 +6,10 @@ import { inject, injectable } from 'inversify'; import * as path from 'path'; import { Uri } from 'vscode'; -import { LanguageServerType } from '../activation/types'; import { IApplicationShell, IWorkspaceService } from '../common/application/types'; import '../common/extensions'; import { IFileSystem } from '../common/platform/types'; -import { IConfigurationService, IPersistentStateFactory, Resource } from '../common/types'; +import { IPersistentStateFactory, Resource } from '../common/types'; import { Common, Linters } from '../common/utils/localize'; import { sendTelemetryEvent } from '../telemetry'; import { EventName } from '../telemetry/constants'; @@ -23,7 +22,6 @@ export class AvailableLinterActivator implements IAvailableLinterActivator { @inject(IApplicationShell) private appShell: IApplicationShell, @inject(IFileSystem) private fs: IFileSystem, @inject(IWorkspaceService) private workspaceService: IWorkspaceService, - @inject(IConfigurationService) private configService: IConfigurationService, @inject(IPersistentStateFactory) private persistentStateFactory: IPersistentStateFactory, ) {} @@ -38,11 +36,6 @@ export class AvailableLinterActivator implements IAvailableLinterActivator { * @returns true if configuration was updated in any way, false otherwise. */ public async promptIfLinterAvailable(linterInfo: ILinterInfo, resource?: Uri): Promise { - // Has the feature been enabled yet? - if (!this.isFeatureEnabled) { - return false; - } - // Has the linter in question has been configured explicitly? If so, no need to continue. if (!this.isLinterUsingDefaultConfiguration(linterInfo, resource)) { return false; @@ -128,17 +121,4 @@ export class AvailableLinterActivator implements IAvailableLinterActivator { pe!.globalValue === undefined && pe!.workspaceValue === undefined && pe!.workspaceFolderValue === undefined ); } - - /** - * Check if this feature is enabled yet. - * - * This is a feature of the vscode-python extension that will become enabled once the - * Python Language Server becomes the default, replacing Jedi as the default. Testing - * the global default setting for `"python.languageServer": !Jedi` enables it. - * - * @returns true if the global default for python.languageServer is not Jedi. - */ - public get isFeatureEnabled(): boolean { - return this.configService.getSettings().languageServer !== LanguageServerType.Jedi; - } } diff --git a/src/client/linters/linterCommands.ts b/src/client/linters/linterCommands.ts index c423a0f33a22..ad3decdcef63 100644 --- a/src/client/linters/linterCommands.ts +++ b/src/client/linters/linterCommands.ts @@ -36,7 +36,7 @@ export class LinterCommands implements IDisposable { const linters = this.linterManager.getAllLinterInfos(); const suggestions = linters.map((x) => x.id).sort(); const linterList = ['Disable Linting', ...suggestions]; - const activeLinters = await this.linterManager.getActiveLinters(true, this.settingsUri); + const activeLinters = await this.linterManager.getActiveLinters(this.settingsUri); let current: string; switch (activeLinters.length) { @@ -82,7 +82,7 @@ export class LinterCommands implements IDisposable { public async enableLintingAsync(): Promise { const options = ['Enable', 'Disable']; - const current = (await this.linterManager.isLintingEnabled(true, this.settingsUri)) ? options[0] : options[1]; + const current = (await this.linterManager.isLintingEnabled(this.settingsUri)) ? options[0] : options[1]; const quickPickOptions: QuickPickOptions = { matchOnDetail: true, diff --git a/src/client/linters/linterInfo.ts b/src/client/linters/linterInfo.ts index 912eea1cdf04..f946cde97f7c 100644 --- a/src/client/linters/linterInfo.ts +++ b/src/client/linters/linterInfo.ts @@ -3,8 +3,6 @@ import * as path from 'path'; import { Uri } from 'vscode'; -import { LanguageServerType } from '../activation/types'; -import { IWorkspaceService } from '../common/application/types'; import { ExecutionInfo, IConfigurationService, Product } from '../common/types'; import { ILinterInfo, LinterId } from './types'; @@ -74,38 +72,3 @@ export class LinterInfo implements ILinterInfo { return { execPath, moduleName, args, product: this.product }; } } - -export class PylintLinterInfo extends LinterInfo { - constructor( - configService: IConfigurationService, - private readonly workspaceService: IWorkspaceService, - configFileNames: string[] = [], - ) { - super(Product.pylint, LinterId.PyLint, configService, configFileNames); - } - public isEnabled(resource?: Uri): boolean { - // We want to be sure the setting is not default since default is `true` and hence - // missing setting yields `true`. When setting is missing and LS is non-Jedi, - // we want default to be `false`. So inspection here makes sure we are not getting - // `true` because there is no setting and LS is active. - const enabled = super.isEnabled(resource); // Is it enabled by settings? - const usingJedi = this.configService.getSettings(resource).languageServer === LanguageServerType.Jedi; - if (usingJedi) { - // In Jedi case adhere to default behavior. Missing setting means `enabled`. - return enabled; - } - // If we're using LS, then by default Pylint is disabled unless user provided - // the value. We have to resort to direct inspection of settings here. - const configuration = this.workspaceService.getConfiguration('python', resource); - const inspection = configuration.inspect(`linting.${this.enabledSettingName}`); - if ( - !inspection || - (inspection.globalValue === undefined && - inspection.workspaceFolderValue === undefined && - inspection.workspaceValue === undefined) - ) { - return false; - } - return enabled; - } -} diff --git a/src/client/linters/linterManager.ts b/src/client/linters/linterManager.ts index 9bfba890094d..e8ec38c5ca08 100644 --- a/src/client/linters/linterManager.ts +++ b/src/client/linters/linterManager.ts @@ -5,20 +5,19 @@ import { inject, injectable } from 'inversify'; import { CancellationToken, OutputChannel, TextDocument, Uri } from 'vscode'; -import { IWorkspaceService } from '../common/application/types'; import { traceError } from '../common/logger'; import { IConfigurationService, Product } from '../common/types'; import { IServiceContainer } from '../ioc/types'; import { Bandit } from './bandit'; import { Flake8 } from './flake8'; -import { LinterInfo, PylintLinterInfo } from './linterInfo'; +import { LinterInfo } from './linterInfo'; import { MyPy } from './mypy'; import { Prospector } from './prospector'; import { Pycodestyle } from './pycodestyle'; import { PyDocStyle } from './pydocstyle'; import { PyLama } from './pylama'; import { Pylint } from './pylint'; -import { IAvailableLinterActivator, ILinter, ILinterInfo, ILinterManager, ILintMessage, LinterId } from './types'; +import { ILinter, ILinterInfo, ILinterManager, ILintMessage, LinterId } from './types'; class DisabledLinter implements ILinter { constructor(private configService: IConfigurationService) {} @@ -33,19 +32,13 @@ class DisabledLinter implements ILinter { @injectable() export class LinterManager implements ILinterManager { protected linters: ILinterInfo[]; - private configService: IConfigurationService; - private checkedForInstalledLinters = new Set(); - constructor( - @inject(IServiceContainer) private serviceContainer: IServiceContainer, - @inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService, - ) { - this.configService = serviceContainer.get(IConfigurationService); + constructor(@inject(IConfigurationService) private configService: IConfigurationService) { // Note that we use unit tests to ensure all the linters are here. this.linters = [ new LinterInfo(Product.bandit, LinterId.Bandit, this.configService), new LinterInfo(Product.flake8, LinterId.Flake8, this.configService), - new PylintLinterInfo(this.configService, this.workspaceService, ['.pylintrc', 'pylintrc']), + new LinterInfo(Product.pylint, LinterId.PyLint, this.configService, ['pylintrc', '.pylintrc']), new LinterInfo(Product.mypy, LinterId.MyPy, this.configService), new LinterInfo(Product.pycodestyle, LinterId.PyCodeStyle, this.configService), new LinterInfo(Product.prospector, LinterId.Prospector, this.configService), @@ -66,9 +59,9 @@ export class LinterManager implements ILinterManager { throw new Error(`Invalid linter '${Product[product]}'`); } - public async isLintingEnabled(silent: boolean, resource?: Uri): Promise { + public async isLintingEnabled(resource?: Uri): Promise { const settings = this.configService.getSettings(resource); - const activeLintersPresent = await this.getActiveLinters(silent, resource); + const activeLintersPresent = await this.getActiveLinters(resource); return settings.linting.enabled && activeLintersPresent.length > 0; } @@ -76,10 +69,7 @@ export class LinterManager implements ILinterManager { await this.configService.updateSetting('linting.enabled', enable, resource); } - public async getActiveLinters(silent: boolean, resource?: Uri): Promise { - if (!silent) { - await this.enableUnconfiguredLinters(resource); - } + public async getActiveLinters(resource?: Uri): Promise { return this.linters.filter((x) => x.isEnabled(resource)); } @@ -93,7 +83,7 @@ export class LinterManager implements ILinterManager { // if we have valid linter product(s), enable only those if (validProducts.length > 0) { - const active = await this.getActiveLinters(true, resource); + const active = await this.getActiveLinters(resource); for (const x of active) { await x.enableAsync(false, resource); } @@ -113,7 +103,7 @@ export class LinterManager implements ILinterManager { serviceContainer: IServiceContainer, resource?: Uri, ): Promise { - if (!(await this.isLintingEnabled(true, resource))) { + if (!(await this.isLintingEnabled(resource))) { return new DisabledLinter(this.configService); } const error = 'Linter manager: Unknown linter'; @@ -140,22 +130,4 @@ export class LinterManager implements ILinterManager { } throw new Error(error); } - - protected async enableUnconfiguredLinters(resource?: Uri): Promise { - const settings = this.configService.getSettings(resource); - if (!settings.linting.pylintEnabled || !settings.linting.enabled) { - return; - } - // If we've already checked during this session for the same workspace and Python path, then don't bother again. - const workspaceKey = `${this.workspaceService.getWorkspaceFolderIdentifier(resource)}${settings.pythonPath}`; - if (this.checkedForInstalledLinters.has(workspaceKey)) { - return; - } - this.checkedForInstalledLinters.add(workspaceKey); - - // only check & ask the user if they'd like to enable pylint - const pylintInfo = this.linters.find((linter) => linter.id === 'pylint'); - const activator = this.serviceContainer.get(IAvailableLinterActivator); - await activator.promptIfLinterAvailable(pylintInfo!, resource); - } } diff --git a/src/client/linters/lintingEngine.ts b/src/client/linters/lintingEngine.ts index 00c7dab0ea08..c932a9e27882 100644 --- a/src/client/linters/lintingEngine.ts +++ b/src/client/linters/lintingEngine.ts @@ -90,7 +90,7 @@ export class LintingEngine implements ILintingEngine { this.pendingLintings.set(document.uri.fsPath, cancelToken); - const activeLinters = await this.linterManager.getActiveLinters(false, document.uri); + const activeLinters = await this.linterManager.getActiveLinters(document.uri); const promises: Promise[] = activeLinters.map(async (info: ILinterInfo) => { const stopWatch = new StopWatch(); const linter = await this.linterManager.createLinter( @@ -161,7 +161,7 @@ export class LintingEngine implements ILintingEngine { } private async shouldLintDocument(document: vscode.TextDocument): Promise { - if (!(await this.linterManager.isLintingEnabled(false, document.uri))) { + if (!(await this.linterManager.isLintingEnabled(document.uri))) { this.diagnosticCollection.set(document.uri, []); return false; } diff --git a/src/client/linters/pylint.ts b/src/client/linters/pylint.ts index 495787568509..10a213c2d631 100644 --- a/src/client/linters/pylint.ts +++ b/src/client/linters/pylint.ts @@ -1,171 +1,34 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import * as os from 'os'; -import * as path from 'path'; import { CancellationToken, OutputChannel, TextDocument } from 'vscode'; import '../common/extensions'; -import { IFileSystem, IPlatformService } from '../common/platform/types'; import { Product } from '../common/types'; import { IServiceContainer } from '../ioc/types'; import { BaseLinter } from './baseLinter'; import { ILintMessage } from './types'; -const pylintrc = 'pylintrc'; -const dotPylintrc = '.pylintrc'; - const REGEX = '(?\\d+),(?-?\\d+),(?\\w+),(?[\\w-]+):(?.*)\\r?(\\n|$)'; export class Pylint extends BaseLinter { - private fileSystem: IFileSystem; - private platformService: IPlatformService; - constructor(outputChannel: OutputChannel, serviceContainer: IServiceContainer) { super(Product.pylint, outputChannel, serviceContainer); - this.fileSystem = serviceContainer.get(IFileSystem); - this.platformService = serviceContainer.get(IPlatformService); } protected async runLinter(document: TextDocument, cancellation: CancellationToken): Promise { - let minArgs: string[] = []; - // Only use minimal checkers if - // a) there are no custom arguments and - // b) there is no pylintrc file next to the file or at the workspace root const uri = document.uri; - const workspaceRoot = this.getWorkspaceRootPath(document); const settings = this.configService.getSettings(uri); - if ( - settings.linting.pylintUseMinimalCheckers && - this.info.linterArgs(uri).length === 0 && - // Check pylintrc next to the file or above up to and including the workspace root - !(await Pylint.hasConfigurationFileInWorkspace(this.fileSystem, path.dirname(uri.fsPath), workspaceRoot)) && - // Check for pylintrc at the cwd and above - !(await Pylint.hasConfigurationFile( - this.fileSystem, - this.getWorkingDirectoryPath(document), - this.platformService, - )) - ) { - // Disable all checkers up front and then selectively add back in: - // - All F checkers - // - Select W checkers - // - All E checkers _manually_ - // (see https://github.com/Microsoft/vscode-python/issues/722 for - // why; see - // https://gist.github.com/brettcannon/eff7f38a60af48d39814cbb2f33b3d1d - // for a script to regenerate the list of E checkers) - minArgs = [ - '--disable=all', - '--enable=F' + - ',unreachable,duplicate-key,unnecessary-semicolon' + - ',global-variable-not-assigned,unused-variable' + - ',unused-wildcard-import,binary-op-exception' + - ',bad-format-string,anomalous-backslash-in-string' + - ',bad-open-mode' + - ',E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107' + - ',E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118' + - ',E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241' + - ',E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611' + - ',E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003' + - ',E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127' + - ',E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137' + - ',E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303' + - ',E1304,E1305,E1306,E1310,E1700,E1701', - ]; - } const args = [ "--msg-template='{line},{column},{category},{symbol}:{msg}'", '--reports=n', '--output-format=text', uri.fsPath, ]; - const messages = await this.run(minArgs.concat(args), document, cancellation, REGEX); + const messages = await this.run(args, document, cancellation, REGEX); messages.forEach((msg) => { msg.severity = this.parseMessagesSeverity(msg.type, settings.linting.pylintCategorySeverity); }); return messages; } - - public static async hasConfigurationFile( - fs: IFileSystem, - folder: string, - platformService: IPlatformService, - ): Promise { - // https://pylint.readthedocs.io/en/latest/user_guide/run.html - // https://github.com/PyCQA/pylint/blob/975e08148c0faa79958b459303c47be1a2e1500a/pylint/config.py - // 1. pylintrc in the current working directory - // 2. .pylintrc in the current working directory - // 3. If the current working directory is in a Python module, Pylint searches - // up the hierarchy of Python modules until it finds a pylintrc file. - // This allows you to specify coding standards on a module by module basis. - // A directory is judged to be a Python module if it contains an __init__.py file. - // 4. The file named by environment variable PYLINTRC - // 5. if you have a home directory which isn’t /root: - // a) .pylintrc in your home directory - // b) .config/pylintrc in your home directory - // 6. /etc/pylintrc - if (process.env.PYLINTRC) { - return true; - } - - if ( - (await fs.fileExists(path.join(folder, pylintrc))) || - (await fs.fileExists(path.join(folder, dotPylintrc))) - ) { - return true; - } - - let current = folder; - let above = path.dirname(folder); - do { - if (!(await fs.fileExists(path.join(current, '__init__.py')))) { - break; - } - if ( - (await fs.fileExists(path.join(current, pylintrc))) || - (await fs.fileExists(path.join(current, dotPylintrc))) - ) { - return true; - } - current = above; - above = path.dirname(above); - } while (!fs.arePathsSame(current, above)); - - const home = os.homedir(); - if (await fs.fileExists(path.join(home, dotPylintrc))) { - return true; - } - if (await fs.fileExists(path.join(home, '.config', pylintrc))) { - return true; - } - - if (!platformService.isWindows) { - if (await fs.fileExists(path.join('/etc', pylintrc))) { - return true; - } - } - return false; - } - - public static async hasConfigurationFileInWorkspace( - fs: IFileSystem, - folder: string, - root: string, - ): Promise { - // Search up from file location to the workspace root - let current = folder; - let above = path.dirname(current); - do { - if ( - (await fs.fileExists(path.join(current, pylintrc))) || - (await fs.fileExists(path.join(current, dotPylintrc))) - ) { - return true; - } - current = above; - above = path.dirname(above); - } while (!fs.arePathsSame(current, root) && !fs.arePathsSame(current, above)); - return false; - } } diff --git a/src/client/linters/types.ts b/src/client/linters/types.ts index fb6d1d44e1ca..f8c48a50bef8 100644 --- a/src/client/linters/types.ts +++ b/src/client/linters/types.ts @@ -50,8 +50,8 @@ export const ILinterManager = Symbol('ILinterManager'); export interface ILinterManager { getAllLinterInfos(): ILinterInfo[]; getLinterInfo(product: Product): ILinterInfo; - getActiveLinters(silent: boolean, resource?: vscode.Uri): Promise; - isLintingEnabled(silent: boolean, resource?: vscode.Uri): Promise; + getActiveLinters(resource?: vscode.Uri): Promise; + isLintingEnabled(resource?: vscode.Uri): Promise; enableLintingAsync(enable: boolean, resource?: vscode.Uri): Promise; setActiveLintersAsync(products: Product[], resource?: vscode.Uri): Promise; createLinter( diff --git a/src/client/providers/linterProvider.ts b/src/client/providers/linterProvider.ts index 8bfde47e192b..8be6be069154 100644 --- a/src/client/providers/linterProvider.ts +++ b/src/client/providers/linterProvider.ts @@ -90,7 +90,7 @@ export class LinterProvider implements IExtensionActivationService, Disposable { } this.linterManager - .getActiveLinters(false, document.uri) + .getActiveLinters(document.uri) .then((linters) => { const fileName = path.basename(document.uri.fsPath).toLowerCase(); const watchers = linters.filter((info) => info.configFileNames.indexOf(fileName) >= 0); diff --git a/src/test/.vscode/settings.json b/src/test/.vscode/settings.json index ad72e930aca3..099b2e9f5283 100644 --- a/src/test/.vscode/settings.json +++ b/src/test/.vscode/settings.json @@ -14,9 +14,9 @@ "python.linting.mypyEnabled": false, "python.linting.banditEnabled": false, "python.formatting.provider": "yapf", - "python.linting.pylintUseMinimalCheckers": false, // Do not set this to "Microsoft", else it will result in LS being downloaded on CI // and that slows down tests significantly. We have other tests on CI for testing // downloading of LS with this setting enabled. - "python.languageServer": "Jedi" + "python.languageServer": "Jedi", + "python.pythonPath": "C:\\GIT\\s p\\vscode-python\\.venv\\Scripts\\python.exe" } diff --git a/src/test/linters/common.ts b/src/test/linters/common.ts index 87a489cbbb31..793f2127611e 100644 --- a/src/test/linters/common.ts +++ b/src/test/linters/common.ts @@ -102,7 +102,6 @@ export class LintingSettings { public banditEnabled: boolean; public banditArgs: string[]; public banditPath: string; - public pylintUseMinimalCheckers: boolean; constructor() { // mostly from configSettings.ts @@ -164,7 +163,6 @@ export class LintingSettings { refactor: DiagnosticSeverity.Hint, warning: DiagnosticSeverity.Warning, }; - this.pylintUseMinimalCheckers = false; } } @@ -264,7 +262,7 @@ export class BaseTestFixture { // linting - this.linterManager = new LinterManager(this.serviceContainer.object, this.workspaceService.object!); + this.linterManager = new LinterManager(this.configService.object); this.serviceContainer .setup((c) => c.get(TypeMoq.It.isValue(ILinterManager), TypeMoq.It.isAny())) .returns(() => this.linterManager); diff --git a/src/test/linters/lint.args.test.ts b/src/test/linters/lint.args.test.ts index 0e21a31a12e3..e398818db031 100644 --- a/src/test/linters/lint.args.test.ts +++ b/src/test/linters/lint.args.test.ts @@ -132,7 +132,7 @@ suite('Linting - Arguments', () => { const platformService = TypeMoq.Mock.ofType(); serviceManager.addSingletonInstance(IPlatformService, platformService.object); - lm = new LinterManager(serviceContainer, workspaceService.object); + lm = new LinterManager(configService.object); serviceManager.addSingletonInstance(ILinterManager, lm); document = TypeMoq.Mock.ofType(); }); diff --git a/src/test/linters/lint.functional.test.ts b/src/test/linters/lint.functional.test.ts index 37bf4330d31f..a34bfc3f5163 100644 --- a/src/test/linters/lint.functional.test.ts +++ b/src/test/linters/lint.functional.test.ts @@ -818,10 +818,6 @@ suite('Linting Functional Tests', () => { } const fixture = new TestFixture(); - if (product === Product.pydocstyle) { - fixture.lintingSettings.pylintUseMinimalCheckers = false; - } - const { filename, messagesToBeReceived, origRCFile } = await getInfoForConfig(product); let rcfile = ''; async function cleanUp() { diff --git a/src/test/linters/lint.manager.unit.test.ts b/src/test/linters/lint.manager.unit.test.ts deleted file mode 100644 index 6229c983b59f..000000000000 --- a/src/test/linters/lint.manager.unit.test.ts +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -'use strict'; - -import { expect } from 'chai'; -import * as TypeMoq from 'typemoq'; -import { Uri } from 'vscode'; -import { IWorkspaceService } from '../../client/common/application/types'; -import { IConfigurationService, IPythonSettings } from '../../client/common/types'; -import { IServiceContainer } from '../../client/ioc/types'; -import { LinterManager } from '../../client/linters/linterManager'; - -const workspaceService = TypeMoq.Mock.ofType(); - -// setup class instance -class TestLinterManager extends LinterManager { - public enableUnconfiguredLintersCallCount: number = 0; - - protected async enableUnconfiguredLinters(_resource?: Uri): Promise { - this.enableUnconfiguredLintersCallCount += 1; - } -} - -function getServiceContainerMockForLinterManagerTests(): TypeMoq.IMock { - // setup test mocks - const serviceContainerMock = TypeMoq.Mock.ofType(); - - const pythonSettingsMock = TypeMoq.Mock.ofType(); - const configMock = TypeMoq.Mock.ofType(); - configMock.setup((cm) => cm.getSettings(TypeMoq.It.isAny())).returns(() => pythonSettingsMock.object); - serviceContainerMock.setup((c) => c.get(IConfigurationService)).returns(() => configMock.object); - - const pythonConfig = { - inspect: () => {}, - }; - workspaceService - .setup((x) => x.getConfiguration('python', TypeMoq.It.isAny())) - - .returns(() => pythonConfig as any); - serviceContainerMock.setup((c) => c.get(IWorkspaceService)).returns(() => workspaceService.object); - - return serviceContainerMock; -} - -suite('Lint Manager Unit Tests', () => { - test('Linter manager isLintingEnabled checks availability when silent = false.', async () => { - // set expectations - const expectedCallCount = 1; - const silentFlag = false; - - // get setup - const serviceContainerMock = getServiceContainerMockForLinterManagerTests(); - - // make the call - const lm = new TestLinterManager(serviceContainerMock.object, workspaceService.object); - await lm.isLintingEnabled(silentFlag); - - // test expectations - expect(lm.enableUnconfiguredLintersCallCount).to.equal(expectedCallCount); - }); - - test('Linter manager isLintingEnabled does not check availability when silent = true.', async () => { - // set expectations - const expectedCallCount = 0; - const silentFlag = true; - - // get setup - const serviceContainerMock = getServiceContainerMockForLinterManagerTests(); - - // make the call - const lm: TestLinterManager = new TestLinterManager(serviceContainerMock.object, workspaceService.object); - await lm.isLintingEnabled(silentFlag); - - // test expectations - expect(lm.enableUnconfiguredLintersCallCount).to.equal(expectedCallCount); - }); - - test('Linter manager getActiveLinters checks availability when silent = false.', async () => { - // set expectations - const expectedCallCount = 1; - const silentFlag = false; - - // get setup - const serviceContainerMock = getServiceContainerMockForLinterManagerTests(); - - // make the call - const lm: TestLinterManager = new TestLinterManager(serviceContainerMock.object, workspaceService.object); - await lm.getActiveLinters(silentFlag); - - // test expectations - expect(lm.enableUnconfiguredLintersCallCount).to.equal(expectedCallCount); - }); - - test('Linter manager getActiveLinters checks availability when silent = true.', async () => { - // set expectations - const expectedCallCount = 0; - const silentFlag = true; - - // get setup - const serviceContainerMock = getServiceContainerMockForLinterManagerTests(); - - // make the call - const lm: TestLinterManager = new TestLinterManager(serviceContainerMock.object, workspaceService.object); - await lm.getActiveLinters(silentFlag); - - // test expectations - expect(lm.enableUnconfiguredLintersCallCount).to.equal(expectedCallCount); - }); -}); diff --git a/src/test/linters/lint.multilinter.test.ts b/src/test/linters/lint.multilinter.test.ts index 881cccb4b413..b71478505530 100644 --- a/src/test/linters/lint.multilinter.test.ts +++ b/src/test/linters/lint.multilinter.test.ts @@ -17,7 +17,7 @@ import { deleteFile, IExtensionTestApi, PythonSettingKeys, rootWorkspaceUri } fr import { closeActiveWindows, initialize, initializeTest, IS_MULTI_ROOT_TEST } from '../initialize'; const workspaceUri = Uri.file(path.join(__dirname, '..', '..', '..', 'src', 'test')); -const pythoFilesPath = path.join(__dirname, '..', '..', '..', 'src', 'test', 'pythonFiles', 'linting'); +const pythonFilesPath = path.join(__dirname, '..', '..', '..', 'src', 'test', 'pythonFiles', 'linting'); // Mocked out python tool execution (all we need is mocked linter return values). class MockPythonToolExecService extends PythonToolExecutionService { @@ -78,7 +78,6 @@ suite('Linting - Multiple Linters Enabled Test', () => { await configService.updateSetting('linting.enabled', true, rootWorkspaceUri, target); await configService.updateSetting('linting.lintOnSave', false, rootWorkspaceUri, target); - await configService.updateSetting('linting.pylintUseMinimalCheckers', false, workspaceUri); linterManager.getAllLinterInfos().forEach(async (x) => { await configService.updateSetting(makeSettingKey(x.product), false, rootWorkspaceUri, target); @@ -91,7 +90,7 @@ suite('Linting - Multiple Linters Enabled Test', () => { test('Multiple linters', async () => { await closeActiveWindows(); - const document = await workspace.openTextDocument(path.join(pythoFilesPath, 'print.py')); + const document = await workspace.openTextDocument(path.join(pythonFilesPath, 'print.py')); await window.showTextDocument(document); await configService.updateSetting( 'languageServer', @@ -100,7 +99,6 @@ suite('Linting - Multiple Linters Enabled Test', () => { ConfigurationTarget.Workspace, ); await configService.updateSetting('linting.enabled', true, workspaceUri); - await configService.updateSetting('linting.pylintUseMinimalCheckers', false, workspaceUri); await configService.updateSetting('linting.pylintEnabled', true, workspaceUri); await configService.updateSetting('linting.flake8Enabled', true, workspaceUri); diff --git a/src/test/linters/lint.provider.test.ts b/src/test/linters/lint.provider.test.ts index 35c73300dfdd..2283dc419b0c 100644 --- a/src/test/linters/lint.provider.test.ts +++ b/src/test/linters/lint.provider.test.ts @@ -122,7 +122,7 @@ suite('Linting - Provider', () => { ICommandManager, TypeMoq.Mock.ofType().object, ); - lm = new LinterManager(serviceContainer, workspaceService.object); + lm = new LinterManager(configService.object); serviceManager.addSingletonInstance(ILinterManager, lm); emitter = new vscode.EventEmitter(); document = TypeMoq.Mock.ofType(); diff --git a/src/test/linters/lint.test.ts b/src/test/linters/lint.test.ts index a4d655bdda98..c9e1826030ea 100644 --- a/src/test/linters/lint.test.ts +++ b/src/test/linters/lint.test.ts @@ -3,9 +3,7 @@ 'use strict'; import * as assert from 'assert'; -import * as path from 'path'; -import { ConfigurationTarget, Uri } from 'vscode'; -import { WorkspaceService } from '../../client/common/application/workspace'; +import { ConfigurationTarget } from 'vscode'; import { Product } from '../../client/common/installer/productInstaller'; import { FormatterProductPathService, @@ -22,9 +20,6 @@ import { rootWorkspaceUri } from '../common'; import { closeActiveWindows, initialize, initializeTest, IS_MULTI_ROOT_TEST } from '../initialize'; import { UnitTestIocContainer } from '../testing/serviceRegistry'; -const workspaceDir = path.join(__dirname, '..', '..', '..', 'src', 'test'); -const workspaceUri = Uri.file(workspaceDir); - suite('Linting Settings', () => { let ioc: UnitTestIocContainer; let linterManager: ILinterManager; @@ -56,8 +51,8 @@ suite('Linting Settings', () => { ioc.registerLinterTypes(); ioc.registerVariableTypes(); ioc.registerPlatformTypes(); - linterManager = new LinterManager(ioc.serviceContainer, new WorkspaceService()); configService = ioc.serviceContainer.get(IConfigurationService); + linterManager = new LinterManager(configService); ioc.serviceManager.addSingletonInstance(IProductService, new ProductService()); ioc.serviceManager.addSingleton( IProductPathService, @@ -82,7 +77,6 @@ suite('Linting Settings', () => { await configService.updateSetting('linting.enabled', lintingEnabled, rootWorkspaceUri, target); await configService.updateSetting('linting.lintOnSave', false, rootWorkspaceUri, target); - await configService.updateSetting('linting.pylintUseMinimalCheckers', false, workspaceUri); linterManager.getAllLinterInfos().forEach(async (x) => { const settingKey = `linting.${x.enabledSettingName}`; diff --git a/src/test/linters/lint.unit.test.ts b/src/test/linters/lint.unit.test.ts index db16a33c54eb..2caeb7d358d0 100644 --- a/src/test/linters/lint.unit.test.ts +++ b/src/test/linters/lint.unit.test.ts @@ -711,7 +711,6 @@ suite('Linting Scenarios', () => { useMinimal ? '' : 'out' } minimal checkers`, async () => { const fixture = new TestFixture(); - fixture.lintingSettings.pylintUseMinimalCheckers = useMinimal; await testEnablingDisablingOfLinter(fixture, Product.pylint, enabled); }); } diff --git a/src/test/linters/lintengine.test.ts b/src/test/linters/lintengine.test.ts index 79f3d4badc4e..961d298bd444 100644 --- a/src/test/linters/lintengine.test.ts +++ b/src/test/linters/lintengine.test.ts @@ -73,10 +73,7 @@ suite('Linting - LintingEngine', () => { try { lintingEngine.lintDocument(doc, 'auto').ignoreErrors(); } catch { - lintManager.verify( - (l) => l.isLintingEnabled(TypeMoq.It.isAny(), TypeMoq.It.isValue(doc.uri)), - TypeMoq.Times.once(), - ); + lintManager.verify((l) => l.isLintingEnabled(TypeMoq.It.isValue(doc.uri)), TypeMoq.Times.once()); } }); test('Ensure document.uri is passed into createLinter', () => { diff --git a/src/test/linters/linter.availability.unit.test.ts b/src/test/linters/linter.availability.unit.test.ts index 86287c4e9f56..5325da6110d5 100644 --- a/src/test/linters/linter.availability.unit.test.ts +++ b/src/test/linters/linter.availability.unit.test.ts @@ -12,7 +12,6 @@ import { LanguageServerType } from '../../client/activation/types'; import { ApplicationShell } from '../../client/common/application/applicationShell'; import { IApplicationShell, IWorkspaceService } from '../../client/common/application/types'; import { WorkspaceService } from '../../client/common/application/workspace'; -import { ConfigurationService } from '../../client/common/configuration/service'; import { PersistentStateFactory } from '../../client/common/persistentState'; import { FileSystem } from '../../client/common/platform/fileSystem'; import { IFileSystem } from '../../client/common/platform/types'; @@ -29,68 +28,6 @@ import { LinterInfo } from '../../client/linters/linterInfo'; import { IAvailableLinterActivator, ILinterInfo, LinterId } from '../../client/linters/types'; suite('Linter Availability Provider tests', () => { - test('Availability feature is disabled when global default for languageServer === Jedi.', async () => { - // set expectations - const languageServerValue = LanguageServerType.Jedi; - const expectedResult = false; - - // arrange - const [ - appShellMock, - fsMock, - workspaceServiceMock, - configServiceMock, - factoryMock, - ] = getDependenciesForAvailabilityTests(); - setupConfigurationServiceForJediSettingsTest(languageServerValue, configServiceMock); - - // call - const availabilityProvider = new AvailableLinterActivator( - appShellMock.object, - fsMock.object, - workspaceServiceMock.object, - configServiceMock.object, - factoryMock.object, - ); - - // check expectaions - expect(availabilityProvider.isFeatureEnabled).is.equal( - expectedResult, - 'Avaialability feature should be disabled when python.languageServer is Jedi', - ); - workspaceServiceMock.verifyAll(); - }); - - test('Availability feature is enabled when global default for languageServer is Microsoft.', async () => { - // set expectations - const languageServerValue = LanguageServerType.Microsoft; - const expectedResult = true; - - // arrange - const [ - appShellMock, - fsMock, - workspaceServiceMock, - configServiceMock, - factoryMock, - ] = getDependenciesForAvailabilityTests(); - setupConfigurationServiceForJediSettingsTest(languageServerValue, configServiceMock); - - const availabilityProvider = new AvailableLinterActivator( - appShellMock.object, - fsMock.object, - workspaceServiceMock.object, - configServiceMock.object, - factoryMock.object, - ); - - expect(availabilityProvider.isFeatureEnabled).is.equal( - expectedResult, - 'Avaialability feature should be enabled when python.languageServer defaults to non-Jedi', - ); - workspaceServiceMock.verifyAll(); - }); - test('Prompt will be performed when linter is not configured at all for the workspace, workspace-folder, or the user', async () => { // setup expectations const pylintUserValue = undefined; @@ -102,7 +39,6 @@ suite('Linter Availability Provider tests', () => { appShellMock, fsMock, workspaceServiceMock, - configServiceMock, factoryMock, linterInfo, ] = getDependenciesForAvailabilityTests(); @@ -117,7 +53,6 @@ suite('Linter Availability Provider tests', () => { appShellMock.object, fsMock.object, workspaceServiceMock.object, - configServiceMock.object, factoryMock.object, ); @@ -138,7 +73,6 @@ suite('Linter Availability Provider tests', () => { appShellMock, fsMock, workspaceServiceMock, - configServiceMock, factoryMock, linterInfo, ] = getDependenciesForAvailabilityTests(); @@ -153,7 +87,6 @@ suite('Linter Availability Provider tests', () => { appShellMock.object, fsMock.object, workspaceServiceMock.object, - configServiceMock.object, factoryMock.object, ); @@ -177,7 +110,6 @@ suite('Linter Availability Provider tests', () => { appShellMock, fsMock, workspaceServiceMock, - configServiceMock, factoryMock, linterInfo, ] = getDependenciesForAvailabilityTests(); @@ -191,7 +123,6 @@ suite('Linter Availability Provider tests', () => { appShellMock.object, fsMock.object, workspaceServiceMock.object, - configServiceMock.object, factoryMock.object, ); @@ -215,7 +146,6 @@ suite('Linter Availability Provider tests', () => { appShellMock, fsMock, workspaceServiceMock, - configServiceMock, factoryMock, linterInfo, ] = getDependenciesForAvailabilityTests(); @@ -229,7 +159,6 @@ suite('Linter Availability Provider tests', () => { appShellMock.object, fsMock.object, workspaceServiceMock.object, - configServiceMock.object, factoryMock.object, ); @@ -246,7 +175,7 @@ suite('Linter Availability Provider tests', () => { promptEnabled = true, ): Promise { // arrange - const [appShellMock, fsMock, workspaceServiceMock, , factoryMock] = getDependenciesForAvailabilityTests(); + const [appShellMock, fsMock, workspaceServiceMock, factoryMock] = getDependenciesForAvailabilityTests(); const configServiceMock = TypeMoq.Mock.ofType(); const linterInfo = new (class extends LinterInfo { @@ -302,7 +231,6 @@ suite('Linter Availability Provider tests', () => { appShellMock.object, fsMock.object, workspaceServiceMock.object, - configServiceMock.object, factoryMock.object, ); const result = await availabilityProvider.promptToConfigureAvailableLinter(linterInfo); @@ -399,7 +327,6 @@ suite('Linter Availability Provider tests', () => { appShellMock, fsMock, workspaceServiceMock, - configServiceMock, factoryMock, linterInfo, ] = getDependenciesForAvailabilityTests(); @@ -435,6 +362,7 @@ suite('Linter Availability Provider tests', () => { .returns(async () => options.linterIsInstalled) .verifiable(TypeMoq.Times.atLeastOnce()); + const configServiceMock = TypeMoq.Mock.ofType(); setupConfigurationServiceForJediSettingsTest(options.languageServerValue, configServiceMock); setupWorkspaceMockForLinterConfiguredTests( options.pylintUserEnabled, @@ -453,7 +381,6 @@ suite('Linter Availability Provider tests', () => { appShellMock.object, fsMock.object, workspaceServiceMock.object, - configServiceMock.object, factoryMock.object, ); return availabilityProvider.promptIfLinterAvailable(linterInfo); @@ -591,7 +518,6 @@ suite('Linter Availability Provider tests', () => { appShellMock, fsMock, workspaceServiceMock, - configServiceMock, factoryMock, linterInfo, ] = getDependenciesForAvailabilityTests(); @@ -602,7 +528,6 @@ suite('Linter Availability Provider tests', () => { appShellMock.object, fsMock.object, workspaceServiceMock.object, - configServiceMock.object, factoryMock.object, ); const result = await availabilityProvider.isLinterAvailable(linterInfo, undefined); @@ -625,7 +550,6 @@ suite('Linter Availability Provider tests', () => { appShellMock, fsMock, workspaceServiceMock, - configServiceMock, factoryMock, linterInfo, ] = getDependenciesForAvailabilityTests(); @@ -636,7 +560,6 @@ suite('Linter Availability Provider tests', () => { appShellMock.object, fsMock.object, workspaceServiceMock.object, - configServiceMock.object, factoryMock.object, ); const result = await availabilityProvider.isLinterAvailable(linterInfo, undefined); @@ -667,7 +590,6 @@ suite('Linter Availability Provider tests', () => { instance(mock(ApplicationShell)), instance(fs), instance(workspaceService), - instance(mock(ConfigurationService)), instance(mock(PersistentStateFactory)), ); }); @@ -846,7 +768,6 @@ function getDependenciesForAvailabilityTests(): [ TypeMoq.IMock, TypeMoq.IMock, TypeMoq.IMock, - TypeMoq.IMock, TypeMoq.IMock, LinterInfo, ] { @@ -855,7 +776,6 @@ function getDependenciesForAvailabilityTests(): [ TypeMoq.Mock.ofType(), TypeMoq.Mock.ofType(), TypeMoq.Mock.ofType(), - TypeMoq.Mock.ofType(), TypeMoq.Mock.ofType(), new LinterInfo(Product.pylint, LinterId.PyLint, configServiceMock.object, ['.pylintrc', 'pylintrc']), ]; diff --git a/src/test/linters/linterCommands.unit.test.ts b/src/test/linters/linterCommands.unit.test.ts index cd345db31ba1..794bbbfa3587 100644 --- a/src/test/linters/linterCommands.unit.test.ts +++ b/src/test/linters/linterCommands.unit.test.ts @@ -57,7 +57,7 @@ suite('Linting - Linter Commands', () => { currentState: boolean, selectedState: 'Enable' | 'Disable' | undefined, ) { - when(manager.isLintingEnabled(true, anything())).thenResolve(currentState); + when(manager.isLintingEnabled(anything())).thenResolve(currentState); const expectedQuickPickOptions = { matchOnDetail: true, matchOnDescription: true, @@ -101,7 +101,7 @@ suite('Linting - Linter Commands', () => { test('Set Linter should display a quickpick', async () => { when(manager.getAllLinterInfos()).thenReturn([]); - when(manager.getActiveLinters(true, anything())).thenResolve([]); + when(manager.getActiveLinters(anything())).thenResolve([]); when(shell.showQuickPick(anything(), anything())).thenResolve(); const expectedQuickPickOptions = { matchOnDetail: true, @@ -120,7 +120,7 @@ suite('Linting - Linter Commands', () => { const linterId = 'Hello World'; const activeLinters: ILinterInfo[] = [{ id: linterId } as any]; when(manager.getAllLinterInfos()).thenReturn([]); - when(manager.getActiveLinters(true, anything())).thenResolve(activeLinters); + when(manager.getActiveLinters(anything())).thenResolve(activeLinters); when(shell.showQuickPick(anything(), anything())).thenResolve(); const expectedQuickPickOptions = { matchOnDetail: true, @@ -138,7 +138,7 @@ suite('Linting - Linter Commands', () => { test('Set Linter should display a quickpick and with message about multiple linters being enabled', async () => { const activeLinters: ILinterInfo[] = [{ id: 'linterId' } as any, { id: 'linterId2' } as any]; when(manager.getAllLinterInfos()).thenReturn([]); - when(manager.getActiveLinters(true, anything())).thenResolve(activeLinters); + when(manager.getActiveLinters(anything())).thenResolve(activeLinters); when(shell.showQuickPick(anything(), anything())).thenResolve(); const expectedQuickPickOptions = { matchOnDetail: true, @@ -157,7 +157,7 @@ suite('Linting - Linter Commands', () => { const linters: ILinterInfo[] = [{ id: '1' }, { id: '2' }, { id: '3', product: 'Three' }] as any; const activeLinters: ILinterInfo[] = [{ id: '1' }, { id: '3' }] as any; when(manager.getAllLinterInfos()).thenReturn(linters); - when(manager.getActiveLinters(true, anything())).thenResolve(activeLinters); + when(manager.getActiveLinters(anything())).thenResolve(activeLinters); when(shell.showQuickPick(anything(), anything())).thenResolve('3' as any); when(shell.showWarningMessage(anything(), 'Yes', 'No')).thenResolve('Yes' as any); const expectedQuickPickOptions = { diff --git a/src/test/linters/linterManager.unit.test.ts b/src/test/linters/linterManager.unit.test.ts index d2d9babb8187..9fe79c87887e 100644 --- a/src/test/linters/linterManager.unit.test.ts +++ b/src/test/linters/linterManager.unit.test.ts @@ -39,9 +39,6 @@ suite('Linting - Linter Manager', () => { class LinterManagerTest extends LinterManager { // Override base class property to make it public. public linters!: ILinterInfo[]; - public async enableUnconfiguredLinters(resource?: Uri) { - await super.enableUnconfiguredLinters(resource); - } } setup(() => { const svcContainer = mock(ServiceContainer); @@ -57,7 +54,7 @@ suite('Linting - Linter Manager', () => { when(svcContainer.get(ILintingEngine)).thenReturn(instance(lintingEngine)); when(svcContainer.get(IConfigurationService)).thenReturn(instance(configService)); when(svcContainer.get(IWorkspaceService)).thenReturn(instance(workspaceService)); - linterManager = new LinterManagerTest(instance(svcContainer), instance(workspaceService)); + linterManager = new LinterManagerTest(instance(configService)); }); test('Get all linters will return a list of all linters', () => { @@ -109,27 +106,11 @@ suite('Linting - Linter Manager', () => { linterManager.linters = [instanceOfLinterInfo]; when(linterInfo.isEnabled(resource)).thenReturn(true); - const linters = await linterManager.getActiveLinters(true, resource); + const linters = await linterManager.getActiveLinters(resource); verify(linterInfo.isEnabled(resource)).once(); expect(linters[0]).to.deep.equal(instanceOfLinterInfo); }); - test(`getActiveLinters will check if linter is enabled and not in silent mode ${testResourceSuffix}`, async () => { - const linterInfo = mock(LinterInfo); - const instanceOfLinterInfo = instance(linterInfo); - linterManager.linters = [instanceOfLinterInfo]; - when(linterInfo.isEnabled(resource)).thenReturn(true); - let enableUnconfiguredLintersInvoked = false; - linterManager.enableUnconfiguredLinters = async () => { - enableUnconfiguredLintersInvoked = true; - }; - - const linters = await linterManager.getActiveLinters(false, resource); - - verify(linterInfo.isEnabled(resource)).once(); - expect(linters[0]).to.deep.equal(instanceOfLinterInfo); - expect(enableUnconfiguredLintersInvoked).to.equal(true, 'not invoked'); - }); test(`setActiveLintersAsync with invalid products does nothing ${testResourceSuffix}`, async () => { let getActiveLintersInvoked = false; diff --git a/src/test/linters/linterinfo.unit.test.ts b/src/test/linters/linterinfo.unit.test.ts deleted file mode 100644 index 31c3b4d18499..000000000000 --- a/src/test/linters/linterinfo.unit.test.ts +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -'use strict'; - -import { expect } from 'chai'; -import * as sinon from 'sinon'; -import { anything, instance, mock, when } from 'ts-mockito'; -import { LanguageServerType } from '../../client/activation/types'; -import { WorkspaceService } from '../../client/common/application/workspace'; -import { ConfigurationService } from '../../client/common/configuration/service'; -import { PylintLinterInfo } from '../../client/linters/linterInfo'; - -suite('Linter Info - Pylint', () => { - const workspace = mock(WorkspaceService); - const config = mock(ConfigurationService); - - test('Test disabled when Pylint is explicitly disabled', async () => { - const linterInfo = new PylintLinterInfo(instance(config), instance(workspace), []); - - when(config.getSettings(anything())).thenReturn({ - linting: { pylintEnabled: false }, - languageServer: LanguageServerType.Jedi, - } as any); - - expect(linterInfo.isEnabled()).to.be.false; - }); - test('Test disabled when Jedi is enabled and Pylint is explicitly disabled', async () => { - const linterInfo = new PylintLinterInfo(instance(config), instance(workspace), []); - - when(config.getSettings(anything())).thenReturn({ - linting: { pylintEnabled: false }, - languageServer: LanguageServerType.Jedi, - } as any); - - expect(linterInfo.isEnabled()).to.be.false; - }); - test('Test enabled when Jedi is enabled and Pylint is explicitly enabled', async () => { - const linterInfo = new PylintLinterInfo(instance(config), instance(workspace), []); - - when(config.getSettings(anything())).thenReturn({ - linting: { pylintEnabled: true }, - languageServer: LanguageServerType.Jedi, - } as any); - - expect(linterInfo.isEnabled()).to.be.true; - }); - test('Test disabled when using language server and Pylint is not configured', async () => { - const linterInfo = new PylintLinterInfo(instance(config), instance(workspace), []); - - when(config.getSettings(anything())).thenReturn({ - linting: { pylintEnabled: true }, - languageServer: LanguageServerType.Microsoft, - } as any); - - const pythonConfig = { - inspect: () => {}, - }; - when(workspace.getConfiguration('python', anything())).thenReturn(pythonConfig as any); - - expect(linterInfo.isEnabled()).to.be.false; - }); - test('Should inspect the value of linting.pylintEnabled when using language server', async () => { - const linterInfo = new PylintLinterInfo(instance(config), instance(workspace), []); - const inspectStub = sinon.stub(); - const pythonConfig = { - inspect: inspectStub, - }; - - when(config.getSettings(anything())).thenReturn({ - linting: { pylintEnabled: true }, - languageServer: LanguageServerType.Microsoft, - } as any); - when(workspace.getConfiguration('python', anything())).thenReturn(pythonConfig as any); - - expect(linterInfo.isEnabled()).to.be.false; - expect(inspectStub.calledOnceWith('linting.pylintEnabled')).to.be.true; - }); - const testsForisEnabled = [ - { - testName: 'When workspaceFolder setting is provided', - inspection: { workspaceFolderValue: true }, - }, - { - testName: 'When workspace setting is provided', - inspection: { workspaceValue: true }, - }, - { - testName: 'When global setting is provided', - inspection: { globalValue: true }, - }, - ]; - - suite('Test is enabled when using Language Server and Pylint is configured', () => { - testsForisEnabled.forEach((testParams) => { - test(testParams.testName, async () => { - const config = mock(ConfigurationService); - const workspaceService = mock(WorkspaceService); - const linterInfo = new PylintLinterInfo(instance(config), instance(workspaceService), []); - - const pythonConfig = { - inspect: () => testParams.inspection, - }; - when(config.getSettings(anything())).thenReturn({ - linting: { pylintEnabled: true }, - languageServer: LanguageServerType.Microsoft, - } as any); - when(workspaceService.getConfiguration('python', anything())).thenReturn(pythonConfig as any); - - expect(linterInfo.isEnabled()).to.be.true; - }); - }); - }); -}); diff --git a/src/test/linters/pylint.test.ts b/src/test/linters/pylint.test.ts index d5ddc79ee864..0973df35d854 100644 --- a/src/test/linters/pylint.test.ts +++ b/src/test/linters/pylint.test.ts @@ -19,7 +19,7 @@ import { LanguageServerType } from '../../client/activation/types'; import { IWorkspaceService } from '../../client/common/application/types'; import { IFileSystem, IPlatformService } from '../../client/common/platform/types'; import { IPythonToolExecutionService } from '../../client/common/process/types'; -import { ExecutionInfo, IConfigurationService, IInstaller, IPythonSettings } from '../../client/common/types'; +import { IConfigurationService, IInstaller, IPythonSettings } from '../../client/common/types'; import { IInterpreterAutoSelectionService, IInterpreterAutoSelectionProxyService, @@ -33,10 +33,6 @@ import { MockLintingSettings } from '../mockClasses'; import { MockAutoSelectionService } from '../mocks/autoSelector'; suite('Linting - Pylint', () => { - const basePath = '/user/a/b/c/d'; - const pylintrc = 'pylintrc'; - const dotPylintrc = '.pylintrc'; - let fileSystem: TypeMoq.IMock; let platformService: TypeMoq.IMock; let workspace: TypeMoq.IMock; @@ -88,144 +84,12 @@ suite('Linting - Pylint', () => { workspace.setup((w) => w.getConfiguration('python')).returns(() => workspaceConfig.object); serviceManager.addSingletonInstance(IConfigurationService, config.object); - const linterManager = new LinterManager(serviceContainer, workspace.object); + const linterManager = new LinterManager(config.object); serviceManager.addSingletonInstance(ILinterManager, linterManager); const installer = TypeMoq.Mock.ofType(); serviceManager.addSingletonInstance(IInstaller, installer.object); }); - test('pylintrc in the file folder', async () => { - fileSystem.setup((x) => x.fileExists(path.join(basePath, pylintrc))).returns(() => Promise.resolve(true)); - let result = await Pylint.hasConfigurationFile(fileSystem.object, basePath, platformService.object); - expect(result).to.be.equal(true, `'${pylintrc}' not detected in the file folder.`); - - fileSystem.setup((x) => x.fileExists(path.join(basePath, dotPylintrc))).returns(() => Promise.resolve(true)); - result = await Pylint.hasConfigurationFile(fileSystem.object, basePath, platformService.object); - expect(result).to.be.equal(true, `'${dotPylintrc}' not detected in the file folder.`); - }); - test('pylintrc up the module tree', async () => { - const module1 = path.join('/user/a/b/c/d', '__init__.py'); - const module2 = path.join('/user/a/b/c', '__init__.py'); - const module3 = path.join('/user/a/b', '__init__.py'); - const rc = path.join('/user/a/b/c', pylintrc); - - fileSystem.setup((x) => x.fileExists(module1)).returns(() => Promise.resolve(true)); - fileSystem.setup((x) => x.fileExists(module2)).returns(() => Promise.resolve(true)); - fileSystem.setup((x) => x.fileExists(module3)).returns(() => Promise.resolve(true)); - fileSystem.setup((x) => x.fileExists(rc)).returns(() => Promise.resolve(true)); - - const result = await Pylint.hasConfigurationFile(fileSystem.object, basePath, platformService.object); - expect(result).to.be.equal(true, `'${pylintrc}' not detected in the module tree.`); - }); - test('.pylintrc up the module tree', async () => { - // Don't use path.join since it will use / on Travis and Mac - const module1 = path.join('/user/a/b/c/d', '__init__.py'); - const module2 = path.join('/user/a/b/c', '__init__.py'); - const module3 = path.join('/user/a/b', '__init__.py'); - const rc = path.join('/user/a/b/c', pylintrc); - - fileSystem.setup((x) => x.fileExists(module1)).returns(() => Promise.resolve(true)); - fileSystem.setup((x) => x.fileExists(module2)).returns(() => Promise.resolve(true)); - fileSystem.setup((x) => x.fileExists(module3)).returns(() => Promise.resolve(true)); - fileSystem.setup((x) => x.fileExists(rc)).returns(() => Promise.resolve(true)); - - const result = await Pylint.hasConfigurationFile(fileSystem.object, basePath, platformService.object); - expect(result).to.be.equal(true, `'${dotPylintrc}' not detected in the module tree.`); - }); - test('.pylintrc up the ~ folder', async () => { - const home = os.homedir(); - const rc = path.join(home, dotPylintrc); - fileSystem.setup((x) => x.fileExists(rc)).returns(() => Promise.resolve(true)); - - const result = await Pylint.hasConfigurationFile(fileSystem.object, basePath, platformService.object); - expect(result).to.be.equal(true, `'${dotPylintrc}' not detected in the ~ folder.`); - }); - test('pylintrc up the ~/.config folder', async () => { - const home = os.homedir(); - const rc = path.join(home, '.config', pylintrc); - fileSystem.setup((x) => x.fileExists(rc)).returns(() => Promise.resolve(true)); - - const result = await Pylint.hasConfigurationFile(fileSystem.object, basePath, platformService.object); - expect(result).to.be.equal(true, `'${pylintrc}' not detected in the ~/.config folder.`); - }); - test('pylintrc in the /etc folder', async () => { - const rc = path.join('/etc', pylintrc); - fileSystem.setup((x) => x.fileExists(rc)).returns(() => Promise.resolve(true)); - - const result = await Pylint.hasConfigurationFile(fileSystem.object, basePath, platformService.object); - expect(result).to.be.equal(true, `'${pylintrc}' not detected in the /etc folder.`); - }); - test('pylintrc between file and workspace root', async () => { - const root = '/user/a'; - const midFolder = '/user/a/b'; - fileSystem.setup((x) => x.fileExists(path.join(midFolder, pylintrc))).returns(() => Promise.resolve(true)); - - const result = await Pylint.hasConfigurationFileInWorkspace(fileSystem.object, basePath, root); - expect(result).to.be.equal(true, `'${pylintrc}' not detected in the workspace tree.`); - }); - - test('minArgs - pylintrc between the file and the workspace root', async () => { - fileSystem.setup((x) => x.fileExists(path.join('/user/a/b', pylintrc))).returns(() => Promise.resolve(true)); - - await testPylintArguments('/user/a/b/c', '/user/a', false); - }); - - test('minArgs - no pylintrc between the file and the workspace root', async () => { - await testPylintArguments('/user/a/b/c', '/user/a', true); - }); - - test('minArgs - pylintrc next to the file', async () => { - const fileFolder = '/user/a/b/c'; - fileSystem.setup((x) => x.fileExists(path.join(fileFolder, pylintrc))).returns(() => Promise.resolve(true)); - - await testPylintArguments(fileFolder, '/user/a', false); - }); - - test('minArgs - pylintrc at the workspace root', async () => { - const root = '/user/a'; - fileSystem.setup((x) => x.fileExists(path.join(root, pylintrc))).returns(() => Promise.resolve(true)); - - await testPylintArguments('/user/a/b/c', root, false); - }); - - async function testPylintArguments(fileFolder: string, wsRoot: string, expectedMinArgs: boolean): Promise { - const outputChannel = TypeMoq.Mock.ofType(); - const pylinter = new Pylint(outputChannel.object, serviceContainer); - - const document = TypeMoq.Mock.ofType(); - document.setup((x) => x.uri).returns(() => Uri.file(path.join(fileFolder, 'test.py'))); - - const wsf = TypeMoq.Mock.ofType(); - wsf.setup((x) => x.uri).returns(() => Uri.file(wsRoot)); - - workspace.setup((x) => x.getWorkspaceFolder(TypeMoq.It.isAny())).returns(() => wsf.object); - - let execInfo: ExecutionInfo | undefined; - execService - .setup((x) => x.exec(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())) - .callback((e: ExecutionInfo) => { - execInfo = e; - }) - .returns(() => Promise.resolve({ stdout: '', stderr: '' })); - - const lintSettings = new MockLintingSettings(); - lintSettings.pylintUseMinimalCheckers = true; - - lintSettings.pylintPath = 'pyLint'; - - lintSettings.pylintEnabled = true; - - const settings = TypeMoq.Mock.ofType(); - settings.setup((x) => x.linting).returns(() => lintSettings); - settings.setup((x) => x.languageServer).returns(() => LanguageServerType.Jedi); - config.setup((x) => x.getSettings(TypeMoq.It.isAny())).returns(() => settings.object); - - await pylinter.lint(document.object, new CancellationTokenSource().token); - expect( - execInfo!.args.findIndex((x) => x.indexOf('--disable=all') >= 0), - 'Minimal args passed to pylint while pylintrc exists.', - ).to.be.eq(expectedMinArgs ? 0 : -1); - } test('Negative column numbers should be treated 0', async () => { const fileFolder = '/user/a/b/c'; const outputChannel = TypeMoq.Mock.ofType(); @@ -250,7 +114,6 @@ suite('Linting - Pylint', () => { .returns(() => Promise.resolve({ stdout: linterOutput, stderr: '' })); const lintSettings = new MockLintingSettings(); - lintSettings.pylintUseMinimalCheckers = false; lintSettings.maxNumberOfProblems = 1000; lintSettings.pylintPath = 'pyLint'; lintSettings.pylintEnabled = true; diff --git a/src/test/linters/pylint.unit.test.ts b/src/test/linters/pylint.unit.test.ts index a642d7400f00..46321f9787e2 100644 --- a/src/test/linters/pylint.unit.test.ts +++ b/src/test/linters/pylint.unit.test.ts @@ -1,296 +1,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import { assert, expect } from 'chai'; -import * as os from 'os'; -import * as path from 'path'; +import { assert } from 'chai'; import * as sinon from 'sinon'; import { mock } from 'ts-mockito'; import * as TypeMoq from 'typemoq'; import * as vscode from 'vscode'; import { IWorkspaceService } from '../../client/common/application/types'; -import { PlatformService } from '../../client/common/platform/platformService'; import { IFileSystem, IPlatformService } from '../../client/common/platform/types'; import { IConfigurationService, IOutputChannel } from '../../client/common/types'; import { IServiceContainer } from '../../client/ioc/types'; import { Pylint } from '../../client/linters/pylint'; import { ILinterInfo, ILinterManager, ILintMessage, LintMessageSeverity } from '../../client/linters/types'; -suite('Pylint - Function hasConfigurationFile()', () => { - const folder = path.join('user', 'a', 'b', 'c', 'd'); - const oldValueOfPYLINTRC = process.env.PYLINTRC; - const pylintrcFiles = ['pylintrc', '.pylintrc']; - const pylintrc = 'pylintrc'; - const dotPylintrc = '.pylintrc'; - let fileSystem: TypeMoq.IMock; - let platformService: TypeMoq.IMock; - let serviceContainer: TypeMoq.IMock; - - setup(() => { - serviceContainer = TypeMoq.Mock.ofType(); - serviceContainer.setup((c) => c.get(TypeMoq.It.isValue(IFileSystem))).returns(() => fileSystem.object); - serviceContainer - .setup((c) => c.get(TypeMoq.It.isValue(IPlatformService))) - .returns(() => platformService.object); - fileSystem = TypeMoq.Mock.ofType(); - fileSystem - .setup((x) => x.arePathsSame(TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString())) - .returns((a, b) => a === b); - - platformService = TypeMoq.Mock.ofType(); - }); - - teardown(() => { - if (oldValueOfPYLINTRC === undefined) { - delete process.env.PYLINTRC; - } else { - process.env.PYLINTRC = oldValueOfPYLINTRC; - } - }); - - pylintrcFiles.forEach((pylintrcFile) => { - test(`If ${pylintrcFile} exists in the current working directory, return true`, async () => { - fileSystem - .setup((x) => x.fileExists(path.join(folder, pylintrc))) - .returns(() => Promise.resolve(pylintrc === pylintrcFile)); - fileSystem - .setup((x) => x.fileExists(path.join(folder, dotPylintrc))) - .returns(() => Promise.resolve(dotPylintrc === pylintrcFile)); - const hasConfig = await Pylint.hasConfigurationFile(fileSystem.object, folder, platformService.object); - expect(hasConfig).to.equal(true, 'Should return true'); - }); - - test(`If the current working directory is in a Python module, Pylint searches up the hierarchy of Python modules until it finds a ${pylintrcFile} file. And if ${pylintrcFile} exists, return true`, async () => { - fileSystem - .setup((x) => x.fileExists(path.join(path.join('user', 'a', 'b', 'c', 'd'), '__init__.py'))) - .returns(() => Promise.resolve(true)) - .verifiable(TypeMoq.Times.once()); - fileSystem - .setup((x) => x.fileExists(path.join(path.join('user', 'a', 'b', 'c', 'd'), pylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.atLeastOnce()); - fileSystem - .setup((x) => x.fileExists(path.join(path.join('user', 'a', 'b', 'c', 'd'), dotPylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.atLeastOnce()); - - fileSystem - .setup((x) => x.fileExists(path.join(path.join('user', 'a', 'b', 'c'), '__init__.py'))) - .returns(() => Promise.resolve(true)) - .verifiable(TypeMoq.Times.once()); - fileSystem - .setup((x) => x.fileExists(path.join(path.join('user', 'a', 'b', 'c'), pylintrc))) - .returns(() => Promise.resolve(pylintrc === pylintrcFile)); - fileSystem - .setup((x) => x.fileExists(path.join(path.join('user', 'a', 'b', 'c'), dotPylintrc))) - .returns(() => Promise.resolve(dotPylintrc === pylintrcFile)); - const hasConfig = await Pylint.hasConfigurationFile(fileSystem.object, folder, platformService.object); - expect(hasConfig).to.equal(true, 'Should return true'); - fileSystem.verifyAll(); - platformService.verifyAll(); - }); - - test(`If ${pylintrcFile} exists in the home directory, return true`, async () => { - const home = os.homedir(); - fileSystem.setup((x) => x.fileExists(path.join(folder, pylintrc))).returns(() => Promise.resolve(false)); - fileSystem.setup((x) => x.fileExists(path.join(folder, dotPylintrc))).returns(() => Promise.resolve(false)); - fileSystem - .setup((x) => x.fileExists(path.join(folder, '__init__.py'))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.once()); - fileSystem - .setup((x) => x.fileExists(path.join(home, '.config', pylintrc))) - .returns(() => Promise.resolve(pylintrc === pylintrcFile)); - fileSystem - .setup((x) => x.fileExists(path.join(home, dotPylintrc))) - .returns(() => Promise.resolve(dotPylintrc === pylintrcFile)); - const hasConfig = await Pylint.hasConfigurationFile(fileSystem.object, folder, platformService.object); - expect(hasConfig).to.equal(true, 'Should return true'); - fileSystem.verifyAll(); - platformService.verifyAll(); - }); - }); - - test('If /etc/pylintrc exists in non-Windows platform, return true', async function () { - if (new PlatformService().isWindows) { - return this.skip(); - } - const home = os.homedir(); - fileSystem - .setup((x) => x.fileExists(path.join(folder, pylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.once()); - fileSystem - .setup((x) => x.fileExists(path.join(folder, dotPylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.once()); - fileSystem - .setup((x) => x.fileExists(path.join(folder, '__init__.py'))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.once()); - fileSystem - .setup((x) => x.fileExists(path.join(home, '.config', pylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.once()); - fileSystem - .setup((x) => x.fileExists(path.join(home, dotPylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.once()); - platformService.setup((x) => x.isWindows).returns(() => false); - fileSystem.setup((x) => x.fileExists(path.join('/etc', pylintrc))).returns(() => Promise.resolve(true)); - const hasConfig = await Pylint.hasConfigurationFile(fileSystem.object, folder, platformService.object); - expect(hasConfig).to.equal(true, 'Should return true'); - fileSystem.verifyAll(); - platformService.verifyAll(); - }); - - test('If none of the pylintrc configuration files exist anywhere, return false', async () => { - const home = os.homedir(); - fileSystem - .setup((x) => x.fileExists(path.join(folder, pylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.once()); - fileSystem - .setup((x) => x.fileExists(path.join(folder, dotPylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.once()); - fileSystem - .setup((x) => x.fileExists(path.join(folder, '__init__.py'))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.once()); - fileSystem - .setup((x) => x.fileExists(path.join(home, '.config', pylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.once()); - fileSystem - .setup((x) => x.fileExists(path.join(home, dotPylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.once()); - platformService - .setup((x) => x.isWindows) - .returns(() => false) - .verifiable(TypeMoq.Times.once()); - fileSystem - .setup((x) => x.fileExists(path.join('/etc', pylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.once()); - const hasConfig = await Pylint.hasConfigurationFile(fileSystem.object, folder, platformService.object); - expect(hasConfig).to.equal(false, 'Should return false'); - fileSystem.verifyAll(); - platformService.verifyAll(); - }); - - test('If process.env.PYLINTRC contains the path to pylintrc, return true', async () => { - process.env.PYLINTRC = path.join('path', 'to', 'pylintrc'); - const hasConfig = await Pylint.hasConfigurationFile(fileSystem.object, folder, platformService.object); - expect(hasConfig).to.equal(true, 'Should return true'); - }); -}); - -suite('Pylint - Function hasConfigurationFileInWorkspace()', () => { - const pylintrc = 'pylintrc'; - const dotPylintrc = '.pylintrc'; - let fileSystem: TypeMoq.IMock; - let platformService: TypeMoq.IMock; - let serviceContainer: TypeMoq.IMock; - - setup(() => { - serviceContainer = TypeMoq.Mock.ofType(); - serviceContainer.setup((c) => c.get(TypeMoq.It.isValue(IFileSystem))).returns(() => fileSystem.object); - serviceContainer - .setup((c) => c.get(TypeMoq.It.isValue(IPlatformService))) - .returns(() => platformService.object); - fileSystem = TypeMoq.Mock.ofType(); - fileSystem - .setup((x) => x.arePathsSame(TypeMoq.It.isAnyString(), TypeMoq.It.isAnyString())) - .returns((a, b) => a === b); - - platformService = TypeMoq.Mock.ofType(); - }); - - test('If none of the pylintrc files exist up to the workspace root, return false', async () => { - const folder = path.join('user', 'a', 'b', 'c'); - const root = path.join('user', 'a'); - - const rootPathItems = ['user', 'a']; - const folderPathItems = ['b', 'c']; // full folder path will be prefixed by root path - let rootPath = ''; - rootPathItems.forEach((item) => { - rootPath = path.join(rootPath, item); - fileSystem - .setup((x) => x.fileExists(path.join(rootPath, pylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.never()); - fileSystem - .setup((x) => x.fileExists(path.join(rootPath, dotPylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.never()); - }); - let relativeFolderPath = ''; - folderPathItems.forEach((item) => { - relativeFolderPath = path.join(relativeFolderPath, item); - const absoluteFolderPath = path.join(rootPath, relativeFolderPath); - fileSystem - .setup((x) => x.fileExists(path.join(absoluteFolderPath, pylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.once()); - fileSystem - .setup((x) => x.fileExists(path.join(absoluteFolderPath, dotPylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.once()); - }); - - const hasConfig = await Pylint.hasConfigurationFileInWorkspace(fileSystem.object, folder, root); - expect(hasConfig).to.equal(false, 'Should return false'); - fileSystem.verifyAll(); - }); - - [pylintrc, dotPylintrc].forEach((pylintrcFile) => { - test(`If ${pylintrcFile} exists while traversing up to the workspace root, return true`, async () => { - const folder = path.join('user', 'a', 'b', 'c'); - const root = path.join('user', 'a'); - - fileSystem - .setup((x) => x.fileExists(path.join(path.join('user', 'a', 'b', 'c'), pylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.once()); - fileSystem - .setup((x) => x.fileExists(path.join(path.join('user', 'a', 'b', 'c'), dotPylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.once()); - - fileSystem - .setup((x) => x.fileExists(path.join(path.join('user', 'a', 'b'), pylintrc))) - .returns(() => Promise.resolve(pylintrc === pylintrcFile)); - fileSystem - .setup((x) => x.fileExists(path.join(path.join('user', 'a', 'b'), dotPylintrc))) - .returns(() => Promise.resolve(dotPylintrc === pylintrcFile)); - - fileSystem - .setup((x) => x.fileExists(path.join(path.join('user', 'a'), pylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.never()); - fileSystem - .setup((x) => x.fileExists(path.join(path.join('user', 'a'), dotPylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.never()); - - fileSystem - .setup((x) => x.fileExists(path.join(path.join('user'), dotPylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.never()); - fileSystem - .setup((x) => x.fileExists(path.join(path.join('user'), dotPylintrc))) - .returns(() => Promise.resolve(false)) - .verifiable(TypeMoq.Times.never()); - - const hasConfig = await Pylint.hasConfigurationFileInWorkspace(fileSystem.object, folder, root); - expect(hasConfig).to.equal(true, 'Should return true'); - fileSystem.verifyAll(); - }); - }); -}); - suite('Pylint - Function runLinter()', () => { let fileSystem: TypeMoq.IMock; let serviceContainer: TypeMoq.IMock; @@ -302,24 +24,6 @@ suite('Pylint - Function runLinter()', () => { let platformService: TypeMoq.IMock; let run: sinon.SinonStub; let parseMessagesSeverity: sinon.SinonStub; - const minArgs = [ - '--disable=all', - '--enable=F' + - ',unreachable,duplicate-key,unnecessary-semicolon' + - ',global-variable-not-assigned,unused-variable' + - ',unused-wildcard-import,binary-op-exception' + - ',bad-format-string,anomalous-backslash-in-string' + - ',bad-open-mode' + - ',E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107' + - ',E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118' + - ',E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241' + - ',E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611' + - ',E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003' + - ',E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127' + - ',E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137' + - ',E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303' + - ',E1304,E1305,E1306,E1310,E1700,E1701', - ]; const doc = { uri: vscode.Uri.file('path/to/doc'), }; @@ -329,9 +33,6 @@ suite('Pylint - Function runLinter()', () => { '--output-format=text', doc.uri.fsPath, ]; - const original_hasConfigurationFileInWorkspace = Pylint.hasConfigurationFileInWorkspace; - const original_hasConfigurationFile = Pylint.hasConfigurationFile; - class PylintTest extends Pylint { public async run( _args: string[], @@ -386,105 +87,17 @@ suite('Pylint - Function runLinter()', () => { }); teardown(() => { - Pylint.hasConfigurationFileInWorkspace = original_hasConfigurationFileInWorkspace; - Pylint.hasConfigurationFile = original_hasConfigurationFile; sinon.restore(); }); - test('Use minimal checkers if a) setting to use minimal checkers is true, b) there are no custom arguments and c) there is no pylintrc file next to the file or at the workspace root and above', async () => { - const settings = { - linting: { - pylintUseMinimalCheckers: true, - }, - }; - configService.setup((c) => c.getSettings(doc.uri)).returns(() => settings as any); - _info.setup((info) => info.linterArgs(doc.uri)).returns(() => []); - Pylint.hasConfigurationFileInWorkspace = () => Promise.resolve(false); - Pylint.hasConfigurationFile = () => Promise.resolve(false); - run = sinon.stub(PylintTest.prototype, 'run'); - run.callsFake(() => Promise.resolve([])); - parseMessagesSeverity = sinon.stub(PylintTest.prototype, 'parseMessagesSeverity'); - parseMessagesSeverity.callsFake(() => 'Severity'); - const pylint = new PylintTest(output.object, serviceContainer.object); - await pylint.runLinter(doc as any, mock(vscode.CancellationTokenSource).token); - assert.deepEqual(run.args[0][0], minArgs.concat(args)); - assert.ok(parseMessagesSeverity.notCalled); - assert.ok(run.calledOnce); - }); - - test('Do not use minimal checkers if setting to use minimal checkers is false', async () => { - const settings = { - linting: { - pylintUseMinimalCheckers: false, - }, - }; - configService.setup((c) => c.getSettings(doc.uri)).returns(() => settings as any); - _info.setup((info) => info.linterArgs(doc.uri)).returns(() => []); - Pylint.hasConfigurationFileInWorkspace = () => Promise.resolve(false); - Pylint.hasConfigurationFile = () => Promise.resolve(false); - run = sinon.stub(PylintTest.prototype, 'run'); - run.callsFake(() => Promise.resolve([])); - parseMessagesSeverity = sinon.stub(PylintTest.prototype, 'parseMessagesSeverity'); - parseMessagesSeverity.callsFake(() => 'Severity'); - const pylint = new PylintTest(output.object, serviceContainer.object); - await pylint.runLinter(doc as any, mock(vscode.CancellationTokenSource).token); - assert.deepEqual(run.args[0][0], args); - assert.ok(parseMessagesSeverity.notCalled); - assert.ok(run.calledOnce); - }); - - test('Do not use minimal checkers if there are custom arguments', async () => { - const settings = { - linting: { - pylintUseMinimalCheckers: true, - }, - }; - configService.setup((c) => c.getSettings(doc.uri)).returns(() => settings as any); - _info.setup((info) => info.linterArgs(doc.uri)).returns(() => ['customArg1', 'customArg2']); - Pylint.hasConfigurationFileInWorkspace = () => Promise.resolve(false); - Pylint.hasConfigurationFile = () => Promise.resolve(false); - run = sinon.stub(PylintTest.prototype, 'run'); - run.callsFake(() => Promise.resolve([])); - parseMessagesSeverity = sinon.stub(PylintTest.prototype, 'parseMessagesSeverity'); - parseMessagesSeverity.callsFake(() => 'Severity'); - const pylint = new PylintTest(output.object, serviceContainer.object); - await pylint.runLinter(doc as any, mock(vscode.CancellationTokenSource).token); - assert.deepEqual(run.args[0][0], args); - assert.ok(parseMessagesSeverity.notCalled); - assert.ok(run.calledOnce); - }); - - test('Do not use minimal checkers if there is a pylintrc file in the current working directory or when traversing the workspace up to its root (hasConfigurationFileInWorkspace() returns true)', async () => { - const settings = { - linting: { - pylintUseMinimalCheckers: true, - }, - }; - configService.setup((c) => c.getSettings(doc.uri)).returns(() => settings as any); - _info.setup((info) => info.linterArgs(doc.uri)).returns(() => []); - Pylint.hasConfigurationFileInWorkspace = () => Promise.resolve(true); // This implies method hasConfigurationFileInWorkspace() returns true - Pylint.hasConfigurationFile = () => Promise.resolve(false); - run = sinon.stub(PylintTest.prototype, 'run'); - run.callsFake(() => Promise.resolve([])); - parseMessagesSeverity = sinon.stub(PylintTest.prototype, 'parseMessagesSeverity'); - parseMessagesSeverity.callsFake(() => 'Severity'); - const pylint = new PylintTest(output.object, serviceContainer.object); - await pylint.runLinter(doc as any, mock(vscode.CancellationTokenSource).token); - assert.deepEqual(run.args[0][0], args); - assert.ok(parseMessagesSeverity.notCalled); - assert.ok(run.calledOnce); - }); - - test('Do not use minimal checkers if a pylintrc file exists in the process, in the current working directory or up in the hierarchy tree (hasConfigurationFile() returns true)', async () => { + test('Test pylint with default settings.', async () => { const settings = { linting: { - pylintUseMinimalCheckers: true, + pylintEnabled: true, }, }; configService.setup((c) => c.getSettings(doc.uri)).returns(() => settings as any); _info.setup((info) => info.linterArgs(doc.uri)).returns(() => []); - Pylint.hasConfigurationFileInWorkspace = () => Promise.resolve(false); - Pylint.hasConfigurationFile = () => Promise.resolve(true); // This implies method hasConfigurationFile() returns true run = sinon.stub(PylintTest.prototype, 'run'); run.callsFake(() => Promise.resolve([])); parseMessagesSeverity = sinon.stub(PylintTest.prototype, 'parseMessagesSeverity'); @@ -510,13 +123,11 @@ suite('Pylint - Function runLinter()', () => { ]; const settings = { linting: { - pylintUseMinimalCheckers: true, + pylintEnabled: true, }, }; configService.setup((c) => c.getSettings(doc.uri)).returns(() => settings as any); _info.setup((info) => info.linterArgs(doc.uri)).returns(() => []); - Pylint.hasConfigurationFileInWorkspace = () => Promise.resolve(false); - Pylint.hasConfigurationFile = () => Promise.resolve(false); run = sinon.stub(PylintTest.prototype, 'run'); run.callsFake(() => Promise.resolve(message as any)); parseMessagesSeverity = sinon.stub(PylintTest.prototype, 'parseMessagesSeverity'); diff --git a/src/test/mockClasses.ts b/src/test/mockClasses.ts index d524d774aac2..16d4c32b077d 100644 --- a/src/test/mockClasses.ts +++ b/src/test/mockClasses.ts @@ -88,5 +88,4 @@ export class MockLintingSettings implements ILintingSettings { public banditEnabled!: boolean; public banditArgs!: string[]; public banditPath!: string; - public pylintUseMinimalCheckers!: boolean; } From 17e58a9f7ded2bfff98807c05c94bca05b12c615 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Wed, 5 May 2021 16:31:55 -0700 Subject: [PATCH 04/13] Remove unused files and update branch (#16128) * Add the 'security-events' permission to the CodeQL workflow (#16071) * Delete misc files we don't need anymore Co-authored-by: Brett Cannon --- resources/ctagOptions | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 resources/ctagOptions diff --git a/resources/ctagOptions b/resources/ctagOptions deleted file mode 100644 index 3b656ac370fe..000000000000 --- a/resources/ctagOptions +++ /dev/null @@ -1,23 +0,0 @@ ---recurse=yes ---tag-relative=yes ---exclude=.git ---exclude=log ---exclude=tmp ---exclude=doc ---exclude=deps ---exclude=node_modules ---exclude=.vscode ---exclude=public/assets ---exclude=*.git* ---exclude=*.pyc ---exclude=*.pyo ---exclude=.DS_Store ---exclude=**/*.jar ---exclude=**/*.class ---exclude=**/.idea/ ---exclude=build ---exclude=Builds ---exclude=doc ---fields=Knz ---extra=+f ---append=no \ No newline at end of file From 9347fce1592ff6e1bc1d55b81af710bcd45bc678 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Mon, 10 May 2021 14:11:23 -0700 Subject: [PATCH 05/13] Rebase with main --- src/test/common/installer/installer.unit.test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/test/common/installer/installer.unit.test.ts b/src/test/common/installer/installer.unit.test.ts index 4ebac0bed867..999b8fcbc82e 100644 --- a/src/test/common/installer/installer.unit.test.ts +++ b/src/test/common/installer/installer.unit.test.ts @@ -17,7 +17,13 @@ import { ConfigurationService } from '../../../client/common/configuration/servi import { Commands } from '../../../client/common/constants'; import { ExperimentService } from '../../../client/common/experiments/service'; import '../../../client/common/extensions'; -import { FormatterInstaller, ProductInstaller } from '../../../client/common/installer/productInstaller'; +import { + FormatterInstaller, + LinterInstaller, + ProductInstaller, +} from '../../../client/common/installer/productInstaller'; +import { ProductNames } from '../../../client/common/installer/productNames'; +import { LinterProductPathService } from '../../../client/common/installer/productPath'; import { ProductService } from '../../../client/common/installer/productService'; import { IInstallationChannelManager, From d166031a2bc304d82364c545a3bf38839b338ea6 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Thu, 5 Aug 2021 21:50:48 -0700 Subject: [PATCH 06/13] Update news items. --- news/3 Code Health/10440.md | 1 + news/3 Code Health/13321.md | 1 + news/3 Code Health/16063.md | 1 + 3 files changed, 3 insertions(+) create mode 100644 news/3 Code Health/10440.md create mode 100644 news/3 Code Health/13321.md create mode 100644 news/3 Code Health/16063.md diff --git a/news/3 Code Health/10440.md b/news/3 Code Health/10440.md new file mode 100644 index 000000000000..e237305ef278 --- /dev/null +++ b/news/3 Code Health/10440.md @@ -0,0 +1 @@ +Remove support for `rope`. Refactoring now supported via language servers. diff --git a/news/3 Code Health/13321.md b/news/3 Code Health/13321.md new file mode 100644 index 000000000000..83c8d97b63ea --- /dev/null +++ b/news/3 Code Health/13321.md @@ -0,0 +1 @@ +Remove `pylintMinimalCheckers` setting. Syntax errors now reported via language servers. diff --git a/news/3 Code Health/16063.md b/news/3 Code Health/16063.md new file mode 100644 index 000000000000..f2a1346b9474 --- /dev/null +++ b/news/3 Code Health/16063.md @@ -0,0 +1 @@ +Remove `ctags` support. Workspace symbols now supported via language servers. From 7819c78c2303e29c782b1325b32209b593ca35c3 Mon Sep 17 00:00:00 2001 From: Kim-Adeline Miguel Date: Wed, 15 Sep 2021 16:20:15 -0700 Subject: [PATCH 07/13] Remove unused telemetry --- src/client/telemetry/constants.ts | 5 ----- src/client/telemetry/index.ts | 36 ------------------------------- 2 files changed, 41 deletions(-) diff --git a/src/client/telemetry/constants.ts b/src/client/telemetry/constants.ts index a171efd122ef..c89766f1b321 100644 --- a/src/client/telemetry/constants.ts +++ b/src/client/telemetry/constants.ts @@ -10,8 +10,6 @@ export enum EventName { FORMAT_ON_TYPE = 'FORMAT.FORMAT_ON_TYPE', EDITOR_LOAD = 'EDITOR.LOAD', LINTING = 'LINTING', - REFACTOR_EXTRACT_VAR = 'REFACTOR_EXTRACT_VAR', - REFACTOR_EXTRACT_FUNCTION = 'REFACTOR_EXTRACT_FUNCTION', REPL = 'REPL', SELECT_INTERPRETER = 'SELECT_INTERPRETER', SELECT_INTERPRETER_ENTER_BUTTON = 'SELECT_INTERPRETER_ENTER_BUTTON', @@ -35,8 +33,6 @@ export enum EventName { INSIDERS_PROMPT = 'INSIDERS_PROMPT', ENVFILE_VARIABLE_SUBSTITUTION = 'ENVFILE_VARIABLE_SUBSTITUTION', ENVFILE_WORKSPACE = 'ENVFILE_WORKSPACE', - WORKSPACE_SYMBOLS_BUILD = 'WORKSPACE_SYMBOLS.BUILD', - WORKSPACE_SYMBOLS_GO_TO = 'WORKSPACE_SYMBOLS.GO_TO', EXECUTION_CODE = 'EXECUTION_CODE', EXECUTION_DJANGO = 'EXECUTION_DJANGO', @@ -102,7 +98,6 @@ export enum EventName { LINTER_NOT_INSTALLED_PROMPT = 'LINTER_NOT_INSTALLED_PROMPT', LINTER_INSTALL_PROMPT = 'LINTER_INSTALL_PROMPT', - CONFIGURE_AVAILABLE_LINTER_PROMPT = 'CONFIGURE_AVAILABLE_LINTER_PROMPT', HASHED_PACKAGE_NAME = 'HASHED_PACKAGE_NAME', HASHED_PACKAGE_PERF = 'HASHED_PACKAGE_PERF', diff --git a/src/client/telemetry/index.ts b/src/client/telemetry/index.ts index 965b24449eda..3f462c55de8a 100644 --- a/src/client/telemetry/index.ts +++ b/src/client/telemetry/index.ts @@ -1338,14 +1338,6 @@ export interface IEventNamePropertyMapping { */ selection: 'Yes' | 'No' | undefined; }; - /** - * Telemetry event sent when 'Extract Method' command is invoked - */ - [EventName.REFACTOR_EXTRACT_FUNCTION]: never | undefined; - /** - * Telemetry event sent when 'Extract Variable' command is invoked - */ - [EventName.REFACTOR_EXTRACT_VAR]: never | undefined; /** * Telemetry event sent when starting REPL */ @@ -1363,26 +1355,6 @@ export interface IEventNamePropertyMapping { */ enabled: boolean; }; - /** - * Telemetry event sent with details when clicking the prompt with the following message, - * `Prompt message` :- 'You have a pylintrc file in your workspace. Do you want to enable pylint?' - */ - [EventName.CONFIGURE_AVAILABLE_LINTER_PROMPT]: { - /** - * Name of the linter tool - * - * @type {LinterId} - */ - tool: LinterId; - /** - * `enable` When 'Enable [linter name]' option is clicked - * `ignore` When 'Not now' option is clicked - * `disablePrompt` When 'Do not show again` option is clicked - * - * @type {('enable' | 'ignore' | 'disablePrompt' | undefined)} - */ - action: 'enable' | 'ignore' | 'disablePrompt' | undefined; - }; /** * Telemetry event sent if and when user configure tests command. This command can be trigerred from multiple places in the extension. (Command palette, prompt etc.) */ @@ -1520,14 +1492,6 @@ export interface IEventNamePropertyMapping { * Telemetry event sent when testing is disabled for a workspace. */ [EventName.UNITTEST_DISABLED]: never | undefined; - /** - * Telemetry sent when building workspace symbols - */ - [EventName.WORKSPACE_SYMBOLS_BUILD]: never | undefined; - /** - * Telemetry sent when providing workspace symbols doing Project-wide search for a symbol matching the given query string - */ - [EventName.WORKSPACE_SYMBOLS_GO_TO]: never | undefined; /* Telemetry event sent to provide information on whether we have successfully identify the type of shell used. This information is useful in determining how well we identify shells on users machines. From e4f2a5ab134bf2a1fbd8430e44acb89f90931f2d Mon Sep 17 00:00:00 2001 From: Kim-Adeline Miguel Date: Wed, 15 Sep 2021 16:20:32 -0700 Subject: [PATCH 08/13] Test build workflow --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eb5527bf2437..c726817a914f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,7 @@ name: Build on: + pull_request: push: branches: - 'main' From 404fec355684cb85ac925346a0524a644a468718 Mon Sep 17 00:00:00 2001 From: Kim-Adeline Miguel Date: Wed, 15 Sep 2021 16:26:52 -0700 Subject: [PATCH 09/13] Remove ropeproject from repo settings --- .vscode/settings.json | 1 - pythonFiles/.vscode/.ropeproject/config.py | 114 ++++++++++++++++++ pythonFiles/.vscode/.ropeproject/objectdb | Bin 0 -> 6 bytes src/test/.vscode/.ropeproject/config.py | 114 ++++++++++++++++++ src/test/.vscode/.ropeproject/objectdb | Bin 0 -> 6 bytes .../.vscode/.ropeproject/config.py | 114 ++++++++++++++++++ .../.vscode/.ropeproject/objectdb | Bin 0 -> 6 bytes .../workspace1/.vscode/.ropeproject/config.py | 114 ++++++++++++++++++ .../workspace1/.vscode/.ropeproject/objectdb | Bin 0 -> 6 bytes 9 files changed, 456 insertions(+), 1 deletion(-) create mode 100644 pythonFiles/.vscode/.ropeproject/config.py create mode 100644 pythonFiles/.vscode/.ropeproject/objectdb create mode 100644 src/test/.vscode/.ropeproject/config.py create mode 100644 src/test/.vscode/.ropeproject/objectdb create mode 100644 src/test/pythonFiles/refactoring/source folder/.vscode/.ropeproject/config.py create mode 100644 src/test/pythonFiles/refactoring/source folder/.vscode/.ropeproject/objectdb create mode 100644 src/testMultiRootWkspc/workspace1/.vscode/.ropeproject/config.py create mode 100644 src/testMultiRootWkspc/workspace1/.vscode/.ropeproject/objectdb diff --git a/.vscode/settings.json b/.vscode/settings.json index 0c37edaa8f23..cf39a41846b8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,7 +12,6 @@ ".vscode-test": false, ".vscode test": false, "**/.mypy_cache/**": true, - "**/.ropeproject/**": true }, "search.exclude": { "out": true, // set this to false to include "out" folder in search results diff --git a/pythonFiles/.vscode/.ropeproject/config.py b/pythonFiles/.vscode/.ropeproject/config.py new file mode 100644 index 000000000000..dee2d1ae9a6b --- /dev/null +++ b/pythonFiles/.vscode/.ropeproject/config.py @@ -0,0 +1,114 @@ +# The default ``config.py`` +# flake8: noqa + + +def set_prefs(prefs): + """This function is called before opening the project""" + + # Specify which files and folders to ignore in the project. + # Changes to ignored resources are not added to the history and + # VCSs. Also they are not returned in `Project.get_files()`. + # Note that ``?`` and ``*`` match all characters but slashes. + # '*.pyc': matches 'test.pyc' and 'pkg/test.pyc' + # 'mod*.pyc': matches 'test/mod1.pyc' but not 'mod/1.pyc' + # '.svn': matches 'pkg/.svn' and all of its children + # 'build/*.o': matches 'build/lib.o' but not 'build/sub/lib.o' + # 'build//*.o': matches 'build/lib.o' and 'build/sub/lib.o' + prefs['ignored_resources'] = ['*.pyc', '*~', '.ropeproject', + '.hg', '.svn', '_svn', '.git', '.tox'] + + # Specifies which files should be considered python files. It is + # useful when you have scripts inside your project. Only files + # ending with ``.py`` are considered to be python files by + # default. + # prefs['python_files'] = ['*.py'] + + # Custom source folders: By default rope searches the project + # for finding source folders (folders that should be searched + # for finding modules). You can add paths to that list. Note + # that rope guesses project source folders correctly most of the + # time; use this if you have any problems. + # The folders should be relative to project root and use '/' for + # separating folders regardless of the platform rope is running on. + # 'src/my_source_folder' for instance. + # prefs.add('source_folders', 'src') + + # You can extend python path for looking up modules + # prefs.add('python_path', '~/python/') + + # Should rope save object information or not. + prefs['save_objectdb'] = True + prefs['compress_objectdb'] = False + + # If `True`, rope analyzes each module when it is being saved. + prefs['automatic_soa'] = True + # The depth of calls to follow in static object analysis + prefs['soa_followed_calls'] = 0 + + # If `False` when running modules or unit tests "dynamic object + # analysis" is turned off. This makes them much faster. + prefs['perform_doa'] = True + + # Rope can check the validity of its object DB when running. + prefs['validate_objectdb'] = True + + # How many undos to hold? + prefs['max_history_items'] = 32 + + # Shows whether to save history across sessions. + prefs['save_history'] = True + prefs['compress_history'] = False + + # Set the number spaces used for indenting. According to + # :PEP:`8`, it is best to use 4 spaces. Since most of rope's + # unit-tests use 4 spaces it is more reliable, too. + prefs['indent_size'] = 4 + + # Builtin and c-extension modules that are allowed to be imported + # and inspected by rope. + prefs['extension_modules'] = [] + + # Add all standard c-extensions to extension_modules list. + prefs['import_dynload_stdmods'] = True + + # If `True` modules with syntax errors are considered to be empty. + # The default value is `False`; When `False` syntax errors raise + # `rope.base.exceptions.ModuleSyntaxError` exception. + prefs['ignore_syntax_errors'] = False + + # If `True`, rope ignores unresolvable imports. Otherwise, they + # appear in the importing namespace. + prefs['ignore_bad_imports'] = False + + # If `True`, rope will insert new module imports as + # `from import ` by default. + prefs['prefer_module_from_imports'] = False + + # If `True`, rope will transform a comma list of imports into + # multiple separate import statements when organizing + # imports. + prefs['split_imports'] = False + + # If `True`, rope will remove all top-level import statements and + # reinsert them at the top of the module when making changes. + prefs['pull_imports_to_top'] = True + + # If `True`, rope will sort imports alphabetically by module name instead + # of alphabetically by import statement, with from imports after normal + # imports. + prefs['sort_imports_alphabetically'] = False + + # Location of implementation of + # rope.base.oi.type_hinting.interfaces.ITypeHintingFactory In general + # case, you don't have to change this value, unless you're an rope expert. + # Change this value to inject you own implementations of interfaces + # listed in module rope.base.oi.type_hinting.providers.interfaces + # For example, you can add you own providers for Django Models, or disable + # the search type-hinting in a class hierarchy, etc. + prefs['type_hinting_factory'] = ( + 'rope.base.oi.type_hinting.factory.default_type_hinting_factory') + + +def project_opened(project): + """This function is called after opening the project""" + # Do whatever you like here! diff --git a/pythonFiles/.vscode/.ropeproject/objectdb b/pythonFiles/.vscode/.ropeproject/objectdb new file mode 100644 index 0000000000000000000000000000000000000000..0a47446c0ad231c193bdd44ff327ba2ab28bf3d8 GIT binary patch literal 6 NcmZo*sx4&D0{{kv0iOT> literal 0 HcmV?d00001 diff --git a/src/test/.vscode/.ropeproject/config.py b/src/test/.vscode/.ropeproject/config.py new file mode 100644 index 000000000000..dee2d1ae9a6b --- /dev/null +++ b/src/test/.vscode/.ropeproject/config.py @@ -0,0 +1,114 @@ +# The default ``config.py`` +# flake8: noqa + + +def set_prefs(prefs): + """This function is called before opening the project""" + + # Specify which files and folders to ignore in the project. + # Changes to ignored resources are not added to the history and + # VCSs. Also they are not returned in `Project.get_files()`. + # Note that ``?`` and ``*`` match all characters but slashes. + # '*.pyc': matches 'test.pyc' and 'pkg/test.pyc' + # 'mod*.pyc': matches 'test/mod1.pyc' but not 'mod/1.pyc' + # '.svn': matches 'pkg/.svn' and all of its children + # 'build/*.o': matches 'build/lib.o' but not 'build/sub/lib.o' + # 'build//*.o': matches 'build/lib.o' and 'build/sub/lib.o' + prefs['ignored_resources'] = ['*.pyc', '*~', '.ropeproject', + '.hg', '.svn', '_svn', '.git', '.tox'] + + # Specifies which files should be considered python files. It is + # useful when you have scripts inside your project. Only files + # ending with ``.py`` are considered to be python files by + # default. + # prefs['python_files'] = ['*.py'] + + # Custom source folders: By default rope searches the project + # for finding source folders (folders that should be searched + # for finding modules). You can add paths to that list. Note + # that rope guesses project source folders correctly most of the + # time; use this if you have any problems. + # The folders should be relative to project root and use '/' for + # separating folders regardless of the platform rope is running on. + # 'src/my_source_folder' for instance. + # prefs.add('source_folders', 'src') + + # You can extend python path for looking up modules + # prefs.add('python_path', '~/python/') + + # Should rope save object information or not. + prefs['save_objectdb'] = True + prefs['compress_objectdb'] = False + + # If `True`, rope analyzes each module when it is being saved. + prefs['automatic_soa'] = True + # The depth of calls to follow in static object analysis + prefs['soa_followed_calls'] = 0 + + # If `False` when running modules or unit tests "dynamic object + # analysis" is turned off. This makes them much faster. + prefs['perform_doa'] = True + + # Rope can check the validity of its object DB when running. + prefs['validate_objectdb'] = True + + # How many undos to hold? + prefs['max_history_items'] = 32 + + # Shows whether to save history across sessions. + prefs['save_history'] = True + prefs['compress_history'] = False + + # Set the number spaces used for indenting. According to + # :PEP:`8`, it is best to use 4 spaces. Since most of rope's + # unit-tests use 4 spaces it is more reliable, too. + prefs['indent_size'] = 4 + + # Builtin and c-extension modules that are allowed to be imported + # and inspected by rope. + prefs['extension_modules'] = [] + + # Add all standard c-extensions to extension_modules list. + prefs['import_dynload_stdmods'] = True + + # If `True` modules with syntax errors are considered to be empty. + # The default value is `False`; When `False` syntax errors raise + # `rope.base.exceptions.ModuleSyntaxError` exception. + prefs['ignore_syntax_errors'] = False + + # If `True`, rope ignores unresolvable imports. Otherwise, they + # appear in the importing namespace. + prefs['ignore_bad_imports'] = False + + # If `True`, rope will insert new module imports as + # `from import ` by default. + prefs['prefer_module_from_imports'] = False + + # If `True`, rope will transform a comma list of imports into + # multiple separate import statements when organizing + # imports. + prefs['split_imports'] = False + + # If `True`, rope will remove all top-level import statements and + # reinsert them at the top of the module when making changes. + prefs['pull_imports_to_top'] = True + + # If `True`, rope will sort imports alphabetically by module name instead + # of alphabetically by import statement, with from imports after normal + # imports. + prefs['sort_imports_alphabetically'] = False + + # Location of implementation of + # rope.base.oi.type_hinting.interfaces.ITypeHintingFactory In general + # case, you don't have to change this value, unless you're an rope expert. + # Change this value to inject you own implementations of interfaces + # listed in module rope.base.oi.type_hinting.providers.interfaces + # For example, you can add you own providers for Django Models, or disable + # the search type-hinting in a class hierarchy, etc. + prefs['type_hinting_factory'] = ( + 'rope.base.oi.type_hinting.factory.default_type_hinting_factory') + + +def project_opened(project): + """This function is called after opening the project""" + # Do whatever you like here! diff --git a/src/test/.vscode/.ropeproject/objectdb b/src/test/.vscode/.ropeproject/objectdb new file mode 100644 index 0000000000000000000000000000000000000000..0a47446c0ad231c193bdd44ff327ba2ab28bf3d8 GIT binary patch literal 6 NcmZo*sx4&D0{{kv0iOT> literal 0 HcmV?d00001 diff --git a/src/test/pythonFiles/refactoring/source folder/.vscode/.ropeproject/config.py b/src/test/pythonFiles/refactoring/source folder/.vscode/.ropeproject/config.py new file mode 100644 index 000000000000..dee2d1ae9a6b --- /dev/null +++ b/src/test/pythonFiles/refactoring/source folder/.vscode/.ropeproject/config.py @@ -0,0 +1,114 @@ +# The default ``config.py`` +# flake8: noqa + + +def set_prefs(prefs): + """This function is called before opening the project""" + + # Specify which files and folders to ignore in the project. + # Changes to ignored resources are not added to the history and + # VCSs. Also they are not returned in `Project.get_files()`. + # Note that ``?`` and ``*`` match all characters but slashes. + # '*.pyc': matches 'test.pyc' and 'pkg/test.pyc' + # 'mod*.pyc': matches 'test/mod1.pyc' but not 'mod/1.pyc' + # '.svn': matches 'pkg/.svn' and all of its children + # 'build/*.o': matches 'build/lib.o' but not 'build/sub/lib.o' + # 'build//*.o': matches 'build/lib.o' and 'build/sub/lib.o' + prefs['ignored_resources'] = ['*.pyc', '*~', '.ropeproject', + '.hg', '.svn', '_svn', '.git', '.tox'] + + # Specifies which files should be considered python files. It is + # useful when you have scripts inside your project. Only files + # ending with ``.py`` are considered to be python files by + # default. + # prefs['python_files'] = ['*.py'] + + # Custom source folders: By default rope searches the project + # for finding source folders (folders that should be searched + # for finding modules). You can add paths to that list. Note + # that rope guesses project source folders correctly most of the + # time; use this if you have any problems. + # The folders should be relative to project root and use '/' for + # separating folders regardless of the platform rope is running on. + # 'src/my_source_folder' for instance. + # prefs.add('source_folders', 'src') + + # You can extend python path for looking up modules + # prefs.add('python_path', '~/python/') + + # Should rope save object information or not. + prefs['save_objectdb'] = True + prefs['compress_objectdb'] = False + + # If `True`, rope analyzes each module when it is being saved. + prefs['automatic_soa'] = True + # The depth of calls to follow in static object analysis + prefs['soa_followed_calls'] = 0 + + # If `False` when running modules or unit tests "dynamic object + # analysis" is turned off. This makes them much faster. + prefs['perform_doa'] = True + + # Rope can check the validity of its object DB when running. + prefs['validate_objectdb'] = True + + # How many undos to hold? + prefs['max_history_items'] = 32 + + # Shows whether to save history across sessions. + prefs['save_history'] = True + prefs['compress_history'] = False + + # Set the number spaces used for indenting. According to + # :PEP:`8`, it is best to use 4 spaces. Since most of rope's + # unit-tests use 4 spaces it is more reliable, too. + prefs['indent_size'] = 4 + + # Builtin and c-extension modules that are allowed to be imported + # and inspected by rope. + prefs['extension_modules'] = [] + + # Add all standard c-extensions to extension_modules list. + prefs['import_dynload_stdmods'] = True + + # If `True` modules with syntax errors are considered to be empty. + # The default value is `False`; When `False` syntax errors raise + # `rope.base.exceptions.ModuleSyntaxError` exception. + prefs['ignore_syntax_errors'] = False + + # If `True`, rope ignores unresolvable imports. Otherwise, they + # appear in the importing namespace. + prefs['ignore_bad_imports'] = False + + # If `True`, rope will insert new module imports as + # `from import ` by default. + prefs['prefer_module_from_imports'] = False + + # If `True`, rope will transform a comma list of imports into + # multiple separate import statements when organizing + # imports. + prefs['split_imports'] = False + + # If `True`, rope will remove all top-level import statements and + # reinsert them at the top of the module when making changes. + prefs['pull_imports_to_top'] = True + + # If `True`, rope will sort imports alphabetically by module name instead + # of alphabetically by import statement, with from imports after normal + # imports. + prefs['sort_imports_alphabetically'] = False + + # Location of implementation of + # rope.base.oi.type_hinting.interfaces.ITypeHintingFactory In general + # case, you don't have to change this value, unless you're an rope expert. + # Change this value to inject you own implementations of interfaces + # listed in module rope.base.oi.type_hinting.providers.interfaces + # For example, you can add you own providers for Django Models, or disable + # the search type-hinting in a class hierarchy, etc. + prefs['type_hinting_factory'] = ( + 'rope.base.oi.type_hinting.factory.default_type_hinting_factory') + + +def project_opened(project): + """This function is called after opening the project""" + # Do whatever you like here! diff --git a/src/test/pythonFiles/refactoring/source folder/.vscode/.ropeproject/objectdb b/src/test/pythonFiles/refactoring/source folder/.vscode/.ropeproject/objectdb new file mode 100644 index 0000000000000000000000000000000000000000..0a47446c0ad231c193bdd44ff327ba2ab28bf3d8 GIT binary patch literal 6 NcmZo*sx4&D0{{kv0iOT> literal 0 HcmV?d00001 diff --git a/src/testMultiRootWkspc/workspace1/.vscode/.ropeproject/config.py b/src/testMultiRootWkspc/workspace1/.vscode/.ropeproject/config.py new file mode 100644 index 000000000000..dee2d1ae9a6b --- /dev/null +++ b/src/testMultiRootWkspc/workspace1/.vscode/.ropeproject/config.py @@ -0,0 +1,114 @@ +# The default ``config.py`` +# flake8: noqa + + +def set_prefs(prefs): + """This function is called before opening the project""" + + # Specify which files and folders to ignore in the project. + # Changes to ignored resources are not added to the history and + # VCSs. Also they are not returned in `Project.get_files()`. + # Note that ``?`` and ``*`` match all characters but slashes. + # '*.pyc': matches 'test.pyc' and 'pkg/test.pyc' + # 'mod*.pyc': matches 'test/mod1.pyc' but not 'mod/1.pyc' + # '.svn': matches 'pkg/.svn' and all of its children + # 'build/*.o': matches 'build/lib.o' but not 'build/sub/lib.o' + # 'build//*.o': matches 'build/lib.o' and 'build/sub/lib.o' + prefs['ignored_resources'] = ['*.pyc', '*~', '.ropeproject', + '.hg', '.svn', '_svn', '.git', '.tox'] + + # Specifies which files should be considered python files. It is + # useful when you have scripts inside your project. Only files + # ending with ``.py`` are considered to be python files by + # default. + # prefs['python_files'] = ['*.py'] + + # Custom source folders: By default rope searches the project + # for finding source folders (folders that should be searched + # for finding modules). You can add paths to that list. Note + # that rope guesses project source folders correctly most of the + # time; use this if you have any problems. + # The folders should be relative to project root and use '/' for + # separating folders regardless of the platform rope is running on. + # 'src/my_source_folder' for instance. + # prefs.add('source_folders', 'src') + + # You can extend python path for looking up modules + # prefs.add('python_path', '~/python/') + + # Should rope save object information or not. + prefs['save_objectdb'] = True + prefs['compress_objectdb'] = False + + # If `True`, rope analyzes each module when it is being saved. + prefs['automatic_soa'] = True + # The depth of calls to follow in static object analysis + prefs['soa_followed_calls'] = 0 + + # If `False` when running modules or unit tests "dynamic object + # analysis" is turned off. This makes them much faster. + prefs['perform_doa'] = True + + # Rope can check the validity of its object DB when running. + prefs['validate_objectdb'] = True + + # How many undos to hold? + prefs['max_history_items'] = 32 + + # Shows whether to save history across sessions. + prefs['save_history'] = True + prefs['compress_history'] = False + + # Set the number spaces used for indenting. According to + # :PEP:`8`, it is best to use 4 spaces. Since most of rope's + # unit-tests use 4 spaces it is more reliable, too. + prefs['indent_size'] = 4 + + # Builtin and c-extension modules that are allowed to be imported + # and inspected by rope. + prefs['extension_modules'] = [] + + # Add all standard c-extensions to extension_modules list. + prefs['import_dynload_stdmods'] = True + + # If `True` modules with syntax errors are considered to be empty. + # The default value is `False`; When `False` syntax errors raise + # `rope.base.exceptions.ModuleSyntaxError` exception. + prefs['ignore_syntax_errors'] = False + + # If `True`, rope ignores unresolvable imports. Otherwise, they + # appear in the importing namespace. + prefs['ignore_bad_imports'] = False + + # If `True`, rope will insert new module imports as + # `from import ` by default. + prefs['prefer_module_from_imports'] = False + + # If `True`, rope will transform a comma list of imports into + # multiple separate import statements when organizing + # imports. + prefs['split_imports'] = False + + # If `True`, rope will remove all top-level import statements and + # reinsert them at the top of the module when making changes. + prefs['pull_imports_to_top'] = True + + # If `True`, rope will sort imports alphabetically by module name instead + # of alphabetically by import statement, with from imports after normal + # imports. + prefs['sort_imports_alphabetically'] = False + + # Location of implementation of + # rope.base.oi.type_hinting.interfaces.ITypeHintingFactory In general + # case, you don't have to change this value, unless you're an rope expert. + # Change this value to inject you own implementations of interfaces + # listed in module rope.base.oi.type_hinting.providers.interfaces + # For example, you can add you own providers for Django Models, or disable + # the search type-hinting in a class hierarchy, etc. + prefs['type_hinting_factory'] = ( + 'rope.base.oi.type_hinting.factory.default_type_hinting_factory') + + +def project_opened(project): + """This function is called after opening the project""" + # Do whatever you like here! diff --git a/src/testMultiRootWkspc/workspace1/.vscode/.ropeproject/objectdb b/src/testMultiRootWkspc/workspace1/.vscode/.ropeproject/objectdb new file mode 100644 index 0000000000000000000000000000000000000000..0a47446c0ad231c193bdd44ff327ba2ab28bf3d8 GIT binary patch literal 6 NcmZo*sx4&D0{{kv0iOT> literal 0 HcmV?d00001 From 54e5286999f8d1736fa968144f8e7afc44cfd3bd Mon Sep 17 00:00:00 2001 From: Kim-Adeline Miguel Date: Wed, 15 Sep 2021 16:32:41 -0700 Subject: [PATCH 10/13] Remove workspace symbols --- .vscode/settings.json | 1 - package.nls.de.json | 1 - package.nls.es.json | 1 - package.nls.fr.json | 1 - package.nls.it.json | 1 - package.nls.ja.json | 1 - package.nls.json | 1 - package.nls.ko-kr.json | 1 - package.nls.nl.json | 1 - package.nls.pl.json | 1 - package.nls.pt-br.json | 1 - package.nls.ru.json | 1 - package.nls.tr.json | 1 - package.nls.zh-cn.json | 1 - package.nls.zh-tw.json | 1 - resources/report_issue_user_settings.json | 8 -------- src/client/common/application/commands.ts | 1 - src/client/common/constants.ts | 1 - src/test/.vscode/settings.json | 1 - src/test/common.ts | 1 - src/test/multiRootWkspc/multi.code-workspace | 1 - .../multiRootWkspc/parent/child/.vscode/settings.json | 4 +--- src/test/multiRootWkspc/workspace2/.vscode/settings.json | 5 +---- src/test/multiRootWkspc/workspace3/.vscode/settings.json | 4 +--- src/testMultiRootWkspc/multi.code-workspace | 1 - src/testMultiRootWkspc/parent/child/.vscode/settings.json | 4 +--- src/testMultiRootWkspc/workspace2/.vscode/settings.json | 5 +---- src/testMultiRootWkspc/workspace3/.vscode/settings.json | 4 +--- 28 files changed, 6 insertions(+), 49 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index cf39a41846b8..afe52e99ce97 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -44,7 +44,6 @@ "typescript.tsdk": "./node_modules/typescript/lib", // we want to use the TS server from our node_modules folder to control its version "python.linting.enabled": false, "python.testing.promptToConfigure": false, - "python.workspaceSymbols.enabled": false, "python.formatting.provider": "black", "typescript.preferences.quoteStyle": "single", "javascript.preferences.quoteStyle": "single", diff --git a/package.nls.de.json b/package.nls.de.json index b90e40507ec4..1a1d49c2be9c 100644 --- a/package.nls.de.json +++ b/package.nls.de.json @@ -2,7 +2,6 @@ "python.command.python.sortImports.title": "Sortieren der Importe", "python.command.python.startREPL.title": "Starten des REPL", "python.command.python.createTerminal.title": "Terminal erstellen", - "python.command.python.buildWorkspaceSymbols.title": "Arbeitsplatz-Symbole erstellen", "python.command.python.execInTerminal.title": "Python-Datei im Terminal ausführen", "python.command.python.setInterpreter.title": "Interpreter auswählen", "python.command.python.execSelectionInTerminal.title": "Selektion/Reihe in Python-Terminal ausführen", diff --git a/package.nls.es.json b/package.nls.es.json index 72ca91e0d605..62381a675ddb 100644 --- a/package.nls.es.json +++ b/package.nls.es.json @@ -2,7 +2,6 @@ "python.command.python.sortImports.title": "Ordenar importaciones", "python.command.python.startREPL.title": "Nuevo REPL", "python.command.python.createTerminal.title": "Nueva terminal", - "python.command.python.buildWorkspaceSymbols.title": "Compilar símbolos del área de trabajo", "python.command.python.execInTerminal.title": "Ejecutar archivo Python en la terminal", "python.command.python.setInterpreter.title": "Seleccionar intérprete", "python.command.python.execSelectionInTerminal.title": "Ejecutar línea/selección en la terminal", diff --git a/package.nls.fr.json b/package.nls.fr.json index 325fa34da48e..605c7a16a74e 100644 --- a/package.nls.fr.json +++ b/package.nls.fr.json @@ -2,7 +2,6 @@ "python.command.python.sortImports.title": "Trier les imports", "python.command.python.startREPL.title": "Démarrer la console interactive", "python.command.python.createTerminal.title": "Créer un terminal", - "python.command.python.buildWorkspaceSymbols.title": "Construire les symboles de l'espace de travail", "python.command.python.execInTerminal.title": "Exécuter le script Python dans un terminal", "python.command.python.setInterpreter.title": "Sélectionner l'interpreteur", "python.command.python.execSelectionInTerminal.title": "Exécuter la ligne/sélection dans un terminal Python", diff --git a/package.nls.it.json b/package.nls.it.json index 4a2d4880461a..9ff7f2e83c9f 100644 --- a/package.nls.it.json +++ b/package.nls.it.json @@ -2,7 +2,6 @@ "python.command.python.sortImports.title": "Ordina gli import", "python.command.python.startREPL.title": "Apri nuova REPL", "python.command.python.createTerminal.title": "Apri nuovo terminale", - "python.command.python.buildWorkspaceSymbols.title": "Compila simboli dello spazio di lavoro", "python.command.python.execInTerminal.title": "Esegui file Python nel terminale", "python.command.python.setInterpreter.title": "Seleziona interprete", "python.command.python.execSelectionInTerminal.title": "Esegui selezione/linea nel terminale di Python", diff --git a/package.nls.ja.json b/package.nls.ja.json index 998ac4f4f2e0..a6c2d1541819 100644 --- a/package.nls.ja.json +++ b/package.nls.ja.json @@ -1,7 +1,6 @@ { "python.command.python.sortImports.title": "import 文を並び替える", "python.command.python.startREPL.title": "REPL を開始", - "python.command.python.buildWorkspaceSymbols.title": "ワークスペースのシンボルをビルド", "python.command.python.execInTerminal.title": "ターミナルで Python ファイルを実行", "python.command.python.setInterpreter.title": "インタープリターを選択", "python.command.python.execSelectionInTerminal.title": "Python ターミナルで選択範囲/行を実行", diff --git a/package.nls.json b/package.nls.json index 583df0939ce0..13984371656f 100644 --- a/package.nls.json +++ b/package.nls.json @@ -2,7 +2,6 @@ "python.command.python.sortImports.title": "Sort Imports", "python.command.python.startREPL.title": "Start REPL", "python.command.python.createTerminal.title": "Create Terminal", - "python.command.python.buildWorkspaceSymbols.title": "Build Workspace Symbols", "python.command.python.execInTerminal.title": "Run Python File in Terminal", "python.command.python.debugInTerminal.title": "Debug Python File in Terminal", "python.command.python.setInterpreter.title": "Select Interpreter", diff --git a/package.nls.ko-kr.json b/package.nls.ko-kr.json index 81d2e6fb56a9..7ecce3df7453 100644 --- a/package.nls.ko-kr.json +++ b/package.nls.ko-kr.json @@ -1,7 +1,6 @@ { "python.command.python.sortImports.title": "Import문 정렬", "python.command.python.startREPL.title": "REPL 시작", - "python.command.python.buildWorkspaceSymbols.title": "작업 영역 기호 빌드", "python.command.python.execInTerminal.title": "터미널에서 Python 파일 실행", "python.command.python.setInterpreter.title": "인터프리터 선택", "python.command.python.execSelectionInTerminal.title": "Python 터미널에서 선택 영역/줄 실행", diff --git a/package.nls.nl.json b/package.nls.nl.json index a0ab115af2ab..cf8f4c144ef8 100644 --- a/package.nls.nl.json +++ b/package.nls.nl.json @@ -2,7 +2,6 @@ "python.command.python.sortImports.title": "Import sorteren", "python.command.python.startREPL.title": "REPL starten", "python.command.python.createTerminal.title": "Terminal aanmaken", - "python.command.python.buildWorkspaceSymbols.title": "Werkruimte-symbolen aanmaken", "python.command.python.execInTerminal.title": "Python-bestand in terminal uitvoeren", "python.command.python.setInterpreter.title": "Interpreter selecteren", "python.command.python.execSelectionInTerminal.title": "Selectie/rij in Python-terminal uitvoeren", diff --git a/package.nls.pl.json b/package.nls.pl.json index d7f58fd22e1e..29c0a84f1709 100644 --- a/package.nls.pl.json +++ b/package.nls.pl.json @@ -2,7 +2,6 @@ "python.command.python.sortImports.title": "Sortuj importy", "python.command.python.startREPL.title": "Uruchom REPL", "python.command.python.createTerminal.title": "Otwórz Terminal", - "python.command.python.buildWorkspaceSymbols.title": "Zbuduj symbole dla przestrzeni roboczej", "python.command.python.execInTerminal.title": "Uruchom plik pythonowy w terminalu", "python.command.python.setInterpreter.title": "Wybierz wersję interpretera", "python.command.python.viewOutput.title": "Pokaż wyniki", diff --git a/package.nls.pt-br.json b/package.nls.pt-br.json index 2d889beecb69..9418af230bee 100644 --- a/package.nls.pt-br.json +++ b/package.nls.pt-br.json @@ -2,7 +2,6 @@ "python.command.python.sortImports.title": "Ordenar Importações", "python.command.python.startREPL.title": "Iniciar REPL", "python.command.python.createTerminal.title": "Criar Terminal", - "python.command.python.buildWorkspaceSymbols.title": "Construir Símbolos da Área de Trabalho", "python.command.python.execInTerminal.title": "Executar Arquivo no Terminal", "python.command.python.setInterpreter.title": "Selecionar Interpretador", "python.command.python.execSelectionInTerminal.title": "Executar Seleção/Linha no Terminal", diff --git a/package.nls.ru.json b/package.nls.ru.json index afffe4ba8d7b..df09b32ce72b 100644 --- a/package.nls.ru.json +++ b/package.nls.ru.json @@ -1,7 +1,6 @@ { "python.command.python.sortImports.title": "Отсортировать Imports", "python.command.python.startREPL.title": "Открыть REPL", - "python.command.python.buildWorkspaceSymbols.title": "Собрать символы рабочего пространства", "python.command.python.execInTerminal.title": "Выполнить файл в консоли", "python.command.python.setInterpreter.title": "Выбрать интерпретатор", "python.command.python.execSelectionInTerminal.title": "Выполнить выбранный текст или текущую строку в консоли", diff --git a/package.nls.tr.json b/package.nls.tr.json index bd30e24f641e..1982ee70012e 100644 --- a/package.nls.tr.json +++ b/package.nls.tr.json @@ -2,7 +2,6 @@ "python.command.python.sortImports.title": "Import İfadelerini Sırala", "python.command.python.startREPL.title": "REPL Başlat", "python.command.python.createTerminal.title": "Terminal Oluştur", - "python.command.python.buildWorkspaceSymbols.title": "Çalışma Alanındaki Sembolleri Derle", "python.command.python.execInTerminal.title": "Terminalde Çalıştır", "python.command.python.setInterpreter.title": "Bir Interpreter Seçin", "python.command.python.execSelectionInTerminal.title": "Seçimi/Satırı Terminalde Çalıştır", diff --git a/package.nls.zh-cn.json b/package.nls.zh-cn.json index ec9592def2c8..01635caf3719 100644 --- a/package.nls.zh-cn.json +++ b/package.nls.zh-cn.json @@ -2,7 +2,6 @@ "python.command.python.sortImports.title": "排序 import 语句", "python.command.python.startREPL.title": "启动 REPL", "python.command.python.createTerminal.title": "创建终端", - "python.command.python.buildWorkspaceSymbols.title": "构建工作区符号", "python.command.python.execInTerminal.title": "在终端中运行 Python 文件", "python.command.python.setInterpreter.title": "选择解释器", "python.command.python.switchOffInsidersChannel.title": "切换到默认版本", diff --git a/package.nls.zh-tw.json b/package.nls.zh-tw.json index fce2fb07ff33..6f5ca9c2ce1b 100644 --- a/package.nls.zh-tw.json +++ b/package.nls.zh-tw.json @@ -2,7 +2,6 @@ "python.command.python.sortImports.title": "排序 Import 語句", "python.command.python.startREPL.title": "啟動 REPL", "python.command.python.createTerminal.title": "建立終端機", - "python.command.python.buildWorkspaceSymbols.title": "建構工作區符號", "python.command.python.execInTerminal.title": "在終端機中執行 Python 檔案", "python.command.python.setInterpreter.title": "選擇直譯器", "python.command.python.execSelectionInTerminal.title": "在 Python 終端機中執行選定內容/行", diff --git a/resources/report_issue_user_settings.json b/resources/report_issue_user_settings.json index 3237576bc753..c216fe64e3dd 100644 --- a/resources/report_issue_user_settings.json +++ b/resources/report_issue_user_settings.json @@ -99,14 +99,6 @@ "showAdvancedMembers": true, "typeshedPaths": "placeholder" }, - "workspaceSymbols": { - "ctagsPath": "placeholder", - "enabled": true, - "exclusionPatterns": true, - "rebuildOnFileSave": true, - "rebuildOnStart": true, - "tagFilePath": "placeholder" - }, "testing": { "cwd": "placeholder", "debugPort": true, diff --git a/src/client/common/application/commands.ts b/src/client/common/application/commands.ts index 995fcbabcecd..dde7b8257d74 100644 --- a/src/client/common/application/commands.ts +++ b/src/client/common/application/commands.ts @@ -85,7 +85,6 @@ export interface ICommandNameArgumentTypeMapping extends ICommandNameWithoutArgu ['extension.open']: [string]; ['workbench.action.openIssueReporter']: [{ extensionId: string; issueBody: string }]; [Commands.GetSelectedInterpreterPath]: [{ workspaceFolder: string } | string[]]; - [Commands.Build_Workspace_Symbols]: [boolean, CancellationToken]; [Commands.Sort_Imports]: [undefined, Uri]; [Commands.Exec_In_Terminal]: [undefined, Uri]; [Commands.Exec_In_Terminal_Icon]: [undefined, Uri]; diff --git a/src/client/common/constants.ts b/src/client/common/constants.ts index dc8c963b9601..9b1f4d4163ec 100644 --- a/src/client/common/constants.ts +++ b/src/client/common/constants.ts @@ -42,7 +42,6 @@ export namespace Commands { export const Test_Stop_Refreshing = 'python.stopRefreshingTests'; export const Sort_Imports = 'python.sortImports'; export const ViewOutput = 'python.viewOutput'; - export const Build_Workspace_Symbols = 'python.buildWorkspaceSymbols'; export const Start_REPL = 'python.startREPL'; export const Create_Terminal = 'python.createTerminal'; export const Set_Linter = 'python.setLinter'; diff --git a/src/test/.vscode/settings.json b/src/test/.vscode/settings.json index 099b2e9f5283..6c96e3a507b2 100644 --- a/src/test/.vscode/settings.json +++ b/src/test/.vscode/settings.json @@ -1,7 +1,6 @@ { "python.linting.pylintEnabled": false, "python.linting.flake8Enabled": false, - "python.workspaceSymbols.enabled": false, "python.testing.pytestArgs": [], "python.testing.unittestArgs": ["-s=./tests", "-p=test_*.py", "-v", "-s", ".", "-p", "*test*.py"], "python.sortImports.args": [], diff --git a/src/test/common.ts b/src/test/common.ts index f9e9480493f1..4d5ab04d71aa 100644 --- a/src/test/common.ts +++ b/src/test/common.ts @@ -36,7 +36,6 @@ export enum OSType { } export type PythonSettingKeys = - | 'workspaceSymbols.enabled' | 'pythonPath' | 'languageServer' | 'linting.lintOnSave' diff --git a/src/test/multiRootWkspc/multi.code-workspace b/src/test/multiRootWkspc/multi.code-workspace index 6a9901d9df65..5c90439e5546 100644 --- a/src/test/multiRootWkspc/multi.code-workspace +++ b/src/test/multiRootWkspc/multi.code-workspace @@ -25,6 +25,5 @@ "python.linting.pylintEnabled": false, "python.linting.pycodestyleEnabled": true, "python.linting.prospectorEnabled": true, - "python.workspaceSymbols.enabled": true } } diff --git a/src/test/multiRootWkspc/parent/child/.vscode/settings.json b/src/test/multiRootWkspc/parent/child/.vscode/settings.json index 656ad4032082..0967ef424bce 100644 --- a/src/test/multiRootWkspc/parent/child/.vscode/settings.json +++ b/src/test/multiRootWkspc/parent/child/.vscode/settings.json @@ -1,3 +1 @@ -{ - "python.workspaceSymbols.enabled": true -} +{} diff --git a/src/test/multiRootWkspc/workspace2/.vscode/settings.json b/src/test/multiRootWkspc/workspace2/.vscode/settings.json index 385728982cfa..0967ef424bce 100644 --- a/src/test/multiRootWkspc/workspace2/.vscode/settings.json +++ b/src/test/multiRootWkspc/workspace2/.vscode/settings.json @@ -1,4 +1 @@ -{ - "python.workspaceSymbols.tagFilePath": "${workspaceRoot}/workspace2.tags.file", - "python.workspaceSymbols.enabled": true -} +{} diff --git a/src/test/multiRootWkspc/workspace3/.vscode/settings.json b/src/test/multiRootWkspc/workspace3/.vscode/settings.json index 8779a0c08efe..0967ef424bce 100644 --- a/src/test/multiRootWkspc/workspace3/.vscode/settings.json +++ b/src/test/multiRootWkspc/workspace3/.vscode/settings.json @@ -1,3 +1 @@ -{ - "python.workspaceSymbols.tagFilePath": "${workspaceRoot}/workspace3.tags.file" -} +{} diff --git a/src/testMultiRootWkspc/multi.code-workspace b/src/testMultiRootWkspc/multi.code-workspace index 9d64c3f8b53b..1daf409a0836 100644 --- a/src/testMultiRootWkspc/multi.code-workspace +++ b/src/testMultiRootWkspc/multi.code-workspace @@ -37,7 +37,6 @@ "python.linting.pylintEnabled": true, "python.linting.pycodestyleEnabled": false, "python.linting.prospectorEnabled": false, - "python.workspaceSymbols.enabled": false, "python.formatting.provider": "yapf", "python.sortImports.args": [ "-sp", diff --git a/src/testMultiRootWkspc/parent/child/.vscode/settings.json b/src/testMultiRootWkspc/parent/child/.vscode/settings.json index 2c4fa010619f..0967ef424bce 100644 --- a/src/testMultiRootWkspc/parent/child/.vscode/settings.json +++ b/src/testMultiRootWkspc/parent/child/.vscode/settings.json @@ -1,3 +1 @@ -{ - "python.workspaceSymbols.enabled": false -} +{} diff --git a/src/testMultiRootWkspc/workspace2/.vscode/settings.json b/src/testMultiRootWkspc/workspace2/.vscode/settings.json index 3705457b09a7..0967ef424bce 100644 --- a/src/testMultiRootWkspc/workspace2/.vscode/settings.json +++ b/src/testMultiRootWkspc/workspace2/.vscode/settings.json @@ -1,4 +1 @@ -{ - "python.workspaceSymbols.tagFilePath": "${workspaceFolder}/workspace2.tags.file", - "python.workspaceSymbols.enabled": false -} +{} diff --git a/src/testMultiRootWkspc/workspace3/.vscode/settings.json b/src/testMultiRootWkspc/workspace3/.vscode/settings.json index 8779a0c08efe..0967ef424bce 100644 --- a/src/testMultiRootWkspc/workspace3/.vscode/settings.json +++ b/src/testMultiRootWkspc/workspace3/.vscode/settings.json @@ -1,3 +1 @@ -{ - "python.workspaceSymbols.tagFilePath": "${workspaceRoot}/workspace3.tags.file" -} +{} From aff21abe0f1d7e750c879536e4076ebb66c3d1d1 Mon Sep 17 00:00:00 2001 From: Kim-Adeline Miguel Date: Wed, 15 Sep 2021 16:33:58 -0700 Subject: [PATCH 11/13] Update .eslintignore --- .eslintignore | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/.eslintignore b/.eslintignore index bb0ff4902719..075ab58d5d6f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -191,14 +191,6 @@ src/test/application/misc/joinMailingListPrompt.unit.test.ts src/test/performance/load.perf.test.ts -src/test/refactor/extension.refactor.extract.method.test.ts -src/test/refactor/extension.refactor.extract.var.test.ts - -src/test/workspaceSymbols/provider.unit.test.ts -src/test/workspaceSymbols/common.ts -src/test/workspaceSymbols/main.unit.test.ts -src/test/workspaceSymbols/generator.unit.test.ts - src/client/interpreter/configuration/interpreterSelector/commands/base.ts src/client/interpreter/configuration/interpreterSelector/commands/resetInterpreter.ts src/client/interpreter/configuration/interpreterSelector/commands/setShebangInterpreter.ts @@ -223,27 +215,16 @@ src/client/terminals/codeExecution/terminalCodeExecution.ts src/client/terminals/codeExecution/codeExecutionManager.ts src/client/terminals/codeExecution/djangoContext.ts -src/client/providers/objectDefinitionProvider.ts src/client/providers/serviceRegistry.ts -src/client/providers/symbolProvider.ts src/client/providers/completionSource.ts -src/client/providers/renameProvider.ts -src/client/providers/hoverProvider.ts -src/client/providers/itemInfoSource.ts src/client/providers/formatProvider.ts src/client/providers/importSortProvider.ts src/client/providers/replProvider.ts src/client/providers/codeActionProvider/main.ts src/client/providers/codeActionProvider/launchJsonCodeActionProvider.ts src/client/providers/codeActionProvider/pythonCodeActionProvider.ts -src/client/providers/docStringFoldingProvider.ts src/client/providers/linterProvider.ts -src/client/providers/simpleRefactorProvider.ts -src/client/providers/completionProvider.ts -src/client/providers/definitionProvider.ts -src/client/providers/referenceProvider.ts src/client/providers/terminalProvider.ts -src/client/providers/signatureProvider.ts src/client/activation/languageServer/manager.ts src/client/activation/languageServer/languageServerExtension.ts @@ -464,9 +445,3 @@ src/client/application/diagnostics/commands/factory.ts src/client/application/diagnostics/commands/execVSCCommand.ts src/client/application/diagnostics/commands/launchBrowser.ts -src/client/refactor/proxy.ts -src/client/workspaceSymbols/main.ts -src/client/workspaceSymbols/generator.ts -src/client/workspaceSymbols/parser.ts -src/client/workspaceSymbols/provider.ts - From 3d2e371681d2cf696826f6e954d56e82e1c96e2c Mon Sep 17 00:00:00 2001 From: Kim-Adeline Miguel Date: Thu, 16 Sep 2021 08:51:03 -0700 Subject: [PATCH 12/13] Remove testing of build workflow --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c726817a914f..eb5527bf2437 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,6 @@ name: Build on: - pull_request: push: branches: - 'main' From 64b7fe675658a85425a0febec82e15327e6fa927 Mon Sep 17 00:00:00 2001 From: Kim-Adeline Miguel Date: Thu, 16 Sep 2021 08:56:40 -0700 Subject: [PATCH 13/13] Remove unused symbolProvider.py --- pythonFiles/symbolProvider.py | 89 ------------------- .../common/process/internal/scripts/index.ts | 21 ----- .../common/process/internal/scripts/types.ts | 23 ----- 3 files changed, 133 deletions(-) delete mode 100644 pythonFiles/symbolProvider.py delete mode 100644 src/client/common/process/internal/scripts/types.ts diff --git a/pythonFiles/symbolProvider.py b/pythonFiles/symbolProvider.py deleted file mode 100644 index 033ce4b99900..000000000000 --- a/pythonFiles/symbolProvider.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. - -import ast -import json -import sys - - -class Visitor(ast.NodeVisitor): - def __init__(self): - self.symbols = {"classes": [], "methods": [], "functions": []} - - def visit_Module(self, node): - self.visitChildren(node) - - def visitChildren(self, node, namespace=""): - for child in node.body: - if isinstance(child, ast.FunctionDef): - self.visitDef(child, namespace) - if isinstance(child, ast.ClassDef): - self.visitClassDef(child, namespace) - try: - if isinstance(child, ast.AsyncFunctionDef): - self.visitDef(child, namespace) - except Exception: - pass - - def visitDef(self, node, namespace=""): - end_position = self.getEndPosition(node) - symbol = "functions" if namespace == "" else "methods" - self.symbols[symbol].append(self.getDataObject(node, namespace)) - - def visitClassDef(self, node, namespace=""): - end_position = self.getEndPosition(node) - self.symbols["classes"].append(self.getDataObject(node, namespace)) - - if len(namespace) > 0: - namespace = "{0}::{1}".format(namespace, node.name) - else: - namespace = node.name - self.visitChildren(node, namespace) - - def getDataObject(self, node, namespace=""): - end_position = self.getEndPosition(node) - return { - "namespace": namespace, - "name": node.name, - "range": { - "start": {"line": node.lineno - 1, "character": node.col_offset}, - "end": {"line": end_position[0], "character": end_position[1]}, - }, - } - - def getEndPosition(self, node): - if not hasattr(node, "body") or len(node.body) == 0: - return (node.lineno - 1, node.col_offset) - return self.getEndPosition(node.body[-1]) - - -def provide_symbols(source): - """Provides a list of all symbols in provided code. - - The list comprises of 3-item tuples that contain the starting line number, - ending line number and whether the statement is a single line. - - """ - tree = ast.parse(source) - visitor = Visitor() - visitor.visit(tree) - sys.stdout.write(json.dumps(visitor.symbols)) - sys.stdout.flush() - - -if __name__ == "__main__": - if len(sys.argv) == 3: - contents = sys.argv[2] - else: - with open(sys.argv[1], "r") as source: - contents = source.read() - - try: - default_encoding = sys.getdefaultencoding() - encoded_contents = contents.encode(default_encoding, "surrogateescape") - contents = encoded_contents.decode(default_encoding, "replace") - except (UnicodeError, LookupError): - pass - if isinstance(contents, bytes): - contents = contents.decode("utf8") - provide_symbols(contents) diff --git a/src/client/common/process/internal/scripts/index.ts b/src/client/common/process/internal/scripts/index.ts index 0b2e2caaa3e4..b9fd904763a8 100644 --- a/src/client/common/process/internal/scripts/index.ts +++ b/src/client/common/process/internal/scripts/index.ts @@ -3,7 +3,6 @@ import * as path from 'path'; import { _SCRIPTS_DIR } from './constants'; -import { SymbolProviderSymbols } from './types'; const SCRIPTS_DIR = _SCRIPTS_DIR; @@ -90,26 +89,6 @@ export function normalizeSelection(): [string[], (out: string) => string] { return [args, parse]; } -// symbolProvider.py - -export function symbolProvider( - filename: string, - // If "text" is provided then it gets passed to the script as-is. - text?: string, -): [string[], (out: string) => SymbolProviderSymbols] { - const script = path.join(SCRIPTS_DIR, 'symbolProvider.py'); - const args = [script, filename]; - if (text) { - args.push(text); - } - - function parse(out: string): SymbolProviderSymbols { - return JSON.parse(out); - } - - return [args, parse]; -} - // printEnvVariables.py export function printEnvVariables(): [string[], (out: string) => NodeJS.ProcessEnv] { diff --git a/src/client/common/process/internal/scripts/types.ts b/src/client/common/process/internal/scripts/types.ts deleted file mode 100644 index e4f32897d878..000000000000 --- a/src/client/common/process/internal/scripts/types.ts +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// Symbol providers - -type Position = { - line: number; - character: number; -}; -type RawSymbol = { - // If no namespace then ''. - namespace: string; - name: string; - range: { - start: Position; - end: Position; - }; -}; -export type SymbolProviderSymbols = { - classes: RawSymbol[]; - methods: RawSymbol[]; - functions: RawSymbol[]; -};