<commit_before>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import * as path from 'path';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import type * as Proto from '../protocol';
import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService';
import { nulToken } from '../utils/cancellation';
import { TypeScriptServiceConfiguration } from './configuration';

const localize = nls.loadMessageBundle();

export const enum ProjectType {
	TypeScript,
	JavaScript,
}

export function isImplicitProjectConfigFile(configFileName: string) {
	return configFileName.startsWith('/dev/null/');
}

const defaultProjectConfig = Object.freeze<Proto.ExternalProjectCompilerOptions>({
	module: 'ESNext' as Proto.ModuleKind,
	moduleResolution: 'Node' as Proto.ModuleResolutionKind,
	target: 'ES2020' as Proto.ScriptTarget,
	jsx: 'Preserve' as Proto.JsxEmit,
});

export function inferredProjectCompilerOptions(
	projectType: ProjectType,
	serviceConfig: TypeScriptServiceConfiguration,
): Proto.ExternalProjectCompilerOptions {
	const projectConfig = { ...defaultProjectConfig };

	if (serviceConfig.implicitProjectConfiguration.checkJs) {
		projectConfig.checkJs = true;
		if (projectType === ProjectType.TypeScript) {<commit_msg>Use lowercase preserve for jsxemit<commit_after>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import * as path from 'path';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import type * as Proto from '../protocol';
import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService';
import { nulToken } from '../utils/cancellation';
import { TypeScriptServiceConfiguration } from './configuration';

const localize = nls.loadMessageBundle();

export const enum ProjectType {
	TypeScript,
	JavaScript,
}

export function isImplicitProjectConfigFile(configFileName: string) {
	return configFileName.startsWith('/dev/null/');
}

const defaultProjectConfig = Object.freeze<Proto.ExternalProjectCompilerOptions>({
	module: 'ESNext' as Proto.ModuleKind,
	moduleResolution: 'Node' as Proto.ModuleResolutionKind,
	target: 'ES2020' as Proto.ScriptTarget,
	jsx: 'preserve' as Proto.JsxEmit,
});

export function inferredProjectCompilerOptions(
	projectType: ProjectType,
	serviceConfig: TypeScriptServiceConfiguration,
): Proto.ExternalProjectCompilerOptions {
	const projectConfig = { ...defaultProjectConfig };

	if (serviceConfig.implicitProjectConfiguration.checkJs) {
		projectConfig.checkJs = true;
		if (projectType === ProjectType.TypeScript) {
{'fraction_non_alphanumeric': 0.21049284578696342, 'fraction_numerical': 0.0025437201907790143, 'mean_word_length': 3.0385109114249036, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2274590', 'n_tokens_mistral': 792, 'n_tokens_neox': 778, 'n_words': 220}