diff --git a/omnisharptest/omnisharpUnitTests/assets.test.ts b/omnisharptest/omnisharpUnitTests/assets.test.ts index c1c812a31..781dac691 100644 --- a/omnisharptest/omnisharpUnitTests/assets.test.ts +++ b/omnisharptest/omnisharpUnitTests/assets.test.ts @@ -35,7 +35,6 @@ describe('Asset generation: csproj', () => { isNotNull(tasksJson.tasks[0].args); const buildPath = tasksJson.tasks[0].args[1]; - // ${workspaceFolder}/project.json const segments = buildPath.split(path.posix.sep); expect(segments).toStrictEqual(['${workspaceFolder}', 'testApp.csproj']); }); @@ -123,7 +122,6 @@ describe('Asset generation: csproj', () => { isNotNull(tasksJson.tasks[0].args); const buildPath = tasksJson.tasks[0].args[1]; - // ${workspaceFolder}/nested/project.json const segments = buildPath.split(path.posix.sep); expect(segments).toStrictEqual(['${workspaceFolder}', 'nested', 'testApp.csproj']); }); diff --git a/package.json b/package.json index 83e61c222..8bac4669a 100644 --- a/package.json +++ b/package.json @@ -819,7 +819,6 @@ "onLanguage:csharp", "onCommand:o.showOutput", "onCommand:omnisharp.registerLanguageMiddleware", - "workspaceContains:project.json", "workspaceContains:**/*.{csproj,csx,cake}" ], "contributes": { @@ -1864,10 +1863,6 @@ ], "url": "https://json.schemastore.org/appsettings" }, - { - "fileMatch": "project.json", - "url": "http://json.schemastore.org/project" - }, { "fileMatch": "omnisharp.json", "url": "http://json.schemastore.org/omnisharp" diff --git a/src/features/dotnetTest.ts b/src/features/dotnetTest.ts index eeb8566f2..dfb61591f 100644 --- a/src/features/dotnetTest.ts +++ b/src/features/dotnetTest.ts @@ -199,7 +199,7 @@ export default class TestManager extends AbstractProvider { if (projectInfo.MsBuildProject) { targetFrameworkVersion = projectInfo.MsBuildProject.TargetFramework; } else { - throw new Error('Expected project.json or .csproj project.'); + throw new Error('Expected .csproj project.'); } return targetFrameworkVersion; @@ -480,9 +480,6 @@ export default class TestManager extends AbstractProvider { } public async debugDotnetTest(testMethod: string, fileName: string, testFrameworkName: string, noBuild = false) { - // We support to styles of 'dotnet test' for debugging: The legacy 'project.json' testing, and the newer csproj support - // using VS Test. These require a different level of communication. - this._eventStream.post(new DotNetTestDebugStart(testMethod)); const { debugEventListener, targetFrameworkVersion } = await this._recordDebugAndGetDebugValues( diff --git a/src/features/json/jsonContributions.ts b/src/features/json/jsonContributions.ts deleted file mode 100644 index f37893803..000000000 --- a/src/features/json/jsonContributions.ts +++ /dev/null @@ -1,213 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { Location, getLocation, createScanner, SyntaxKind } from 'jsonc-parser'; -import { ProjectJSONContribution } from './projectJsonContribution'; -import { configure as configureXHR, xhr } from 'request-light'; - -import { - CompletionItem, - CompletionItemProvider, - CompletionList, - TextDocument, - Position, - Hover, - HoverProvider, - CancellationToken, - Range, - MarkedString, - DocumentSelector, - languages, - workspace, -} from 'vscode'; -import CompositeDisposable from '../../compositeDisposable'; - -export interface ISuggestionsCollector { - add(suggestion: CompletionItem): void; - error(message: string): void; - log(message: string): void; - setAsIncomplete(): void; -} - -export interface IJSONContribution { - getDocumentSelector(): DocumentSelector; - getInfoContribution(fileName: string, location: Location): Promise; - collectPropertySuggestions( - fileName: string, - location: Location, - currentWord: string, - addValue: boolean, - isLast: boolean, - result: ISuggestionsCollector - ): Promise; - collectValueSuggestions(fileName: string, location: Location, result: ISuggestionsCollector): Promise; - collectDefaultSuggestions(fileName: string, result: ISuggestionsCollector): Promise; - resolveSuggestion?(item: CompletionItem): Promise; -} - -export function addJSONProviders(): CompositeDisposable { - const subscriptions = new CompositeDisposable(); - - // configure the XHR library with the latest proxy settings - function configureHttpRequest() { - const httpSettings = workspace.getConfiguration('http'); - configureXHR(httpSettings.get('proxy', ''), httpSettings.get('proxyStrictSSL', false)); - } - - configureHttpRequest(); - subscriptions.add(workspace.onDidChangeConfiguration((_e) => configureHttpRequest())); - - // register completion and hove providers for JSON setting file(s) - const contributions = [new ProjectJSONContribution(xhr)]; - contributions.forEach((contribution) => { - const selector = contribution.getDocumentSelector(); - const triggerCharacters = ['"', ':', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; - subscriptions.add( - languages.registerCompletionItemProvider( - selector, - new JSONCompletionItemProvider(contribution), - ...triggerCharacters - ) - ); - subscriptions.add(languages.registerHoverProvider(selector, new JSONHoverProvider(contribution))); - }); - - return subscriptions; -} - -export class JSONHoverProvider implements HoverProvider { - constructor(private jsonContribution: IJSONContribution) {} - - public async provideHover( - document: TextDocument, - position: Position, - _: CancellationToken - ): Promise { - const offset = document.offsetAt(position); - const location = getLocation(document.getText(), offset); - const node = location.previousNode; - if (node !== undefined && node.offset <= offset && offset <= node.offset + node.length) { - const htmlContent = await this.jsonContribution.getInfoContribution(document.fileName, location); - if (htmlContent !== undefined) { - const range = new Range( - document.positionAt(node.offset), - document.positionAt(node.offset + node.length) - ); - const result: Hover = { - contents: htmlContent, - range: range, - }; - return result; - } - } - return undefined; - } -} - -export class JSONCompletionItemProvider implements CompletionItemProvider { - constructor(private jsonContribution: IJSONContribution) {} - - public async resolveCompletionItem(item: CompletionItem, _: CancellationToken): Promise { - if (this.jsonContribution.resolveSuggestion) { - const resolver = await this.jsonContribution.resolveSuggestion(item); - if (resolver !== undefined) { - return resolver; - } - } - return item; - } - - public async provideCompletionItems( - document: TextDocument, - position: Position, - _: CancellationToken - ): Promise { - const currentWord = this.getCurrentWord(document, position); - let overwriteRange: Range | undefined; - const items: CompletionItem[] = []; - let isIncomplete = false; - - const offset = document.offsetAt(position); - const location = getLocation(document.getText(), offset); - - const node = location.previousNode; - if ( - node && - node.offset <= offset && - offset <= node.offset + node.length && - (node.type === 'property' || - node.type === 'string' || - node.type === 'number' || - node.type === 'boolean' || - node.type === 'null') - ) { - overwriteRange = new Range( - document.positionAt(node.offset), - document.positionAt(node.offset + node.length) - ); - } else { - overwriteRange = new Range(document.positionAt(offset - currentWord.length), position); - } - - const proposed: { [key: string]: boolean } = {}; - const collector: ISuggestionsCollector = { - add: (suggestion: CompletionItem) => { - if (!proposed[suggestion.label]) { - proposed[suggestion.label] = true; - if (overwriteRange !== undefined) { - suggestion.range = overwriteRange; - } - - items.push(suggestion); - } - }, - setAsIncomplete: () => (isIncomplete = true), - error: (message: string) => console.error(message), - log: (message: string) => console.log(message), - }; - - let collectPromise: Promise | undefined; - - if (location.isAtPropertyKey) { - const addValue = - !location.previousNode || - (!location.previousNode.colonOffset && - offset == location.previousNode.offset + location.previousNode.length); - const scanner = createScanner(document.getText(), true); - scanner.setPosition(offset); - scanner.scan(); - const isLast = scanner.getToken() === SyntaxKind.CloseBraceToken || scanner.getToken() === SyntaxKind.EOF; - collectPromise = this.jsonContribution.collectPropertySuggestions( - document.fileName, - location, - currentWord, - addValue, - isLast, - collector - ); - } else { - if (location.path.length === 0) { - collectPromise = this.jsonContribution.collectDefaultSuggestions(document.fileName, collector); - } else { - collectPromise = this.jsonContribution.collectValueSuggestions(document.fileName, location, collector); - } - } - - await collectPromise; - if (items.length > 0) { - return new CompletionList(items, isIncomplete); - } - return undefined; - } - - private getCurrentWord(document: TextDocument, position: Position) { - let i = position.character - 1; - const text = document.lineAt(position.line).text; - while (i >= 0 && ' \t\n\r\v":{[,'.indexOf(text.charAt(i)) === -1) { - i--; - } - return text.substring(i + 1, position.character); - } -} diff --git a/src/features/json/nuGetFlatContainerPackageResponse.ts b/src/features/json/nuGetFlatContainerPackageResponse.ts deleted file mode 100644 index d8cbe9b64..000000000 --- a/src/features/json/nuGetFlatContainerPackageResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// Sample Request: https://api.nuget.org/v3-flatcontainer/FluentAssertions/index.json - -export default interface NuGetFlatContainerPackageResponse { - versions: string[]; -} diff --git a/src/features/json/nuGetIndexResponse.ts b/src/features/json/nuGetIndexResponse.ts deleted file mode 100644 index b4f718ad7..000000000 --- a/src/features/json/nuGetIndexResponse.ts +++ /dev/null @@ -1,14 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// Sample Request: https://api.nuget.org/v3/index.json -export default interface NuGetIndexResponse { - resources: NuGetResource[]; -} - -interface NuGetResource { - '@type': string; - '@id': string; -} diff --git a/src/features/json/nuGetSearchAutocompleteServiceResponse.ts b/src/features/json/nuGetSearchAutocompleteServiceResponse.ts deleted file mode 100644 index c0032ecbc..000000000 --- a/src/features/json/nuGetSearchAutocompleteServiceResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// Sample Query: https://api-v2v3search-0.nuget.org/autocomplete - -export default interface NuGetSearchAutocompleteServiceResponse { - data: string[]; -} diff --git a/src/features/json/nuGetSearchQueryServiceResponse.ts b/src/features/json/nuGetSearchQueryServiceResponse.ts deleted file mode 100644 index 3e4896eaf..000000000 --- a/src/features/json/nuGetSearchQueryServiceResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// Sample Request: https://api-v2v3search-0.nuget.org/query?q=newtonsoft.json&take=5 - -export default interface NuGetSearchQueryServiceResponse { - data: NuGetSearchQueryServiceDataElement[]; -} - -interface NuGetSearchQueryServiceDataElement { - id: string; - description: string; - version: string; -} diff --git a/src/features/json/projectJsonContribution.ts b/src/features/json/projectJsonContribution.ts deleted file mode 100644 index 8e2af087f..000000000 --- a/src/features/json/projectJsonContribution.ts +++ /dev/null @@ -1,260 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as nls from 'vscode-nls'; - -import { CompletionItem, CompletionItemKind, DocumentSelector, MarkedString } from 'vscode'; -import { IJSONContribution, ISuggestionsCollector } from './jsonContributions'; -import { XHRRequest, XHRResponse, getErrorStatusDescription } from 'request-light'; - -import { Location } from 'jsonc-parser'; -import NuGetIndexResponse from './nuGetIndexResponse'; -import NuGetSearchAutocompleteServiceResponse from './nuGetSearchAutocompleteServiceResponse'; -import NuGetFlatContainerPackageResponse from './nuGetFlatContainerPackageResponse'; -import NuGetSearchQueryServiceResponse from './nuGetSearchQueryServiceResponse'; - -const localize = nls.loadMessageBundle(); - -const FEED_INDEX_URL = 'https://api.nuget.org/v3/index.json'; -const LIMIT = 30; - -interface NugetServices { - [key: string]: string; -} - -export class ProjectJSONContribution implements IJSONContribution { - private nugetIndexPromise?: Promise; - - public constructor(private requestService: XHRRequest) {} - - public getDocumentSelector(): DocumentSelector { - return [{ language: 'json', pattern: '**/project.json' }]; - } - - private async getNugetIndex(): Promise { - if (this.nugetIndexPromise === undefined) { - const indexContent = await this.makeJSONRequest(FEED_INDEX_URL); - const services: NugetServices = {}; - if (indexContent && Array.isArray(indexContent.resources)) { - const resources = indexContent.resources; - for (let i = resources.length - 1; i >= 0; i--) { - const type = resources[i]['@type']; - const id = resources[i]['@id']; - if (type && id) { - services[type] = id; - } - } - } - return services; - } - return this.nugetIndexPromise; - } - - private async getNugetService(serviceType: string): Promise { - const services = await this.getNugetIndex(); - const serviceURL = services[serviceType]; - if (!serviceURL) { - return Promise.reject( - localize('json.nugget.error.missingservice', 'NuGet index document is missing service {0}', serviceType) - ); - } - return serviceURL; - } - - private async makeJSONRequest(url: string): Promise { - const response = await this.requestService({ - url: url, - }); - - try { - if (response.status === 200) { - try { - return JSON.parse(response.responseText) as T; - } catch (e) { - return Promise.reject( - localize('json.nugget.error.invalidformat', '{0} is not a valid JSON document', url) - ); - } - } - return Promise.reject( - localize('json.nugget.error.indexaccess', 'Request to {0} failed: {1}', url, response.responseText) - ); - } catch (error) { - return Promise.reject( - localize( - 'json.nugget.error.access', - 'Request to {0} failed: {1}', - url, - getErrorStatusDescription((error as XHRResponse).status) - ) - ); - } - } - - public async collectPropertySuggestions( - resource: string, - location: Location, - currentWord: string, - addValue: boolean, - isLast: boolean, - result: ISuggestionsCollector - ): Promise { - if ( - location.matches(['dependencies']) || - location.matches(['frameworks', '*', 'dependencies']) || - location.matches(['frameworks', '*', 'frameworkAssemblies']) - ) { - try { - const service = await this.getNugetService('SearchAutocompleteService'); - let queryUrl: string; - if (currentWord.length > 0) { - queryUrl = service + '?q=' + encodeURIComponent(currentWord) + '&take=' + LIMIT; - } else { - queryUrl = service + '?take=' + LIMIT; - } - - const response = await this.makeJSONRequest(queryUrl); - if (Array.isArray(response.data)) { - const results = response.data; - for (let i = 0; i < results.length; i++) { - const name = results[i]; - let insertText = JSON.stringify(name); - if (addValue) { - insertText += ': "{{}}"'; - if (!isLast) { - insertText += ','; - } - } - const proposal = new CompletionItem(name); - proposal.kind = CompletionItemKind.Property; - proposal.insertText = insertText; - proposal.filterText = JSON.stringify(name); - result.add(proposal); - } - if (results.length === LIMIT) { - result.setAsIncomplete(); - } - } - } catch (error) { - const message = (error as Error).message; - result.error(message); - } - } - } - - public async collectValueSuggestions( - resource: string, - location: Location, - result: ISuggestionsCollector - ): Promise { - if ( - location.matches(['dependencies', '*']) || - location.matches(['frameworks', '*', 'dependencies', '*']) || - location.matches(['frameworks', '*', 'frameworkAssemblies', '*']) - ) { - try { - const service = await this.getNugetService('PackageBaseAddress/3.0.0'); - const currentKey = location.path[location.path.length - 1]; - if (typeof currentKey === 'string') { - const queryUrl = service + currentKey + '/index.json'; - const response = await this.makeJSONRequest(queryUrl); - if (Array.isArray(response.versions)) { - const results = response.versions; - for (let i = 0; i < results.length; i++) { - const curr = results[i]; - const name = JSON.stringify(curr); - const proposal = new CompletionItem(name); - proposal.kind = CompletionItemKind.Class; - proposal.insertText = name; - proposal.documentation = ''; - result.add(proposal); - } - if (results.length === LIMIT) { - result.setAsIncomplete(); - } - } - } - } catch (error) { - const message = (error as Error).message; - result.error(message); - } - } - } - - public async collectDefaultSuggestions(resource: string, result: ISuggestionsCollector): Promise { - const defaultValue = { - version: '{{1.0.0-*}}', - dependencies: {}, - frameworks: { - dnx451: {}, - dnxcore50: {}, - }, - }; - const proposal = new CompletionItem(localize('json.project.default', 'Default project.json')); - proposal.kind = CompletionItemKind.Module; - proposal.insertText = JSON.stringify(defaultValue, null, '\t'); - result.add(proposal); - } - - public async resolveSuggestion(item: CompletionItem): Promise { - if (item.kind === CompletionItemKind.Property) { - const pack = item.label; - const info = await this.getInfo(pack); - if (info !== undefined) { - item.documentation = info.description; - item.detail = info.version; - item.insertText = (item.insertText).replace(/\{\{\}\}/, '{{' + info.version + '}}'); - } - return item; - } - return undefined; - } - - private async getInfo(pack: string): Promise<{ description: string; version: string } | undefined> { - try { - const service = await this.getNugetService('SearchQueryService'); - const queryUrl = service + '?q=' + encodeURIComponent(pack) + '&take=' + 5; - const response = await this.makeJSONRequest(queryUrl); - if (Array.isArray(response.data)) { - const results = response.data; - let info: { description: string; version: string } | undefined; - for (let i = 0; i < results.length; i++) { - const res = results[i]; - if (res.id === pack) { - info = { - description: res.description, - version: localize('json.nugget.version.hover', 'Latest version: {0}', res.version), - }; - } - } - return info; - } - return undefined; - } catch (error) { - return undefined; - } - } - - public async getInfoContribution(resource: string, location: Location): Promise { - if ( - location.matches(['dependencies', '*']) || - location.matches(['frameworks', '*', 'dependencies', '*']) || - location.matches(['frameworks', '*', 'frameworkAssemblies', '*']) - ) { - const pack = location.path[location.path.length - 1]; - if (typeof pack === 'string') { - const info = await this.getInfo(pack); - if (info !== undefined) { - const htmlContent: MarkedString[] = []; - htmlContent.push(localize('json.nugget.package.hover', '{0}', pack)); - htmlContent.push(info.description); - htmlContent.push(info.version); - return htmlContent; - } - } - } - return undefined; - } -} diff --git a/src/main.ts b/src/main.ts index 6e0c323a6..a6202846b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -24,7 +24,6 @@ import { PlatformInformation } from './shared/platform'; import { StatusBarItemAdapter } from './statusBarItemAdapter'; import { TelemetryObserver } from './observers/telemetryObserver'; import TelemetryReporter from '@vscode/extension-telemetry'; -import { addJSONProviders } from './features/json/jsonContributions'; import { ProjectStatusBarObserver } from './observers/projectStatusBarObserver'; import { vscodeNetworkSettingsProvider } from './networkSettings'; import { ErrorMessageObserver } from './observers/errorMessageObserver'; @@ -282,8 +281,6 @@ export async function activate( context.subscriptions.push(registerOmnisharpOptionChanges(optionStream)); - // register JSON completion & hover providers for project.json - context.subscriptions.push(addJSONProviders()); context.subscriptions.push( vscode.window.onDidChangeActiveTextEditor(() => { eventStream.post(new ActiveTextEditorChanged()); diff --git a/src/omnisharp/launcher.ts b/src/omnisharp/launcher.ts index b239ab332..de51fc737 100644 --- a/src/omnisharp/launcher.ts +++ b/src/omnisharp/launcher.ts @@ -31,9 +31,8 @@ export const disabledSchemes = new Set([vsls]); /** * Returns a list of potential targets on which OmniSharp can be launched. - * This includes `project.json` files, `*.sln` and `*.slnf` files (if any `*.csproj` files are found), and the root folder - * (if it doesn't contain a `project.json` file, but `project.json` files exist). In addition, the root folder - * is included if there are any `*.csproj` files present, but a `*.sln` or `*.slnf` file is not found. + * This includes `*.sln` and `*.slnf` files (if any `*.csproj` files are found), and the root folder + * In addition, the root folder is included if there are any `*.csproj` files present, but a `*.sln` or `*.slnf` file is not found. */ export async function findLaunchTargets(): Promise { if (!vscode.workspace.workspaceFolders) { @@ -41,7 +40,7 @@ export async function findLaunchTargets(): Promise { } const projectFiles = await vscode.workspace.findFiles( - /*include*/ '{**/*.sln,**/*.slnf,**/*.csproj,**/project.json,**/*.csx,**/*.cake}', + /*include*/ '{**/*.sln,**/*.slnf,**/*.csproj,**/*.csx,**/*.cake}', /*exclude*/ `{${omnisharpOptions.projectFilesExcludePattern}}` ); @@ -65,8 +64,6 @@ export function resourcesToLaunchTargets( ): LaunchTarget[] { // The list of launch targets is calculated like so: // * If there are .csproj files, .sln and .slnf files are considered as launch targets. - // * Any project.json file is considered a launch target. - // * If there is no project.json file in a workspace folder, the workspace folder as added as a launch target. // * Additionally, if there are .csproj files, but no .sln or .slnf file, the root is added as a launch target. // // TODO: @@ -124,7 +121,6 @@ export function resourcesAndFolderMapToLaunchTargets( const otherTargets: LaunchTarget[] = []; workspaceFolderToUriMap.forEach((resources, folderIndex) => { - let hasProjectJsonAtRoot = false; let hasCSX = false; let hasCake = false; let hasCs = false; @@ -137,24 +133,11 @@ export function resourcesAndFolderMapToLaunchTargets( if (isSolution(resource)) { solutionTargets.push(createLaunchTargetForSolution(resource)); } - // Add project.json files - else if (isProjectJson(resource)) { - const dirname = path.dirname(resource.fsPath); - hasProjectJsonAtRoot = hasProjectJsonAtRoot || dirname === folderPath; - projectJsonTargets.push({ - label: path.basename(resource.fsPath), - description: vscode.workspace.asRelativePath(dirname), - target: dirname, - directory: dirname, - workspaceKind: LaunchTargetKind.ProjectJson, - }); - } // Add .csproj files else if (isCSharpProject(resource)) { const dirname = path.dirname(resource.fsPath); // OmniSharp doesn't support opening a project directly, however, it will open a project if - // we pass a folder path which contains a single .csproj. This is similar to how project.json - // is supported. + // we pass a folder path which contains a single .csproj. projectTargets.push({ label: path.basename(resource.fsPath), description: vscode.workspace.asRelativePath(dirname), @@ -176,12 +159,10 @@ export function resourcesAndFolderMapToLaunchTargets( const hasCsProjFiles = projectTargets.length > 0; const hasSlnFile = solutionTargets.length > 0; - const hasProjectJson = projectJsonTargets.length > 0; // Add the root folder under the following circumstances: // * If there are .csproj files, but no .sln or .slnf file, and none in the root. - // * If there are project.json files, but none in the root. - if ((hasCsProjFiles && !hasSlnFile) || (hasProjectJson && !hasProjectJsonAtRoot)) { + if (hasCsProjFiles && !hasSlnFile) { projectRootTargets.push({ label: path.basename(folderPath), description: 'All contained projects', @@ -213,7 +194,7 @@ export function resourcesAndFolderMapToLaunchTargets( }); } - if (hasCs && !hasSlnFile && !hasCsProjFiles && !hasProjectJson && !hasProjectJsonAtRoot) { + if (hasCs && !hasSlnFile && !hasCsProjFiles) { otherTargets.push({ label: path.basename(folderPath), description: '', @@ -246,10 +227,6 @@ function isSolution(resource: vscode.Uri): boolean { return /\.slnf?$/i.test(resource.fsPath); } -function isProjectJson(resource: vscode.Uri): boolean { - return /\project.json$/i.test(resource.fsPath); -} - function isCsx(resource: vscode.Uri): boolean { return /\.csx$/i.test(resource.fsPath); } diff --git a/src/omnisharp/server.ts b/src/omnisharp/server.ts index 9475672d6..d97ad2480 100644 --- a/src/omnisharp/server.ts +++ b/src/omnisharp/server.ts @@ -674,12 +674,12 @@ export class OmniSharpServer { const launchTargets = await findLaunchTargets(); // If there aren't any potential launch targets, we create file watcher and try to - // start the server again once a *.sln, *.slnf, *.csproj, project.json, CSX or Cake file is created. + // start the server again once a *.sln, *.slnf, *.csproj, CSX or Cake file is created. if (launchTargets.length === 0) { await new Promise((resolve) => { // 1st watch for files const watcher = this.vscode.workspace.createFileSystemWatcher( - '{**/*.sln,**/*.slnf,**/*.csproj,**/project.json,**/*.csx,**/*.cake}', + '{**/*.sln,**/*.slnf,**/*.csproj,**/*.csx,**/*.cake}', /*ignoreCreateEvents*/ false, /*ignoreChangeEvents*/ true, /*ignoreDeleteEvents*/ true