remove unused packages

This commit is contained in:
Egor Aristov 2025-10-15 19:23:33 +03:00
parent 5a2294edd6
commit eab0468d4d
Signed by: egor3f
GPG Key ID: 40482A264AAEC85F
2118 changed files with 0 additions and 683948 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,466 +0,0 @@
TestAliasMergingWithNamespace
TestAmbientShorthandGotoDefinition
TestArgumentsAreAvailableAfterEditsAtEndOfFunction
TestAugmentedTypesClass1
TestAugmentedTypesClass3Fourslash
TestBestCommonTypeObjectLiterals
TestBestCommonTypeObjectLiterals1
TestCodeCompletionEscaping
TestCommentsEnumsFourslash
TestCommentsLinePreservation
TestCommentsUnion
TestCompletionAfterQuestionDot
TestCompletionAutoInsertQuestionDot
TestCompletionCloneQuestionToken
TestCompletionEntryClassMembersWithInferredFunctionReturnType1
TestCompletionEntryForArgumentConstrainedToString
TestCompletionEntryForArrayElementConstrainedToString
TestCompletionEntryForArrayElementConstrainedToString2
TestCompletionEntryForClassMembers_StaticWhenBaseTypeIsNotResolved
TestCompletionEntryForUnionProperty
TestCompletionEntryForUnionProperty2
TestCompletionForComputedStringProperties
TestCompletionForMetaProperty
TestCompletionForStringLiteral
TestCompletionForStringLiteral4
TestCompletionForStringLiteralExport
TestCompletionForStringLiteralImport1
TestCompletionForStringLiteralImport2
TestCompletionForStringLiteralNonrelativeImport12
TestCompletionForStringLiteralNonrelativeImport14
TestCompletionForStringLiteralNonrelativeImport16
TestCompletionForStringLiteralNonrelativeImport17
TestCompletionForStringLiteralNonrelativeImport18
TestCompletionForStringLiteralNonrelativeImport2
TestCompletionForStringLiteralNonrelativeImport3
TestCompletionForStringLiteralNonrelativeImport4
TestCompletionForStringLiteralNonrelativeImport7
TestCompletionForStringLiteralNonrelativeImport8
TestCompletionForStringLiteralNonrelativeImport9
TestCompletionForStringLiteralNonrelativeImportTypings1
TestCompletionForStringLiteralNonrelativeImportTypings2
TestCompletionForStringLiteralNonrelativeImportTypings3
TestCompletionForStringLiteralRelativeImport4
TestCompletionForStringLiteralRelativeImport6
TestCompletionForStringLiteralRelativeImportAllowJSTrue
TestCompletionForStringLiteralWithDynamicImport
TestCompletionForStringLiteral_details
TestCompletionForStringLiteral_quotePreference
TestCompletionForStringLiteral_quotePreference1
TestCompletionForStringLiteral_quotePreference2
TestCompletionForStringLiteral_quotePreference3
TestCompletionForStringLiteral_quotePreference4
TestCompletionForStringLiteral_quotePreference5
TestCompletionForStringLiteral_quotePreference6
TestCompletionForStringLiteral_quotePreference7
TestCompletionForStringLiteral_quotePreference8
TestCompletionImportMeta
TestCompletionImportMetaWithGlobalDeclaration
TestCompletionImportModuleSpecifierEndingDts
TestCompletionImportModuleSpecifierEndingJs
TestCompletionImportModuleSpecifierEndingJsx
TestCompletionImportModuleSpecifierEndingTs
TestCompletionImportModuleSpecifierEndingTsxPreserve
TestCompletionImportModuleSpecifierEndingTsxReact
TestCompletionImportModuleSpecifierEndingUnsupportedExtension
TestCompletionInChecks1
TestCompletionInFunctionLikeBody_includesPrimitiveTypes
TestCompletionInJsDoc
TestCompletionInNamedImportLocation
TestCompletionInUncheckedJSFile
TestCompletionListBuilderLocations_VariableDeclarations
TestCompletionListForDerivedType1
TestCompletionListForTransitivelyExportedMembers04
TestCompletionListFunctionExpression
TestCompletionListInArrowFunctionInUnclosedCallSite01
TestCompletionListInClassExpressionWithTypeParameter
TestCompletionListInClassStaticBlocks
TestCompletionListInImportClause01
TestCompletionListInImportClause05
TestCompletionListInImportClause06
TestCompletionListInNamedClassExpression
TestCompletionListInNamedClassExpressionWithShadowing
TestCompletionListInNamedFunctionExpression
TestCompletionListInNamedFunctionExpression1
TestCompletionListInNamedFunctionExpressionWithShadowing
TestCompletionListInScope
TestCompletionListInTemplateLiteralParts1
TestCompletionListInUnclosedCommaExpression01
TestCompletionListInUnclosedCommaExpression02
TestCompletionListInUnclosedFunction08
TestCompletionListInUnclosedFunction09
TestCompletionListInUnclosedTaggedTemplate01
TestCompletionListInUnclosedTaggedTemplate02
TestCompletionListInUnclosedTemplate01
TestCompletionListInUnclosedTemplate02
TestCompletionListInvalidMemberNames
TestCompletionListInvalidMemberNames2
TestCompletionListInvalidMemberNames_escapeQuote
TestCompletionListInvalidMemberNames_startWithSpace
TestCompletionListInvalidMemberNames_withExistingIdentifier
TestCompletionListObjectMembersInTypeLocationWithTypeof
TestCompletionListOfGenericSymbol
TestCompletionListOnAliases
TestCompletionListStringParenthesizedExpression
TestCompletionListStringParenthesizedType
TestCompletionListWithoutVariableinitializer
TestCompletionListsStringLiteralTypeAsIndexedAccessTypeObject
TestCompletionNoAutoInsertQuestionDotForThis
TestCompletionNoAutoInsertQuestionDotForTypeParameter
TestCompletionNoAutoInsertQuestionDotWithUserPreferencesOff
TestCompletionOfAwaitPromise1
TestCompletionOfAwaitPromise2
TestCompletionOfAwaitPromise3
TestCompletionOfAwaitPromise5
TestCompletionOfAwaitPromise6
TestCompletionOfAwaitPromise7
TestCompletionOfInterfaceAndVar
TestCompletionPreferredSuggestions1
TestCompletionWithConditionalOperatorMissingColon
TestCompletionsAfterJSDoc
TestCompletionsBeforeRestArg1
TestCompletionsElementAccessNumeric
TestCompletionsExportImport
TestCompletionsGenericTypeWithMultipleBases1
TestCompletionsImportOrExportSpecifier
TestCompletionsInExport
TestCompletionsInExport_moduleBlock
TestCompletionsInRequire
TestCompletionsJSDocImportTagAttributesEmptyModuleSpecifier1
TestCompletionsJSDocImportTagAttributesErrorModuleSpecifier1
TestCompletionsJSDocImportTagEmptyModuleSpecifier1
TestCompletionsJSDocNoCrash1
TestCompletionsJsdocTypeTagCast
TestCompletionsJsxAttributeInitializer2
TestCompletionsLiteralFromInferenceWithinInferredType3
TestCompletionsLiterals
TestCompletionsMergedDeclarations1
TestCompletionsNewTarget
TestCompletionsOptionalMethod
TestCompletionsOverridingMethod1
TestCompletionsOverridingMethod10
TestCompletionsOverridingMethod11
TestCompletionsOverridingMethod14
TestCompletionsOverridingMethod17
TestCompletionsOverridingMethod3
TestCompletionsOverridingMethod4
TestCompletionsOverridingMethod9
TestCompletionsOverridingMethodCrash1
TestCompletionsOverridingProperties1
TestCompletionsPathsJsonModule
TestCompletionsPathsRelativeJsonModule
TestCompletionsPaths_importType
TestCompletionsPaths_kinds
TestCompletionsPaths_pathMapping
TestCompletionsPaths_pathMapping_nonTrailingWildcard1
TestCompletionsPaths_pathMapping_parentDirectory
TestCompletionsRecommended_union
TestCompletionsRedeclareModuleAsGlobal
TestCompletionsStringsWithTriggerCharacter
TestCompletionsSymbolMembers
TestCompletionsTriggerCharacter
TestCompletionsTuple
TestCompletionsUniqueSymbol1
TestConstEnumQuickInfoAndCompletionList
TestConstQuickInfoAndCompletionList
TestContextuallyTypedFunctionExpressionGeneric1
TestDoubleUnderscoreCompletions
TestEditJsdocType
TestExportDefaultClass
TestExportDefaultFunction
TestFindAllRefsForDefaultExport03
TestFindAllRefsForModule
TestFindAllRefsModuleDotExports
TestFindReferencesBindingPatternInJsdocNoCrash1
TestFindReferencesBindingPatternInJsdocNoCrash2
TestGenericCombinatorWithConstraints1
TestGenericCombinators3
TestGenericFunctionWithGenericParams1
TestGenericInterfacesWithConstraints1
TestGenericTypeWithMultipleBases1MultiFile
TestGetJavaScriptCompletions10
TestGetJavaScriptCompletions12
TestGetJavaScriptCompletions13
TestGetJavaScriptCompletions15
TestGetJavaScriptCompletions18
TestGetJavaScriptCompletions20
TestGetJavaScriptCompletions8
TestGetJavaScriptCompletions9
TestGetJavaScriptGlobalCompletions1
TestGetJavaScriptQuickInfo1
TestGetJavaScriptQuickInfo2
TestGetJavaScriptQuickInfo3
TestGetJavaScriptQuickInfo4
TestGetJavaScriptQuickInfo5
TestGetJavaScriptQuickInfo6
TestGetJavaScriptQuickInfo7
TestGetJavaScriptQuickInfo8
TestGetJavaScriptSyntacticDiagnostics24
TestGetOccurrencesIfElseBroken
TestGetQuickInfoForIntersectionTypes
TestHoverOverComment
TestImportCompletionsPackageJsonExportsSpecifierEndsInTs
TestImportCompletionsPackageJsonExportsTrailingSlash1
TestImportCompletionsPackageJsonImportsConditions1
TestImportCompletionsPackageJsonImportsLength1
TestImportCompletionsPackageJsonImportsLength2
TestImportCompletionsPackageJsonImportsPattern
TestImportCompletionsPackageJsonImportsPattern2
TestImportCompletionsPackageJsonImportsPattern_capsInPath1
TestImportCompletionsPackageJsonImportsPattern_capsInPath2
TestImportCompletionsPackageJsonImportsPattern_js_ts
TestImportCompletionsPackageJsonImportsPattern_ts
TestImportCompletionsPackageJsonImportsPattern_ts_ts
TestImportCompletionsPackageJsonImports_ts
TestImportCompletions_importsMap1
TestImportCompletions_importsMap2
TestImportCompletions_importsMap3
TestImportCompletions_importsMap4
TestImportCompletions_importsMap5
TestIndexerReturnTypes1
TestIndirectClassInstantiation
TestInstanceTypesForGenericType1
TestJavascriptModules20
TestJavascriptModules21
TestJavascriptModulesTypeImport
TestJsDocAugments
TestJsDocExtends
TestJsDocFunctionSignatures10
TestJsDocFunctionSignatures11
TestJsDocFunctionSignatures12
TestJsDocFunctionSignatures13
TestJsDocFunctionSignatures7
TestJsDocFunctionSignatures8
TestJsDocGenerics2
TestJsDocInheritDoc
TestJsDocPropertyDescription1
TestJsDocPropertyDescription10
TestJsDocPropertyDescription11
TestJsDocPropertyDescription12
TestJsDocPropertyDescription2
TestJsDocPropertyDescription3
TestJsDocPropertyDescription4
TestJsDocPropertyDescription5
TestJsDocPropertyDescription6
TestJsDocPropertyDescription7
TestJsDocPropertyDescription8
TestJsDocPropertyDescription9
TestJsDocTagsWithHyphen
TestJsQuickInfoGenerallyAcceptableSize
TestJsRequireQuickInfo
TestJsdocCallbackTag
TestJsdocLink2
TestJsdocLink3
TestJsdocLink6
TestJsdocTemplatePrototypeCompletions
TestJsdocThrowsTagCompletion
TestJsdocTypedefTag
TestJsdocTypedefTag2
TestJsdocTypedefTagNamespace
TestJsdocTypedefTagServices
TestLetQuickInfoAndCompletionList
TestLocalFunction
TestMemberListInReopenedEnum
TestMemberListInWithBlock
TestMemberListOfExportedClass
TestMemberListOnContextualThis
TestNgProxy1
TestNoQuickInfoForLabel
TestNoQuickInfoInWhitespace
TestNodeModulesImportCompletions1
TestNumericPropertyNames
TestOverloadQuickInfo
TestParameterWithDestructuring
TestParameterWithNestedDestructuring
TestPathCompletionsAllowModuleAugmentationExtensions
TestPathCompletionsAllowTsExtensions
TestPathCompletionsPackageJsonExportsBundlerNoNodeCondition
TestPathCompletionsPackageJsonExportsCustomConditions
TestPathCompletionsPackageJsonExportsWildcard1
TestPathCompletionsPackageJsonExportsWildcard10
TestPathCompletionsPackageJsonExportsWildcard11
TestPathCompletionsPackageJsonExportsWildcard12
TestPathCompletionsPackageJsonExportsWildcard2
TestPathCompletionsPackageJsonExportsWildcard3
TestPathCompletionsPackageJsonExportsWildcard4
TestPathCompletionsPackageJsonExportsWildcard5
TestPathCompletionsPackageJsonExportsWildcard6
TestPathCompletionsPackageJsonExportsWildcard7
TestPathCompletionsPackageJsonExportsWildcard8
TestPathCompletionsPackageJsonExportsWildcard9
TestPathCompletionsPackageJsonImportsBundlerNoNodeCondition
TestPathCompletionsPackageJsonImportsCustomConditions
TestPathCompletionsPackageJsonImportsIgnoreMatchingNodeModule2
TestPathCompletionsPackageJsonImportsOnlyFromClosestScope1
TestPathCompletionsPackageJsonImportsSrcNoDistWildcard1
TestPathCompletionsPackageJsonImportsSrcNoDistWildcard2
TestPathCompletionsPackageJsonImportsSrcNoDistWildcard3
TestPathCompletionsPackageJsonImportsSrcNoDistWildcard4
TestPathCompletionsPackageJsonImportsSrcNoDistWildcard5
TestPathCompletionsPackageJsonImportsSrcNoDistWildcard6
TestPathCompletionsPackageJsonImportsSrcNoDistWildcard7
TestPathCompletionsPackageJsonImportsSrcNoDistWildcard8
TestPathCompletionsPackageJsonImportsSrcNoDistWildcard9
TestPathCompletionsPackageJsonImportsWildcard1
TestPathCompletionsPackageJsonImportsWildcard10
TestPathCompletionsPackageJsonImportsWildcard11
TestPathCompletionsPackageJsonImportsWildcard12
TestPathCompletionsPackageJsonImportsWildcard2
TestPathCompletionsPackageJsonImportsWildcard3
TestPathCompletionsPackageJsonImportsWildcard4
TestPathCompletionsPackageJsonImportsWildcard5
TestPathCompletionsPackageJsonImportsWildcard6
TestPathCompletionsPackageJsonImportsWildcard7
TestPathCompletionsPackageJsonImportsWildcard8
TestPathCompletionsPackageJsonImportsWildcard9
TestPathCompletionsTypesVersionsLocal
TestPathCompletionsTypesVersionsWildcard1
TestPathCompletionsTypesVersionsWildcard2
TestPathCompletionsTypesVersionsWildcard3
TestPathCompletionsTypesVersionsWildcard4
TestPathCompletionsTypesVersionsWildcard5
TestPathCompletionsTypesVersionsWildcard6
TestProtoVarVisibleWithOuterScopeUnderscoreProto
TestQuickInfoAlias
TestQuickInfoAssertionNodeNotReusedWhenTypeNotEquivalent1
TestQuickInfoBindingPatternInJsdocNoCrash1
TestQuickInfoClassKeyword
TestQuickInfoContextualTyping
TestQuickInfoContextuallyTypedSignatureOptionalParameterFromIntersection1
TestQuickInfoDisplayPartsIife
TestQuickInfoElementAccessDeclaration
TestQuickInfoForConstTypeReference
TestQuickInfoForContextuallyTypedArrowFunctionInSuperCall
TestQuickInfoForContextuallyTypedIife
TestQuickInfoForContextuallyTypedParameters
TestQuickInfoForGenericConstraints1
TestQuickInfoForGenericPrototypeMember
TestQuickInfoForGenericTaggedTemplateExpression
TestQuickInfoForGetterAndSetter
TestQuickInfoForIndexerResultWithConstraint
TestQuickInfoForNamedTupleMember
TestQuickInfoForObjectBindingElementPropertyName04
TestQuickInfoForShorthandProperty
TestQuickInfoForSyntaxErrorNoError
TestQuickInfoForTypeParameterInTypeAlias1
TestQuickInfoForTypeParameterInTypeAlias2
TestQuickInfoForTypeofParameter
TestQuickInfoForUMDModuleAlias
TestQuickInfoFromContextualType
TestQuickInfoFunctionKeyword
TestQuickInfoGenerics
TestQuickInfoGetterSetter
TestQuickInfoInInvalidIndexSignature
TestQuickInfoInJsdocInTsFile1
TestQuickInfoInOptionalChain
TestQuickInfoInWithBlock
TestQuickInfoJSDocBackticks
TestQuickInfoJSDocFunctionNew
TestQuickInfoJSDocFunctionThis
TestQuickInfoJSExport
TestQuickInfoJsDocGetterSetterNoCrash1
TestQuickInfoJsDocNonDiscriminatedUnionSharedProp
TestQuickInfoJsPropertyAssignedAfterMethodDeclaration
TestQuickInfoJsdocTypedefMissingType
TestQuickInfoMappedSpreadTypes
TestQuickInfoMappedType
TestQuickInfoMappedTypeMethods
TestQuickInfoMappedTypeRecursiveInference
TestQuickInfoModuleVariables
TestQuickInfoNarrowedTypeOfAliasSymbol
TestQuickInfoNestedGenericCalls
TestQuickInfoOnArgumentsInsideFunction
TestQuickInfoOnCatchVariable
TestQuickInfoOnClosingJsx
TestQuickInfoOnElementAccessInWriteLocation1
TestQuickInfoOnElementAccessInWriteLocation2
TestQuickInfoOnElementAccessInWriteLocation3
TestQuickInfoOnElementAccessInWriteLocation4
TestQuickInfoOnElementAccessInWriteLocation5
TestQuickInfoOnErrorTypes1
TestQuickInfoOnExpandoLikePropertyWithSetterDeclarationJs1
TestQuickInfoOnExpandoLikePropertyWithSetterDeclarationJs2
TestQuickInfoOnFunctionPropertyReturnedFromGenericFunction1
TestQuickInfoOnFunctionPropertyReturnedFromGenericFunction2
TestQuickInfoOnFunctionPropertyReturnedFromGenericFunction3
TestQuickInfoOnGenericWithConstraints1
TestQuickInfoOnInternalAliases
TestQuickInfoOnJsxNamespacedNameWithDoc1
TestQuickInfoOnMethodOfImportEquals
TestQuickInfoOnNarrowedType
TestQuickInfoOnNarrowedTypeInModule
TestQuickInfoOnNewKeyword01
TestQuickInfoOnObjectLiteralWithAccessors
TestQuickInfoOnObjectLiteralWithOnlyGetter
TestQuickInfoOnObjectLiteralWithOnlySetter
TestQuickInfoOnPropDeclaredUsingIndexSignatureOnInterfaceWithBase
TestQuickInfoOnPropertyAccessInWriteLocation1
TestQuickInfoOnPropertyAccessInWriteLocation2
TestQuickInfoOnPropertyAccessInWriteLocation3
TestQuickInfoOnPropertyAccessInWriteLocation4
TestQuickInfoOnPropertyAccessInWriteLocation5
TestQuickInfoOnThis
TestQuickInfoOnThis2
TestQuickInfoOnThis3
TestQuickInfoOnThis4
TestQuickInfoOnUndefined
TestQuickInfoOnVarInArrowExpression
TestQuickInfoPrivateIdentifierInTypeReferenceNoCrash1
TestQuickInfoPropertyTag
TestQuickInfoSignatureOptionalParameterFromUnion1
TestQuickInfoSignatureRestParameterFromUnion1
TestQuickInfoSignatureRestParameterFromUnion2
TestQuickInfoSignatureRestParameterFromUnion3
TestQuickInfoSignatureRestParameterFromUnion4
TestQuickInfoSpecialPropertyAssignment
TestQuickInfoStaticPrototypePropertyOnClass
TestQuickInfoTemplateTag
TestQuickInfoTypeAliasDefinedInDifferentFile
TestQuickInfoTypeError
TestQuickInfoTypeOfThisInStatics
TestQuickInfoTypeOnlyNamespaceAndClass
TestQuickInfoUnionOfNamespaces
TestQuickInfoUnion_discriminated
TestQuickInfoWidenedTypes
TestQuickInfo_notInsideComment
TestQuickInforForSucessiveInferencesIsNotAny
TestQuickinfo01
TestQuickinfoForNamespaceMergeWithClassConstrainedToSelf
TestQuickinfoForUnionProperty
TestQuickinfoWrongComment
TestRecursiveInternalModuleImport
TestReferencesForStatementKeywords
TestReferencesInEmptyFile
TestRegexDetection
TestRenameForAliasingExport02
TestRenameFromNodeModulesDep1
TestRenameFromNodeModulesDep2
TestRenameFromNodeModulesDep3
TestRenameFromNodeModulesDep4
TestRenamePrivateFields
TestReverseMappedTypeQuickInfo
TestSelfReferencedExternalModule
TestSignatureHelpInferenceJsDocImportTag
TestStringCompletionsImportOrExportSpecifier
TestStringCompletionsVsEscaping
TestSymbolCompletionLowerPriority
TestSyntheticImportFromBabelGeneratedFile1
TestSyntheticImportFromBabelGeneratedFile2
TestThisBindingInLambda
TestThisPredicateFunctionQuickInfo01
TestThisPredicateFunctionQuickInfo02
TestTripleSlashRefPathCompletionAbsolutePaths
TestTripleSlashRefPathCompletionContext
TestTripleSlashRefPathCompletionExtensionsAllowJSFalse
TestTripleSlashRefPathCompletionExtensionsAllowJSTrue
TestTripleSlashRefPathCompletionHiddenFile
TestTripleSlashRefPathCompletionRootdirs
TestTsxCompletion14
TestTsxCompletion15
TestTsxCompletionNonTagLessThan
TestTsxQuickInfo1
TestTsxQuickInfo4
TestTsxQuickInfo5
TestTsxQuickInfo6
TestTsxQuickInfo7
TestTypeOperatorNodeBuilding

View File

@ -1,71 +0,0 @@
import * as fs from "fs";
import * as path from "path";
const scriptsDir = import.meta.dirname;
const manualTestsPath = path.join(scriptsDir, "manualTests.txt");
const genDir = path.join(scriptsDir, "../", "tests", "gen");
const manualDir = path.join(scriptsDir, "../", "tests", "manual");
const submoduleDir = path.join(scriptsDir, "../../../", "_submodules", "TypeScript", "tests", "cases", "fourslash");
function main() {
const args = process.argv.slice(2);
if (args.length === 0) {
console.error("Please provide the name of the generated test file.");
process.exit(1);
}
const testName = args[0];
const testFileName = testName;
const genTestFile = path.join(genDir, testFileName + "_test.go");
const submoduleTestFile = path.join(submoduleDir, testFileName + ".ts");
const submoduleServerTestFile = path.join(submoduleDir, "server", testFileName + ".ts");
let testKind: "gen" | "submodule" | "submoduleServer" | undefined;
if (fs.existsSync(genTestFile)) {
testKind = "gen";
}
else if (fs.existsSync(submoduleTestFile)) {
testKind = "submodule";
}
else if (fs.existsSync(submoduleServerTestFile)) {
testKind = "submoduleServer";
}
if (!testKind) {
console.error(
`Could not find test neither as '${genTestFile}', nor as '${submoduleTestFile}' or '${submoduleServerTestFile}'.` +
`Make sure the test exists in the gen directory or in the submodule.`,
);
process.exit(1);
}
if (!fs.existsSync(manualDir)) {
fs.mkdirSync(manualDir, { recursive: true });
}
if (testKind === "gen") {
const manualTestFile = path.join(manualDir, path.basename(genTestFile));
markAsManual(genTestFile, manualTestFile);
}
let manualTests: string[] = [];
if (fs.existsSync(manualTestsPath)) {
const content = fs.readFileSync(manualTestsPath, "utf-8");
manualTests = content.split("\n").map(line => line.trim()).filter(line => line.length > 0);
}
if (!manualTests.includes(testName)) {
manualTests.push(testName);
manualTests.sort();
fs.writeFileSync(manualTestsPath, [...manualTests, ""].join("\n"), "utf-8");
}
}
function markAsManual(genFilePath: string, manualFilePath: string) {
const content = fs.readFileSync(genFilePath, "utf-8");
const updatedContent = content.replace(/^\s*t\.Skip\(\)\s*$/m, "");
fs.writeFileSync(manualFilePath, updatedContent, "utf-8");
fs.rmSync(genFilePath);
}
main();

View File

@ -1,7 +0,0 @@
completionListInClosedFunction05
completionsAtIncompleteObjectLiteralProperty
completionsSelfDeclaring1
completionsWithDeprecatedTag4
renameDefaultKeyword
renameForDefaultExport01
tsxCompletion12

View File

@ -1,9 +0,0 @@
{
"compilerOptions": {
"strict": true,
"noEmit": true,
"module": "nodenext",
"allowImportingTsExtensions": true,
"noFallthroughCasesInSwitch": true
}
}

View File

@ -1,38 +0,0 @@
import * as cp from "child_process";
import * as fs from "fs";
import path from "path";
import which from "which";
import { main as convertFourslash } from "./convertFourslash.mts";
const failingTestsPath = path.join(import.meta.dirname, "failingTests.txt");
function main() {
const oldFailingTests = fs.readFileSync(failingTestsPath, "utf-8");
fs.writeFileSync(failingTestsPath, "", "utf-8");
convertFourslash();
const go = which.sync("go");
let testOutput: string;
try {
testOutput = cp.execFileSync(go, ["test", "./internal/fourslash/tests/gen"], { encoding: "utf-8" });
}
catch (error) {
testOutput = (error as { stdout: string; }).stdout as string;
}
const panicRegex = /^panic/m;
if (panicRegex.test(testOutput)) {
fs.writeFileSync(failingTestsPath, oldFailingTests, "utf-8");
throw new Error("Unrecovered panic detected in tests");
}
const failRegex = /--- FAIL: ([\S]+)/gm;
const failingTests: string[] = [];
let match;
while ((match = failRegex.exec(testOutput)) !== null) {
failingTests.push(match[1]);
}
fs.writeFileSync(failingTestsPath, failingTests.sort().join("\n") + "\n", "utf-8");
convertFourslash();
}
main();

View File

@ -1,609 +0,0 @@
package fourslash
import (
"cmp"
"errors"
"fmt"
"io/fs"
"regexp"
"slices"
"strings"
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/collections"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/core"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/debug"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/stringutil"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil/baseline"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/vfs"
)
func (f *FourslashTest) addResultToBaseline(t *testing.T, command string, actual string) {
b, ok := f.baselines[command]
if !ok {
f.baselines[command] = &strings.Builder{}
b = f.baselines[command]
}
if b.Len() != 0 {
b.WriteString("\n\n\n\n")
}
b.WriteString(`// === ` + command + " ===\n" + actual)
}
func (f *FourslashTest) writeToBaseline(command string, content string) {
b, ok := f.baselines[command]
if !ok {
f.baselines[command] = &strings.Builder{}
b = f.baselines[command]
}
b.WriteString(content)
}
func getBaselineFileName(t *testing.T, command string) string {
return getBaseFileNameFromTest(t) + "." + getBaselineExtension(command)
}
func getBaselineExtension(command string) string {
switch command {
case "QuickInfo", "SignatureHelp":
return "baseline"
case "Auto Imports":
return "baseline.md"
case "findAllReferences", "goToDefinition", "findRenameLocations":
return "baseline.jsonc"
default:
return "baseline.jsonc"
}
}
func getBaselineOptions(command string) baseline.Options {
subfolder := "fourslash/" + normalizeCommandName(command)
switch command {
case "findRenameLocations":
return baseline.Options{
Subfolder: subfolder,
IsSubmodule: true,
DiffFixupOld: func(s string) string {
var commandLines []string
commandPrefix := regexp.MustCompile(`^// === ([a-z\sA-Z]*) ===`)
testFilePrefix := "/tests/cases/fourslash"
serverTestFilePrefix := "/server"
contextSpanOpening := "<|"
contextSpanClosing := "|>"
oldPreference := "providePrefixAndSuffixTextForRename"
newPreference := "useAliasesForRename"
replacer := strings.NewReplacer(
contextSpanOpening, "",
contextSpanClosing, "",
testFilePrefix, "",
serverTestFilePrefix, "",
oldPreference, newPreference,
)
lines := strings.Split(s, "\n")
var isInCommand bool
for _, line := range lines {
if strings.HasPrefix(line, "// @findInStrings: ") || strings.HasPrefix(line, "// @findInComments: ") {
continue
}
matches := commandPrefix.FindStringSubmatch(line)
if len(matches) > 0 {
commandName := matches[1]
if commandName == command {
isInCommand = true
} else {
isInCommand = false
}
}
if isInCommand {
fixedLine := replacer.Replace(line)
commandLines = append(commandLines, fixedLine)
}
}
return strings.Join(commandLines, "\n")
},
}
default:
return baseline.Options{
Subfolder: subfolder,
}
}
}
func normalizeCommandName(command string) string {
words := strings.Fields(command)
command = strings.Join(words, "")
return stringutil.LowerFirstChar(command)
}
type baselineFourslashLocationsOptions struct {
// markerInfo
marker MarkerOrRange // location
markerName string // name of the marker to be printed in baseline
endMarker string
startMarkerPrefix func(span lsproto.Location) *string
endMarkerSuffix func(span lsproto.Location) *string
}
func (f *FourslashTest) getBaselineForLocationsWithFileContents(spans []lsproto.Location, options baselineFourslashLocationsOptions) string {
locationsByFile := collections.GroupBy(spans, func(span lsproto.Location) lsproto.DocumentUri { return span.Uri })
rangesByFile := collections.MultiMap[lsproto.DocumentUri, lsproto.Range]{}
for file, locs := range locationsByFile.M {
for _, loc := range locs {
rangesByFile.Add(file, loc.Range)
}
}
return f.getBaselineForGroupedLocationsWithFileContents(
&rangesByFile,
options,
)
}
func (f *FourslashTest) getBaselineForGroupedLocationsWithFileContents(groupedRanges *collections.MultiMap[lsproto.DocumentUri, lsproto.Range], options baselineFourslashLocationsOptions) string {
// We must always print the file containing the marker,
// but don't want to print it twice at the end if it already
// found in a file with ranges.
foundMarker := false
baselineEntries := []string{}
err := f.vfs.WalkDir("/", func(path string, d vfs.DirEntry, e error) error {
if e != nil {
return e
}
if !d.Type().IsRegular() {
return nil
}
fileName := ls.FileNameToDocumentURI(path)
ranges := groupedRanges.Get(fileName)
if len(ranges) == 0 {
return nil
}
content, ok := f.vfs.ReadFile(path)
if !ok {
// !!! error?
return nil
}
if options.marker != nil && options.marker.FileName() == path {
foundMarker = true
}
baselineEntries = append(baselineEntries, f.getBaselineContentForFile(path, content, ranges, nil, options))
return nil
})
if err != nil && !errors.Is(err, fs.ErrNotExist) {
panic("walkdir error during fourslash baseline: " + err.Error())
}
if !foundMarker && options.marker != nil {
// If we didn't find the marker in any file, we need to add it.
markerFileName := options.marker.FileName()
if content, ok := f.vfs.ReadFile(markerFileName); ok {
baselineEntries = append(baselineEntries, f.getBaselineContentForFile(markerFileName, content, nil, nil, options))
}
}
// !!! foundAdditionalSpan
// !!! skipDocumentContainingOnlyMarker
return strings.Join(baselineEntries, "\n\n")
}
type baselineDetail struct {
pos lsproto.Position
positionMarker string
span *lsproto.Range
kind string
}
func (f *FourslashTest) getBaselineContentForFile(
fileName string,
content string,
spansInFile []lsproto.Range,
spanToContextId map[lsproto.Range]int,
options baselineFourslashLocationsOptions,
) string {
details := []*baselineDetail{}
detailPrefixes := map[*baselineDetail]string{}
detailSuffixes := map[*baselineDetail]string{}
canDetermineContextIdInline := true
uri := ls.FileNameToDocumentURI(fileName)
if options.marker != nil && options.marker.FileName() == fileName {
details = append(details, &baselineDetail{pos: options.marker.LSPos(), positionMarker: options.markerName})
}
for _, span := range spansInFile {
textSpanIndex := len(details)
details = append(details,
&baselineDetail{pos: span.Start, positionMarker: "[|", span: &span, kind: "textStart"},
&baselineDetail{pos: span.End, positionMarker: core.OrElse(options.endMarker, "|]"), span: &span, kind: "textEnd"},
)
if options.startMarkerPrefix != nil {
startPrefix := options.startMarkerPrefix(lsproto.Location{Uri: uri, Range: span})
if startPrefix != nil {
// Special case: if this span starts at the same position as the provided marker,
// we want the span's prefix to appear before the marker name.
// i.e. We want `/*START PREFIX*/A: /*RENAME*/[|ARENAME|]`,
// not `/*RENAME*//*START PREFIX*/A: [|ARENAME|]`
if options.marker != nil && fileName == options.marker.FileName() && span.Start == options.marker.LSPos() {
_, ok := detailPrefixes[details[0]]
debug.Assert(!ok, "Expected only single prefix at marker location")
detailPrefixes[details[0]] = *startPrefix
} else {
detailPrefixes[details[textSpanIndex]] = *startPrefix
}
}
}
if options.endMarkerSuffix != nil {
endSuffix := options.endMarkerSuffix(lsproto.Location{Uri: uri, Range: span})
if endSuffix != nil {
detailSuffixes[details[textSpanIndex+1]] = *endSuffix
}
}
}
slices.SortStableFunc(details, func(d1, d2 *baselineDetail) int {
return ls.ComparePositions(d1.pos, d2.pos)
})
// !!! if canDetermineContextIdInline
textWithContext := newTextWithContext(fileName, content)
// Our preferred way to write marker is
// /*MARKER*/[| some text |]
// [| some /*MARKER*/ text |]
// [| some text |]/*MARKER*/
// Stable sort should handle first two cases but with that marker will be before rangeEnd if locations match
// So we will defer writing marker in this case by checking and finding index of rangeEnd if same
var deferredMarkerIndex *int
for index, detail := range details {
if detail.span == nil && deferredMarkerIndex == nil {
// If this is marker position and its same as textEnd and/or contextEnd we want to write marker after those
for matchingEndPosIndex := index + 1; matchingEndPosIndex < len(details); matchingEndPosIndex++ {
// Defer after the location if its same as rangeEnd
if details[matchingEndPosIndex].pos == detail.pos && strings.HasSuffix(details[matchingEndPosIndex].kind, "End") {
deferredMarkerIndex = ptrTo(matchingEndPosIndex)
}
// Dont defer further than already determined
break
}
// Defer writing marker position to deffered marker index
if deferredMarkerIndex != nil {
continue
}
}
textWithContext.add(detail)
textWithContext.pos = detail.pos
// Prefix
prefix := detailPrefixes[detail]
if prefix != "" {
textWithContext.newContent.WriteString(prefix)
}
textWithContext.newContent.WriteString(detail.positionMarker)
if detail.span != nil {
switch detail.kind {
case "textStart":
var text string
if contextId, ok := spanToContextId[*detail.span]; ok {
isAfterContextStart := false
for textStartIndex := index - 1; textStartIndex >= 0; textStartIndex-- {
textStartDetail := details[textStartIndex]
if textStartDetail.kind == "contextStart" && textStartDetail.span == detail.span {
isAfterContextStart = true
break
}
// Marker is ok to skip over
if textStartDetail.span != nil {
break
}
}
// Skip contextId on span thats surrounded by context span immediately
if !isAfterContextStart {
if text == "" {
text = fmt.Sprintf(`contextId: %v`, contextId)
} else {
text = fmt.Sprintf(`contextId: %v`, contextId) + `, ` + text
}
}
}
if text != "" {
textWithContext.newContent.WriteString(`{ ` + text + ` |}`)
}
case "contextStart":
if canDetermineContextIdInline {
spanToContextId[*detail.span] = len(spanToContextId)
}
}
if deferredMarkerIndex != nil && *deferredMarkerIndex == index {
// Write the marker
textWithContext.newContent.WriteString(options.markerName)
deferredMarkerIndex = nil
detail = details[0] // Marker detail
}
}
if suffix, ok := detailSuffixes[detail]; ok {
textWithContext.newContent.WriteString(suffix)
}
}
textWithContext.add(nil)
if textWithContext.newContent.Len() != 0 {
textWithContext.readableContents.WriteString("\n")
textWithContext.readableJsoncBaseline(textWithContext.newContent.String())
}
return textWithContext.readableContents.String()
}
var lineSplitter = regexp.MustCompile(`\r?\n`)
type textWithContext struct {
nLinesContext int // number of context lines to write to baseline
readableContents *strings.Builder // builds what will be returned to be written to baseline
newContent *strings.Builder // helper; the part of the original file content to write between details
pos lsproto.Position
isLibFile bool
fileName string
content string // content of the original file
lineStarts *ls.LSPLineMap
converters *ls.Converters
// posLineInfo
posInfo *lsproto.Position
lineInfo int
}
// implements ls.Script
func (t *textWithContext) FileName() string {
return t.fileName
}
// implements ls.Script
func (t *textWithContext) Text() string {
return t.content
}
func newTextWithContext(fileName string, content string) *textWithContext {
t := &textWithContext{
nLinesContext: 4,
readableContents: &strings.Builder{},
isLibFile: regexp.MustCompile(`lib.*\.d\.ts$`).MatchString(fileName),
newContent: &strings.Builder{},
pos: lsproto.Position{Line: 0, Character: 0},
fileName: fileName,
content: content,
lineStarts: ls.ComputeLSPLineStarts(content),
}
t.converters = ls.NewConverters(lsproto.PositionEncodingKindUTF8, func(_ string) *ls.LSPLineMap {
return t.lineStarts
})
t.readableContents.WriteString("// === " + fileName + " ===")
return t
}
func (t *textWithContext) add(detail *baselineDetail) {
if t.content == "" && detail == nil {
panic("Unsupported")
}
if detail == nil || (detail.kind != "textEnd" && detail.kind != "contextEnd") {
// Calculate pos to location number of lines
posLineIndex := t.lineInfo
if t.posInfo == nil || *t.posInfo != t.pos {
posLineIndex = t.lineStarts.ComputeIndexOfLineStart(t.converters.LineAndCharacterToPosition(t, t.pos))
}
locationLineIndex := len(t.lineStarts.LineStarts) - 1
if detail != nil {
locationLineIndex = t.lineStarts.ComputeIndexOfLineStart(t.converters.LineAndCharacterToPosition(t, detail.pos))
t.posInfo = &detail.pos
t.lineInfo = locationLineIndex
}
nLines := 0
if t.newContent.Len() != 0 {
nLines += t.nLinesContext + 1
}
if detail != nil {
nLines += t.nLinesContext + 1
}
// first nLinesContext and last nLinesContext
if locationLineIndex-posLineIndex > nLines {
if t.newContent.Len() != 0 {
var skippedString string
if t.isLibFile {
skippedString = "--- (line: --) skipped ---\n"
} else {
skippedString = fmt.Sprintf(`// --- (line: %v) skipped ---`, posLineIndex+t.nLinesContext+1)
}
t.readableContents.WriteString("\n")
t.readableJsoncBaseline(t.newContent.String() + t.sliceOfContent(
t.getIndex(t.pos),
t.getIndex(t.lineStarts.LineStarts[posLineIndex+t.nLinesContext]),
) + skippedString)
if detail != nil {
t.readableContents.WriteString("\n")
}
t.newContent.Reset()
}
if detail != nil {
if t.isLibFile {
t.newContent.WriteString("--- (line: --) skipped ---\n")
} else {
t.newContent.WriteString(fmt.Sprintf("--- (line: %v) skipped ---\n", locationLineIndex-t.nLinesContext+1))
}
t.newContent.WriteString(t.sliceOfContent(
t.getIndex(t.lineStarts.LineStarts[locationLineIndex-t.nLinesContext+1]),
t.getIndex(detail.pos),
))
}
return
}
}
if detail == nil {
t.newContent.WriteString(t.sliceOfContent(t.getIndex(t.pos), nil))
} else {
t.newContent.WriteString(t.sliceOfContent(t.getIndex(t.pos), t.getIndex(detail.pos)))
}
}
func (t *textWithContext) readableJsoncBaseline(text string) {
for i, line := range lineSplitter.Split(text, -1) {
if i > 0 {
t.readableContents.WriteString("\n")
}
t.readableContents.WriteString(`// ` + line)
}
}
type markerAndItem[T any] struct {
Marker *Marker `json:"marker"`
Item T `json:"item"`
}
func annotateContentWithTooltips[T comparable](
t *testing.T,
f *FourslashTest,
markersAndItems []markerAndItem[T],
opName string,
getRange func(item T) *lsproto.Range,
getTooltipLines func(item T, prev T) []string,
) string {
barWithGutter := "| " + strings.Repeat("-", 70)
// sort by file, then *backwards* by position in the file
// so we can insert multiple times on a line without counting
sorted := slices.Clone(markersAndItems)
slices.SortFunc(sorted, func(a, b markerAndItem[T]) int {
if c := cmp.Compare(a.Marker.FileName(), b.Marker.FileName()); c != 0 {
return c
}
return -cmp.Compare(a.Marker.Position, b.Marker.Position)
})
filesToLines := collections.NewOrderedMapWithSizeHint[string, []string](1)
var previous T
for _, itemAndMarker := range sorted {
marker := itemAndMarker.Marker
item := itemAndMarker.Item
textRange := getRange(item)
if textRange == nil {
start := marker.LSPosition
end := start
end.Character = end.Character + 1
textRange = &lsproto.Range{Start: start, End: end}
}
if textRange.Start.Line != textRange.End.Line {
t.Fatalf("Expected text range to be on a single line, got %v", textRange)
}
underline := strings.Repeat(" ", int(textRange.Start.Character)) +
strings.Repeat("^", int(textRange.End.Character-textRange.Start.Character))
fileName := marker.FileName()
lines, ok := filesToLines.Get(fileName)
if !ok {
lines = lineSplitter.Split(f.getScriptInfo(fileName).content, -1)
}
var tooltipLines []string
if item != *new(T) {
tooltipLines = getTooltipLines(item, previous)
}
if len(tooltipLines) == 0 {
tooltipLines = []string{fmt.Sprintf("No %s at /*%s*/.", opName, *marker.Name)}
}
tooltipLines = core.Map(tooltipLines, func(line string) string {
return "| " + line
})
linesToInsert := make([]string, len(tooltipLines)+3)
linesToInsert[0] = underline
linesToInsert[1] = barWithGutter
copy(linesToInsert[2:], tooltipLines)
linesToInsert[len(linesToInsert)-1] = barWithGutter
lines = slices.Insert(
lines,
int(textRange.Start.Line+1),
linesToInsert...,
)
filesToLines.Set(fileName, lines)
previous = item
}
builder := strings.Builder{}
seenFirst := false
for fileName, lines := range filesToLines.Entries() {
builder.WriteString(fmt.Sprintf("=== %s ===\n", fileName))
for _, line := range lines {
builder.WriteString("// ")
builder.WriteString(line)
builder.WriteByte('\n')
}
if seenFirst {
builder.WriteString("\n\n")
} else {
seenFirst = true
}
}
return builder.String()
}
func (t *textWithContext) sliceOfContent(start *int, end *int) string {
if start == nil || *start < 0 {
start = ptrTo(0)
}
if end == nil || *end > len(t.content) {
end = ptrTo(len(t.content))
}
if *start > *end {
return ""
}
return t.content[*start:*end]
}
func (t *textWithContext) getIndex(i interface{}) *int {
switch i := i.(type) {
case *int:
return i
case int:
return ptrTo(i)
case core.TextPos:
return ptrTo(int(i))
case *core.TextPos:
return ptrTo(int(*i))
case lsproto.Position:
return t.getIndex(t.converters.LineAndCharacterToPosition(t, i))
case *lsproto.Position:
return t.getIndex(t.converters.LineAndCharacterToPosition(t, *i))
}
panic(fmt.Sprintf("getIndex: unsupported type %T", i))
}
func codeFence(lang string, code string) string {
return "```" + lang + "\n" + code + "\n```"
}

File diff suppressed because it is too large Load Diff

View File

@ -1,447 +0,0 @@
package fourslash
import (
"fmt"
"slices"
"strings"
"testing"
"unicode/utf8"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/core"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/stringutil"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testrunner"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/tspath"
"github.com/go-json-experiment/json"
)
// Inserted in source files by surrounding desired text
// in a range with `[|` and `|]`. For example,
//
// [|text in range|]
//
// is a range with `text in range` "selected".
type RangeMarker struct {
fileName string
Range core.TextRange
LSRange lsproto.Range
Marker *Marker
}
func (r *RangeMarker) LSPos() lsproto.Position {
return r.LSRange.Start
}
func (r *RangeMarker) FileName() string {
return r.fileName
}
func (r *RangeMarker) GetName() *string {
if r.Marker == nil {
return nil
}
return r.Marker.Name
}
type Marker struct {
fileName string
Position int
LSPosition lsproto.Position
Name *string // `nil` for anonymous markers such as `{| "foo": "bar" |}`
Data map[string]any
}
func (m *Marker) LSPos() lsproto.Position {
return m.LSPosition
}
func (m *Marker) FileName() string {
return m.fileName
}
func (m *Marker) GetName() *string {
return m.Name
}
type MarkerOrRange interface {
FileName() string
LSPos() lsproto.Position
GetName() *string
}
type TestData struct {
Files []*TestFileInfo
MarkerPositions map[string]*Marker
Markers []*Marker
Symlinks map[string]string
GlobalOptions map[string]string
Ranges []*RangeMarker
}
type testFileWithMarkers struct {
file *TestFileInfo
markers []*Marker
ranges []*RangeMarker
}
func ParseTestData(t *testing.T, contents string, fileName string) TestData {
// List of all the subfiles we've parsed out
var files []*TestFileInfo
markerPositions := make(map[string]*Marker)
var markers []*Marker
var ranges []*RangeMarker
filesWithMarker, symlinks, _, globalOptions, e := testrunner.ParseTestFilesAndSymlinks(
contents,
fileName,
parseFileContent,
)
if e != nil {
t.Fatalf("Error parsing fourslash data: %s", e.Error())
}
hasTSConfig := false
for _, file := range filesWithMarker {
files = append(files, file.file)
hasTSConfig = hasTSConfig || isConfigFile(file.file.fileName)
markers = append(markers, file.markers...)
ranges = append(ranges, file.ranges...)
for _, marker := range file.markers {
if marker.Name == nil {
if marker.Data != nil {
// The marker is an anonymous object marker, which does not need a name. Markers are only set into markerPositions if they have a name
continue
}
t.Fatalf(`Marker at position %v is unnamed`, marker.Position)
}
if existing, ok := markerPositions[*marker.Name]; ok {
t.Fatalf(`Duplicate marker name: "%s" at %v and %v`, *marker.Name, marker.Position, existing.Position)
}
markerPositions[*marker.Name] = marker
}
}
if hasTSConfig && len(globalOptions) > 0 {
t.Fatalf("It is not allowed to use global options along with config files.")
}
return TestData{
Files: files,
MarkerPositions: markerPositions,
Markers: markers,
Symlinks: symlinks,
GlobalOptions: globalOptions,
Ranges: ranges,
}
}
func isConfigFile(fileName string) bool {
fileName = strings.ToLower(fileName)
return strings.HasSuffix(fileName, "tsconfig.json") || strings.HasSuffix(fileName, "jsconfig.json")
}
type locationInformation struct {
position int
sourcePosition int
sourceLine int
sourceColumn int
}
type rangeLocationInformation struct {
locationInformation
marker *Marker
}
type TestFileInfo struct {
fileName string
// The contents of the file (with markers, etc stripped out)
Content string
emit bool
}
// FileName implements ls.Script.
func (t *TestFileInfo) FileName() string {
return t.fileName
}
// Text implements ls.Script.
func (t *TestFileInfo) Text() string {
return t.Content
}
var _ ls.Script = (*TestFileInfo)(nil)
const emitThisFileOption = "emitthisfile"
type parserState int
const (
stateNone parserState = iota
stateInSlashStarMarker
stateInObjectMarker
)
func parseFileContent(fileName string, content string, fileOptions map[string]string) (*testFileWithMarkers, error) {
fileName = tspath.GetNormalizedAbsolutePath(fileName, "/")
// The file content (minus metacharacters) so far
var output strings.Builder
var markers []*Marker
/// A stack of the open range markers that are still unclosed
openRanges := []rangeLocationInformation{}
/// A list of closed ranges we've collected so far
rangeMarkers := []*RangeMarker{}
// The total number of metacharacters removed from the file (so far)
difference := 0
// One-based current position data
line := 1
column := 1
// The current marker (or maybe multi-line comment?) we're parsing, possibly
var openMarker *locationInformation
// The latest position of the start of an unflushed plain text area
lastNormalCharPosition := 0
flush := func(lastSafeCharIndex int) {
if lastSafeCharIndex != -1 {
output.WriteString(content[lastNormalCharPosition:lastSafeCharIndex])
} else {
output.WriteString(content[lastNormalCharPosition:])
}
}
state := stateNone
previousCharacter, i := utf8.DecodeRuneInString(content)
var size int
var currentCharacter rune
for ; i < len(content); i = i + size {
currentCharacter, size = utf8.DecodeRuneInString(content[i:])
switch state {
case stateNone:
if previousCharacter == '[' && currentCharacter == '|' {
// found a range start
openRanges = append(openRanges, rangeLocationInformation{
locationInformation: locationInformation{
position: (i - 1) - difference,
sourcePosition: i - 1,
sourceLine: line,
sourceColumn: column,
},
})
// copy all text up to marker position
flush(i - 1)
lastNormalCharPosition = i + 1
difference += 2
} else if previousCharacter == '|' && currentCharacter == ']' {
// found a range end
if len(openRanges) == 0 {
return nil, reportError(fileName, line, column, "Found range end with no matching start.")
}
rangeStart := openRanges[len(openRanges)-1]
openRanges = openRanges[:len(openRanges)-1]
closedRange := &RangeMarker{
fileName: fileName,
Range: core.NewTextRange(rangeStart.position, (i-1)-difference),
Marker: rangeStart.marker,
}
rangeMarkers = append(rangeMarkers, closedRange)
// copy all text up to range marker position
flush(i - 1)
lastNormalCharPosition = i + 1
difference += 2
} else if previousCharacter == '/' && currentCharacter == '*' {
// found a possible marker start
state = stateInSlashStarMarker
openMarker = &locationInformation{
position: (i - 1) - difference,
sourcePosition: i - 1,
sourceLine: line,
sourceColumn: column - 1,
}
} else if previousCharacter == '{' && currentCharacter == '|' {
// found an object marker start
state = stateInObjectMarker
openMarker = &locationInformation{
position: (i - 1) - difference,
sourcePosition: i - 1,
sourceLine: line,
sourceColumn: column,
}
flush(i - 1)
}
case stateInObjectMarker:
// Object markers are only ever terminated by |} and have no content restrictions
if previousCharacter == '|' && currentCharacter == '}' {
objectMarkerData := strings.TrimSpace(content[openMarker.sourcePosition+2 : i-1])
marker, e := getObjectMarker(fileName, openMarker, objectMarkerData)
if e != nil {
return nil, e
}
if len(openRanges) > 0 {
openRanges[len(openRanges)-1].marker = marker
}
markers = append(markers, marker)
// Set the current start to point to the end of the current marker to ignore its text
lastNormalCharPosition = i + 1
difference += i + 1 - openMarker.sourcePosition
// Reset the state
openMarker = nil
state = stateNone
}
case stateInSlashStarMarker:
if previousCharacter == '*' && currentCharacter == '/' {
// Record the marker
// start + 2 to ignore the */, -1 on the end to ignore the * (/ is next)
markerNameText := strings.TrimSpace(content[openMarker.sourcePosition+2 : i-1])
marker := &Marker{
fileName: fileName,
Position: openMarker.position,
Name: &markerNameText,
}
if len(openRanges) > 0 {
openRanges[len(openRanges)-1].marker = marker
}
markers = append(markers, marker)
// Set the current start to point to the end of the current marker to ignore its text
flush(openMarker.sourcePosition)
lastNormalCharPosition = i + 1
difference += i + 1 - openMarker.sourcePosition
// Reset the state
openMarker = nil
state = stateNone
} else if !(stringutil.IsDigit(currentCharacter) ||
stringutil.IsASCIILetter(currentCharacter) ||
currentCharacter == '$' ||
currentCharacter == '_') { // Invalid marker character
if currentCharacter == '*' && i < len(content)-1 && content[i+1] == '/' {
// The marker is about to be closed, ignore the 'invalid' char
} else {
// We've hit a non-valid marker character, so we were actually in a block comment
// Bail out the text we've gathered so far back into the output
flush(i)
lastNormalCharPosition = i
openMarker = nil
state = stateNone
}
}
}
if currentCharacter == '\n' && previousCharacter == '\r' {
// Ignore trailing \n after \r
continue
} else if currentCharacter == '\n' || currentCharacter == '\r' {
line++
column = 1
continue
}
column++
previousCharacter = currentCharacter
}
// Add the remaining text
flush(-1)
if len(openRanges) > 0 {
openRange := openRanges[0]
return nil, reportError(fileName, openRange.sourceLine, openRange.sourceColumn, "Unterminated range.")
}
if openMarker != nil {
return nil, reportError(fileName, openMarker.sourceLine, openMarker.sourceColumn, "Unterminated marker.")
}
outputString := output.String()
// Set LS positions for markers
lineMap := ls.ComputeLSPLineStarts(outputString)
converters := ls.NewConverters(lsproto.PositionEncodingKindUTF8, func(_ string) *ls.LSPLineMap {
return lineMap
})
emit := fileOptions[emitThisFileOption] == "true"
testFileInfo := &TestFileInfo{
fileName: fileName,
Content: outputString,
emit: emit,
}
slices.SortStableFunc(rangeMarkers, func(a, b *RangeMarker) int {
if a.Range.Pos() != b.Range.Pos() {
return a.Range.Pos() - b.Range.Pos()
}
return b.Range.End() - a.Range.End()
})
for _, marker := range markers {
marker.LSPosition = converters.PositionToLineAndCharacter(testFileInfo, core.TextPos(marker.Position))
}
for _, rangeMarker := range rangeMarkers {
rangeMarker.LSRange = lsproto.Range{
Start: converters.PositionToLineAndCharacter(testFileInfo, core.TextPos(rangeMarker.Range.Pos())),
End: converters.PositionToLineAndCharacter(testFileInfo, core.TextPos(rangeMarker.Range.End())),
}
}
return &testFileWithMarkers{
file: testFileInfo,
markers: markers,
ranges: rangeMarkers,
}, nil
}
func getObjectMarker(fileName string, location *locationInformation, text string) (*Marker, error) {
// Attempt to parse the marker value as JSON
var v interface{}
e := json.Unmarshal([]byte("{ "+text+" }"), &v)
if e != nil {
return nil, reportError(fileName, location.sourceLine, location.sourceColumn, "Unable to parse marker text "+text)
}
markerValue, ok := v.(map[string]interface{})
if !ok || len(markerValue) == 0 {
return nil, reportError(fileName, location.sourceLine, location.sourceColumn, "Object markers can not be empty")
}
marker := &Marker{
fileName: fileName,
Position: location.position,
Data: markerValue,
}
// Object markers can be anonymous
if markerValue["name"] != nil {
if name, ok := markerValue["name"].(string); ok && name != "" {
marker.Name = &name
}
}
return marker, nil
}
func reportError(fileName string, line int, col int, message string) error {
return &fourslashError{fmt.Sprintf("%v (%v,%v): %v", fileName, line, col, message)}
}
type fourslashError struct {
err string
}
func (e *fourslashError) Error() string {
return e.err
}

View File

@ -1,143 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/core"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAutoImportCompletion1(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: a.ts
export const someVar = 10;
// @Filename: b.ts
export const anotherVar = 10;
// @Filename: c.ts
import {someVar} from "./a.ts";
someVar;
a/**/
`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
UserPreferences: &ls.UserPreferences{
IncludeCompletionsForModuleExports: core.TSTrue,
IncludeCompletionsForImportStatements: core.TSTrue,
},
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{"someVar", "anotherVar"},
},
})
f.BaselineAutoImportsCompletions(t, []string{""})
}
func TestAutoImportCompletion2(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: a.ts
export const someVar = 10;
export const anotherVar = 10;
// @Filename: c.ts
import {someVar} from "./a.ts";
someVar;
a/**/
`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
UserPreferences: &ls.UserPreferences{
IncludeCompletionsForModuleExports: core.TSTrue,
IncludeCompletionsForImportStatements: core.TSTrue,
},
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{"someVar", "anotherVar"},
},
})
f.BaselineAutoImportsCompletions(t, []string{""})
}
func TestAutoImportCompletion3(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: a.ts
export const aa = "asdf";
export const someVar = 10;
export const bb = 10;
// @Filename: c.ts
import { aa, someVar } from "./a.ts";
someVar;
b/**/
`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
UserPreferences: &ls.UserPreferences{
IncludeCompletionsForModuleExports: core.TSTrue,
IncludeCompletionsForImportStatements: core.TSTrue,
},
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{"bb"},
},
})
f.BaselineAutoImportsCompletions(t, []string{""})
}
func TestNodeModulesImportCompletions1Baseline(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @allowJs: true
// @module: node18
// @Filename: /src/module.mts
export {}
// @Filename: /src/module.cts
export {}
// @Filename: /src/module.js
export {}
// @Filename: /src/decl.d.mts
export {}
// @Filename: /src/decl.d.cts
export {}
// @Filename: /src/decl.d.ts
export {}
// @Filename: /src/js.mjs
export {}
// @Filename: /src/js.cjs
export {}
// @Filename: /src/js.js
export {}
// @Filename: /main.mts
import {} from "./src//*1*/"; //note, this test should not work until packagejsonautoimportprovider is implemented
import mod = require("./src//*2*/");
const m = import("./src//*3*/");
// @Filename: /main.cts
import {} from "./src//*4*/";
import mod = require("./src//*5*/");
const m = import("./src//*6*/");
// @Filename: /main.ts
import {} from "./src//*7*/";
import mod = require("./src//*8*/");
const m = import("./src//*9*/");`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.BaselineAutoImportsCompletions(t, []string{"1", "3", "6", "9", "2", "4", "5", "7", "8"})
}

View File

@ -1,42 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestBasicBackspace(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `export {};
interface Point {
x: number;
y: number;/*b*/
}
declare const p: Point;
p./*a*/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "a", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{"y"},
},
})
f.GoToMarker(t, "b")
f.Backspace(t, 10) // `y: number;`
f.VerifyCompletions(t, "a", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Excludes: []string{"y"},
},
})
}

View File

@ -1,27 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestBasicClassElementKeywords(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `class C {
/*a*/
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "a", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
},
Items: &fourslash.CompletionsExpectedItems{
Exact: CompletionClassElementKeywords,
},
})
}

View File

@ -1,43 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestBasicEdit(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `export {};
interface Point {
x: number;
y: number;
}
declare const p: Point;
p/*a*/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.GoToMarker(t, "a")
f.Insert(t, ".")
f.GoToEOF(t)
f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "x",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextLocationPriority)),
},
"y",
},
},
})
}

View File

@ -1,25 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestBasicGlobalCompletions(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `/*1*/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: CompletionGlobals,
},
})
}

View File

@ -1,40 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestBasicInterfaceMembers(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `export {};
interface Point {
x: number;
y: number;
}
declare const p: Point;
p./*a*/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "a", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "x",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextLocationPriority)),
},
"y",
},
},
})
}

View File

@ -1,123 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestBasicJSDocCompletions(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `
// @filename: file.js
// @allowJs: true
/**
* @/*1*/
*/
function foo(x) {
return x + 1;
}
/**
* /*2*/
*/
function bar(x, { y }) {
return x + y;
}
/**
* @param {number} x
* /*3*/
*/
function baz(x, { y }) {
return x + y;
}
/**
* @param {number} x
* @param {object} param1
* @param {n/*4*/} param1.y
*/
function baz(x, { y }) {
return x + y;
}
/**
* @/*5*/
*/
function baz(x = 0) {
return x * 2;
}
`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "link",
Kind: PtrTo(lsproto.CompletionItemKindKeyword),
Detail: PtrTo("link"),
},
"param",
"returns",
"param {*} x ",
},
},
})
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"@param",
"@param {*} x ",
},
},
})
f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"@param",
"@param {object} param1 \n* @param {*} param1.y ",
},
},
})
f.VerifyCompletions(t, "4", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"number",
},
},
})
f.VerifyCompletions(t, "5", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"param {number} [x=0] ",
},
},
})
}

View File

@ -1,38 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestBasicMultifileCompletions(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: /a.ts
export const foo = { bar: 'baz' };
// @Filename: /b.ts
import { foo } from './a';
const test = foo./*1*/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "bar",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextLocationPriority)),
},
},
},
})
}

View File

@ -1,32 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestBasicQuickInfo(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `
/**
* Some var
*/
var someVar/*1*/ = 123;
/**
* Other var
* See {@link someVar}
*/
var otherVar/*2*/ = someVar;
class Foo/*3*/ {
#bar: string;
}
`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyQuickInfoAt(t, "1", "var someVar: number", "Some var")
f.VerifyQuickInfoAt(t, "2", "var otherVar: number", "Other var\nSee `someVar`")
}

View File

@ -1,42 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestBasicReplaceLine(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `export {};
interface Point {
x: number;
y: number;
}
declare const p: Point;
p./*a*/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "a", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{"y"},
},
})
f.ReplaceLine(t, 3, " z: number;") // `y: number;`
f.VerifyCompletions(t, "a", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Excludes: []string{"y"},
Includes: []fourslash.CompletionsExpectedItem{"z"},
},
})
}

View File

@ -1,50 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestChineseCharacterDisplayInHover(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `
interface 中文界面 {
上居中: string;
下居中: string;
}
class 中文类 {
获取中文属性(): 中文界面 {
return {
上居中: "上居中",
下居中: "下居中"
};
}
}
let /*instanceHover*/实例 = new 中文类();
let 属性对象 = 实例./*methodHover*/获取中文属性();`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyQuickInfoAt(t, "instanceHover", "let 实例: 中文类", "")
f.VerifyQuickInfoAt(t, "methodHover", "(method) 中文类.获取中文属性(): 中文界面", "")
}
func TestChineseCharacterDisplayInUnionTypes(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `
// Test the original issue: Chinese characters in method parameters should display correctly
class TSLine {
setLengthTextPositionPreset(/*methodParam*/preset: "上居中" | "下居中" | "右居中" | "左居中"): void {}
}
let lines = new TSLine();
lines./*method*/setLengthTextPositionPreset;`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
// Verify that the method displays Chinese characters correctly in hover (this was the original problem)
f.VerifyQuickInfoAt(t, "method", `(method) TSLine.setLengthTextPositionPreset(preset: "上居中" | "下居中" | "右居中" | "左居中"): void`, "")
}

View File

@ -1,31 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionAfterCallExpression(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `let x = someCall() /**/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"satisfies",
"as",
},
},
})
}

View File

@ -1,42 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionDetailSignature(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `
/*a*/
function foo(x: string): string;
function foo(x: number): number;
function foo(x: any): any {
return x;
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "a", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "foo",
Kind: PtrTo(lsproto.CompletionItemKindFunction),
SortText: PtrTo(string(ls.SortTextLocationPriority)),
Detail: PtrTo("function foo(x: string): string\nfunction foo(x: number): number"),
},
},
},
})
}

View File

@ -1,235 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionFilterText1(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `
class Foo1 {
#bar: number;
constructor(bar: number) {
this.[|b|]/*1*/
}
}
class Foo5 {
#bar: number;
constructor(bar: number) {
this./*5*/
}
}
class Foo2 {
#bar: number;
constructor(bar: number) {
this.[|#b|]/*2*/
}
}
class Foo6 {
#bar: number;
constructor(bar: number) {
this.[|#|]/*6*/
}
}
class Foo3 {
#bar: number;
constructor(bar: number) {
[|b|]/*3*/
}
}
class Foo7 {
#bar: number;
constructor(bar: number) {
/*7*/
}
}
class Foo4 {
#bar: number;
constructor(bar: number) {
[|#b|]/*4*/
}
}
class Foo8 {
#bar: number;
constructor(bar: number) {
[|#|]/*8*/
}
}
`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: &fourslash.EditRange{
Insert: f.Ranges()[0],
Replace: f.Ranges()[0],
},
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "#bar",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextLocationPriority)),
FilterText: PtrTo("bar"),
},
},
},
})
f.VerifyCompletions(t, "5", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "#bar",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextLocationPriority)),
FilterText: PtrTo("bar"),
},
},
},
})
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: &fourslash.EditRange{
Insert: f.Ranges()[1],
Replace: f.Ranges()[1],
},
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "#bar",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextLocationPriority)),
},
},
},
})
f.VerifyCompletions(t, "6", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: &fourslash.EditRange{
Insert: f.Ranges()[2],
Replace: f.Ranges()[2],
},
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "#bar",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextLocationPriority)),
},
},
},
})
f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "#bar",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextSuggestedClassMembers)),
FilterText: PtrTo("bar"),
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
InsertReplaceEdit: &lsproto.InsertReplaceEdit{
NewText: "this.#bar",
Insert: f.Ranges()[3].LSRange,
Replace: f.Ranges()[3].LSRange,
},
},
},
},
},
})
f.VerifyCompletions(t, "7", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "#bar",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextSuggestedClassMembers)),
FilterText: PtrTo("bar"),
InsertText: PtrTo("this.#bar"),
},
},
},
})
f.VerifyCompletions(t, "4", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "#bar",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextSuggestedClassMembers)),
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
InsertReplaceEdit: &lsproto.InsertReplaceEdit{
NewText: "this.#bar",
Insert: f.Ranges()[4].LSRange,
Replace: f.Ranges()[4].LSRange,
},
},
},
},
},
})
f.VerifyCompletions(t, "8", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "#bar",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextSuggestedClassMembers)),
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
InsertReplaceEdit: &lsproto.InsertReplaceEdit{
NewText: "this.#bar",
Insert: f.Ranges()[5].LSRange,
Replace: f.Ranges()[5].LSRange,
},
},
},
},
},
})
}

View File

@ -1,64 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionFilterText2(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @strict: true
declare const foo1: { bar: string } | undefined;
if (true) {
foo1[|.|]/*1*/
}
else {
foo1?./*2*/
}
`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "bar",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextLocationPriority)),
InsertText: PtrTo("?.bar"),
FilterText: PtrTo(".bar"),
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "?.bar",
Range: f.Ranges()[0].LSRange,
},
},
},
},
},
})
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "bar",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextLocationPriority)),
},
},
},
})
}

View File

@ -1,152 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionFilterText3(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @strict: true
declare const foo1: { b: number; "a bc": string; };
if (true) {
foo1[|.|]/*1*/
}
else {
foo1[|.a|]/*2*/
}
declare const foo2: { b: number; "a bc": string; } | undefined;
if (true) {
foo2[|.|]/*3*/
} else if (false) {
foo2[|.a|]/*4*/
} else {
foo2[|?.|]/*5*/
}
`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "a bc",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextLocationPriority)),
InsertText: PtrTo("[\"a bc\"]"),
FilterText: PtrTo(".a bc"),
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "[\"a bc\"]",
Range: f.Ranges()[0].LSRange,
},
},
},
},
},
})
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "a bc",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextLocationPriority)),
InsertText: PtrTo("[\"a bc\"]"),
FilterText: PtrTo(".a bc"),
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "[\"a bc\"]",
Range: f.Ranges()[1].LSRange,
},
},
},
},
},
})
f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "a bc",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextLocationPriority)),
InsertText: PtrTo("?.[\"a bc\"]"),
FilterText: PtrTo(".a bc"),
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "?.[\"a bc\"]",
Range: f.Ranges()[2].LSRange,
},
},
},
},
},
})
f.VerifyCompletions(t, "4", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "a bc",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextLocationPriority)),
InsertText: PtrTo("?.[\"a bc\"]"),
FilterText: PtrTo(".a bc"),
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "?.[\"a bc\"]",
Range: f.Ranges()[3].LSRange,
},
},
},
},
},
})
f.VerifyCompletions(t, "5", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "a bc",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextLocationPriority)),
InsertText: PtrTo("?.[\"a bc\"]"),
FilterText: PtrTo("?.a bc"),
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "?.[\"a bc\"]",
Range: f.Ranges()[4].LSRange,
},
},
},
},
},
})
}

View File

@ -1,43 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionFilterText4(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `declare const x: [number, number];
x[|.|]/**/;
`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "0",
Kind: PtrTo(lsproto.CompletionItemKindField),
SortText: PtrTo(string(ls.SortTextLocationPriority)),
InsertText: PtrTo("[0]"),
FilterText: PtrTo(".0"),
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "[0]",
Range: f.Ranges()[0].LSRange,
},
},
},
},
},
})
}

View File

@ -1,26 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionListDefaultTypeArgumentPositionTypeOnly(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `const foo = "foo";
function test1<T = /*1*/>() {}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: CompletionGlobalTypes,
},
})
}

View File

@ -1,78 +0,0 @@
package fourslash_test
import (
"strings"
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionListInUnclosedTypeArguments(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `let x = 10;
type Type = void;
declare function f<T>(): void;
declare function f2<T, U>(): void;
f</*1a*/T/*2a*/y/*3a*/
f</*1b*/T/*2b*/y/*3b*/;
f</*1c*/T/*2c*/y/*3c*/>
f</*1d*/T/*2d*/y/*3d*/>
f</*1e*/T/*2e*/y/*3e*/>();
f2</*1k*/T/*2k*/y/*3k*/,
f2</*1l*/T/*2l*/y/*3l*/,{| "newId": true |}T{| "newId": true |}y{| "newId": true |}
f2</*1m*/T/*2m*/y/*3m*/,{| "newId": true |}T{| "newId": true |}y{| "newId": true |};
f2</*1n*/T/*2n*/y/*3n*/,{| "newId": false |}T{| "newId": false |}y{| "newId": false |}>
f2</*1o*/T/*2o*/y/*3o*/,{| "newId": false |}T{| "newId": false |}y{| "newId": false |}>
f2</*1p*/T/*2p*/y/*3p*/,{| "newId": true, "typeOnly": true |}T{| "newId": true, "typeOnly": true |}y{| "newId": true, "typeOnly": true |}>();
f2<typeof /*1uValueOnly*/x, {| "newId": true |}T{| "newId": true |}y{| "newId": true |}
f2</*1x*/T/*2x*/y/*3x*/, () =>/*4x*/T/*5x*/y/*6x*/
f2<() =>/*1y*/T/*2y*/y/*3y*/, () =>/*4y*/T/*5y*/y/*6y*/
f2<any, () =>/*1z*/T/*2z*/y/*3z*/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.GoToEachMarker(t, nil, func(marker *fourslash.Marker, index int) {
markerName := marker.Name
valueOnly := markerName != nil && strings.HasSuffix(*markerName, "ValueOnly")
commitCharacters := &DefaultCommitCharacters
if marker.Data != nil {
newId := marker.Data["newId"]
typeOnly := marker.Data["typeOnly"]
if newId != nil && newId.(bool) && !(typeOnly != nil && typeOnly.(bool)) {
commitCharacters = &[]string{".", ";"}
}
}
var includes []fourslash.CompletionsExpectedItem
var excludes []string
if valueOnly {
includes = []fourslash.CompletionsExpectedItem{
"x",
}
excludes = []string{
"Type",
}
} else {
includes = []fourslash.CompletionsExpectedItem{
"Type",
}
excludes = []string{
"x",
}
}
f.VerifyCompletions(t, marker, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: commitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: includes,
Excludes: excludes,
},
})
})
}

View File

@ -1,36 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionResolveKeyword(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `class C {
/*a*/
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "a", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "abstract",
Kind: PtrTo(lsproto.CompletionItemKindKeyword),
SortText: PtrTo(string(ls.SortTextGlobalsOrKeywords)),
Detail: PtrTo("abstract"),
},
},
},
})
}

View File

@ -1,67 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionsInJsxTag(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @jsx: preserve
// @Filename: /a.tsx
declare namespace JSX {
interface Element {}
interface IntrinsicElements {
div: {
/** Doc */
foo: string
/** Label docs */
"aria-label": string
}
}
}
class Foo {
render() {
<div /*1*/ ></div>;
<div /*2*/ />
}
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, []string{"1", "2"}, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "aria-label",
Kind: PtrTo(lsproto.CompletionItemKindField),
Detail: PtrTo("(property) \"aria-label\": string"),
Documentation: &lsproto.StringOrMarkupContent{
MarkupContent: &lsproto.MarkupContent{
Kind: lsproto.MarkupKindMarkdown,
Value: "Label docs",
},
},
},
&lsproto.CompletionItem{
Label: "foo",
Kind: PtrTo(lsproto.CompletionItemKindField),
Detail: PtrTo("(property) foo: string"),
Documentation: &lsproto.StringOrMarkupContent{
MarkupContent: &lsproto.MarkupContent{
Kind: lsproto.MarkupKindMarkdown,
Value: "Doc",
},
},
},
},
},
})
}

View File

@ -1,32 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionsSelfDeclaring2(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `function f1<T>(x: T) {}
f1({ [|abc|]/*1*/ });`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
EditRange: &fourslash.EditRange{
Insert: f.Ranges()[0],
Replace: f.Ranges()[0],
},
},
Items: &fourslash.CompletionsExpectedItems{
Exact: CompletionGlobalsPlus([]fourslash.CompletionsExpectedItem{
"f1",
}, false /*noLib*/),
},
})
}

View File

@ -1,21 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestDocumentHighlightImportPath(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: /a.ts
export const x = 0;
// @Filename: /b.ts
import { x } from "[|./a|]";`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyBaselineDocumentHighlights(t, nil /*preferences*/, f.Ranges()[0])
}

View File

@ -1,20 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAddDeclareToModule(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `/**/module mAmbient {
module m3 { }
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.GoToMarker(t, "")
f.Insert(t, "declare ")
}

View File

@ -1,21 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAddDuplicateSetter(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `class C {
set foo(value) { }
/**/
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.GoToMarker(t, "")
f.Insert(t, "set foo(value) { }")
}

View File

@ -1,21 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAddFunctionAboveMultiLineLambdaExpression(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `/**/
() =>
// do something
0;`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.GoToMarker(t, "")
f.Insert(t, "function Foo() { }")
}

View File

@ -1,28 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAddInterfaceMemberAboveClass(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `
interface Intersection {
/*insertHere*/
}
interface Scene { }
class /*className*/Sphere {
constructor() {
}
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyQuickInfoAt(t, "className", "class Sphere", "")
f.GoToMarker(t, "insertHere")
f.Insert(t, "ray: Ray;")
f.VerifyQuickInfoAt(t, "className", "class Sphere", "")
}

View File

@ -1,26 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAddInterfaceToNotSatisfyConstraint(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `interface A {
a: number;
}
/**/
interface C<T extends A> {
x: T;
}
var v2: C<B>; // should not work`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.GoToMarker(t, "")
f.Insert(t, "interface B { b: string; }")
}

View File

@ -1,27 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAddMemberToModule(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `module A {
/*var*/
}
module /*check*/A {
var p;
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.GoToMarker(t, "check")
f.VerifyQuickInfoExists(t)
f.GoToMarker(t, "var")
f.Insert(t, "var o;")
f.GoToMarker(t, "check")
f.VerifyQuickInfoExists(t)
}

View File

@ -1,18 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAddSignaturePartial(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = ``
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.Insert(t, "interface Number { toFixed")
f.Insert(t, "(")
}

View File

@ -1,18 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAliasMergingWithNamespace(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `namespace bar { }
import bar = bar/**/;`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyQuickInfoAt(t, "", "namespace bar\nimport bar = bar", "")
}

View File

@ -1,23 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAliasToVarUsedAsType(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `/**/
module A {
export var X;
import Z = A.X;
var v: Z;
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.GoToMarker(t, "")
f.Insert(t, " ")
}

View File

@ -1,22 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAmbientShorthandFindAllRefs(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: declarations.d.ts
declare module "jquery";
// @Filename: user.ts
import {/*1*/x} from "jquery";
// @Filename: user2.ts
import {/*2*/x} from "jquery";`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyBaselineFindAllReferences(t, "1", "2")
}

View File

@ -1,28 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAmbientShorthandGotoDefinition(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: declarations.d.ts
declare module /*module*/"jquery"
// @Filename: user.ts
///<reference path="declarations.d.ts"/>
import [|/*importFoo*/foo|], {bar} from "jquery";
import * as [|/*importBaz*/baz|] from "jquery";
import [|/*importBang*/bang|] = require("jquery");
[|foo/*useFoo*/|]([|bar/*useBar*/|], [|baz/*useBaz*/|], [|bang/*useBang*/|]);`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyQuickInfoAt(t, "useFoo", "(alias) module \"jquery\"\nimport foo", "")
f.VerifyQuickInfoAt(t, "useBar", "(alias) module \"jquery\"\nimport bar", "")
f.VerifyQuickInfoAt(t, "useBaz", "(alias) module \"jquery\"\nimport baz", "")
f.VerifyQuickInfoAt(t, "useBang", "(alias) module \"jquery\"\nimport bang = require(\"jquery\")", "")
f.VerifyBaselineGoToDefinition(t, "useFoo", "importFoo", "useBar", "useBaz", "importBaz", "useBang", "importBang")
}

View File

@ -1,42 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestArgumentsAreAvailableAfterEditsAtEndOfFunction(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `module Test1 {
class Person {
children: string[];
constructor(public name: string, children: string[]) {
/**/
}
}
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.GoToMarker(t, "")
f.Insert(t, "this.children = ch")
f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "children",
Detail: PtrTo("(parameter) children: string[]"),
},
},
},
})
}

View File

@ -1,20 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestArgumentsIndexExpression(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `function f() {
var x = /**/arguments[0];
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.GoToMarker(t, "")
f.VerifyQuickInfoExists(t)
}

View File

@ -1,35 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestArrayCallAndConstructTypings(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `var a/*1*/1 = new Array();
var a/*2*/2 = new Array(1);
var a/*3*/3 = new Array<boolean>();
var a/*4*/4 = new Array<boolean>(1);
var a/*5*/5 = new Array("s");
var a/*6*/6 = Array();
var a/*7*/7 = Array(1);
var a/*8*/8 = Array<boolean>();
var a/*9*/9 = Array<boolean>(1);
var a/*10*/10 = Array("s");`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyQuickInfoAt(t, "1", "var a1: any[]", "")
f.VerifyQuickInfoAt(t, "2", "var a2: any[]", "")
f.VerifyQuickInfoAt(t, "3", "var a3: boolean[]", "")
f.VerifyQuickInfoAt(t, "4", "var a4: boolean[]", "")
f.VerifyQuickInfoAt(t, "5", "var a5: string[]", "")
f.VerifyQuickInfoAt(t, "6", "var a6: any[]", "")
f.VerifyQuickInfoAt(t, "7", "var a7: any[]", "")
f.VerifyQuickInfoAt(t, "8", "var a8: boolean[]", "")
f.VerifyQuickInfoAt(t, "9", "var a9: boolean[]", "")
f.VerifyQuickInfoAt(t, "10", "var a10: string[]", "")
}

View File

@ -1,32 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAsOperatorCompletion2(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `type T = number;
var x;
var y = x as /**/
`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"T",
},
},
})
}

View File

@ -1,31 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAsOperatorCompletion3(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `type T = number;
var x;
var y = x as /**/ // comment`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"T",
},
},
})
}

View File

@ -1,31 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAsOperatorCompletion(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `type T = number;
var x;
var y = x as /**/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"T",
},
},
})
}

View File

@ -1,17 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAssertContextualType(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `<(aa: number) =>void >(function myFn(b/**/b) { });`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyQuickInfoAt(t, "", "(parameter) bb: number", "")
}

View File

@ -1,53 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAugmentedTypesClass1(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `class c5b { public foo() { } }
module c5b { export var y = 2; } // should be ok
c5b./*1*/
var r = new c5b();
r./*2*/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "prototype",
Detail: PtrTo("(property) c5b.prototype: c5b"),
},
},
},
})
f.Insert(t, "y;")
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "foo",
Detail: PtrTo("(method) c5b.foo(): void"),
},
},
},
})
}

View File

@ -1,37 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAugmentedTypesClass3Fourslash(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `class c/*1*/5b { public foo() { } }
namespace c/*2*/5b { export var y = 2; } // should be ok
/*3*/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyQuickInfoAt(t, "1", "class c5b\nnamespace c5b", "")
f.VerifyQuickInfoAt(t, "2", "class c5b\nnamespace c5b", "")
f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "c5b",
Detail: PtrTo("class c5b\nnamespace c5b"),
},
},
},
})
}

View File

@ -1,35 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAugmentedTypesModule1(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `module m1c {
export interface I { foo(): void; }
}
var m1c = 1; // Should be allowed
var x: m1c./*1*/;
var /*2*/r = m1c;`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
"I",
},
},
})
f.VerifyQuickInfoAt(t, "2", "var r: number", "")
}

View File

@ -1,49 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAugmentedTypesModule4(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `module m3d { export var y = 2; }
declare class m3d { foo(): void }
var /*1*/r = new m3d();
r./*2*/
var /*4*/r2 = m3d./*3*/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyQuickInfoAt(t, "1", "var r: m3d", "")
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
"foo",
},
},
})
f.Insert(t, "foo();")
f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"y",
},
},
})
f.Insert(t, "y;")
f.VerifyQuickInfoAt(t, "4", "var r2: number", "")
}

View File

@ -1,49 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAugmentedTypesModule5(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `declare class m3e { foo(): void }
module m3e { export var y = 2; }
var /*1*/r = new m3e();
r./*2*/
var /*4*/r2 = m3e./*3*/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyQuickInfoAt(t, "1", "var r: m3e", "")
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
"foo",
},
},
})
f.Insert(t, "foo();")
f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"y",
},
},
})
f.Insert(t, "y;")
f.VerifyQuickInfoAt(t, "4", "var r2: number", "")
}

View File

@ -1,44 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAutoImportProvider_referencesCrash(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: /home/src/workspaces/project/a/package.json
{}
// @Filename: /home/src/workspaces/project/a/tsconfig.json
{}
// @Filename: /home/src/workspaces/project/a/index.ts
class A {}
// @Filename: /home/src/workspaces/project/a/index.d.ts
declare class A {
}
//# sourceMappingURL=index.d.ts.map
// @Filename: /home/src/workspaces/project/a/index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,CAAC;CAAG"}
// @Filename: /home/src/workspaces/project/b/tsconfig.json
{
"compilerOptions": { "disableSourceOfProjectReferenceRedirect": true },
"references": [{ "path": "../a" }]
}
// @Filename: /home/src/workspaces/project/b/b.ts
/// <reference path="../a/index.d.ts" />
new A/**/();
// @Filename: /home/src/workspaces/project/c/package.json
{ "dependencies": { "a": "*" } }
// @Filename: /home/src/workspaces/project/c/tsconfig.json
{ "references" [{ "path": "../a" }] }
// @Filename: /home/src/workspaces/project/c/index.ts
export {};
// @link: /home/src/workspaces/project/a -> /home/src/workspaces/project/c/node_modules/a`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.GoToFile(t, "/home/src/workspaces/project/c/index.ts")
f.VerifyBaselineFindAllReferences(t, "")
}

View File

@ -1,37 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestAutoImportsWithRootDirsAndRootedPath01(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: /dir/foo.ts
export function foo() {}
// @Filename: /dir/bar.ts
/*$*/
// @Filename: /dir/tsconfig.json
{
"compilerOptions": {
"module": "amd",
"moduleResolution": "classic",
"rootDirs": ["D:/"]
}
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.GoToMarker(t, "$")
f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{},
})
}

View File

@ -1,38 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestBasicClassMembers(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `class n {
constructor (public x: number, public y: number, private z: string) { }
}
var t = new n(0, 1, '');`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.GoToEOF(t)
f.Insert(t, "t.")
f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"x",
"y",
},
Excludes: []string{
"z",
},
},
})
}

View File

@ -1,35 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestBestCommonTypeObjectLiterals1(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `var a = { name: 'bob', age: 18 };
var b = { name: 'jim', age: 20 };
var /*1*/c = [a, b];
var a1 = { name: 'bob', age: 18 };
var b1 = { name: 'jim', age: 20, dob: new Date() };
var /*2*/c1 = [a1, b1];
var a2 = { name: 'bob', age: 18, address: 'springfield' };
var b2 = { name: 'jim', age: 20, dob: new Date() };
var /*3*/c2 = [a2, b2];
interface I {
name: string;
age: number;
}
var i: I;
var /*4*/c3 = [i, a];`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyQuickInfoAt(t, "4", "var c3: I[]", "")
f.VerifyQuickInfoAt(t, "1", "var c: {\n name: string;\n age: number;\n}[]", "")
f.VerifyQuickInfoAt(t, "2", "var c1: {\n name: string;\n age: number;\n}[]", "")
f.VerifyQuickInfoAt(t, "3", "var c2: ({\n name: string;\n age: number;\n address: string;\n} | {\n name: string;\n age: number;\n dob: Date;\n})[]", "")
f.VerifyQuickInfoAt(t, "4", "var c3: I[]", "")
}

View File

@ -1,34 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestBestCommonTypeObjectLiterals(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `var a = { name: 'bob', age: 18 };
var b = { name: 'jim', age: 20 };
var /*1*/c = [a, b];
var a1 = { name: 'bob', age: 18 };
var b1 = { name: 'jim', age: 20, dob: new Date() };
var /*2*/c1 = [a1, b1];
var a2 = { name: 'bob', age: 18, address: 'springfield' };
var b2 = { name: 'jim', age: 20, dob: new Date() };
var /*3*/c2 = [a2, b2];
interface I {
name: string;
age: number;
}
var i: I;
var /*4*/c3 = [i, a];`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyQuickInfoAt(t, "1", "var c: {\n name: string;\n age: number;\n}[]", "")
f.VerifyQuickInfoAt(t, "2", "var c1: {\n name: string;\n age: number;\n}[]", "")
f.VerifyQuickInfoAt(t, "3", "var c2: ({\n name: string;\n age: number;\n address: string;\n} | {\n name: string;\n age: number;\n dob: Date;\n})[]", "")
f.VerifyQuickInfoAt(t, "4", "var c3: I[]", "")
}

View File

@ -1,27 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestClassInterfaceInsert(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `interface Intersection {
dist: number;
}
/*interfaceGoesHere*/
class /*className*/Sphere {
constructor(private center) {
}
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyQuickInfoAt(t, "className", "class Sphere", "")
f.GoToMarker(t, "interfaceGoesHere")
f.Insert(t, "\ninterface Surface {\n reflect: () => number;\n}\n")
f.VerifyQuickInfoAt(t, "className", "class Sphere", "")
}

View File

@ -1,19 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestClosedCommentsInConstructor(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `class Foo {
constructor(/* /**/ */) { }
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", nil)
}

View File

@ -1,42 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCodeCompletionEscaping(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: a.js
// @allowJs: true
___foo; __foo;/**/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "__foo",
Kind: PtrTo(lsproto.CompletionItemKindText),
SortText: PtrTo(string(ls.SortTextJavascriptIdentifiers)),
},
&lsproto.CompletionItem{
Label: "___foo",
Kind: PtrTo(lsproto.CompletionItemKindText),
SortText: PtrTo(string(ls.SortTextJavascriptIdentifiers)),
},
},
},
})
}

View File

@ -1,85 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCommentsEnumsFourslash(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `/** Enum of colors*/
enum /*1*/Colors {
/** Fancy name for 'blue'*/
/*2*/Cornflower,
/** Fancy name for 'pink'*/
/*3*/FancyPink
}
var /*4*/x = /*5*/Colors./*6*/Cornflower;
x = Colors./*7*/FancyPink;`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyQuickInfoAt(t, "1", "enum Colors", "Enum of colors")
f.VerifyQuickInfoAt(t, "2", "(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'")
f.VerifyQuickInfoAt(t, "3", "(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'")
f.VerifyQuickInfoAt(t, "4", "var x: Colors", "")
f.VerifyQuickInfoAt(t, "5", "enum Colors", "Enum of colors")
f.VerifyQuickInfoAt(t, "6", "(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'")
f.VerifyQuickInfoAt(t, "7", "(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'")
f.VerifyCompletions(t, "5", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "Colors",
Detail: PtrTo("enum Colors"),
Documentation: &lsproto.StringOrMarkupContent{
MarkupContent: &lsproto.MarkupContent{
Kind: lsproto.MarkupKindMarkdown,
Value: "Enum of colors",
},
},
},
},
},
})
f.VerifyCompletions(t, []string{"6", "7"}, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "Cornflower",
Detail: PtrTo("(enum member) Colors.Cornflower = 0"),
Documentation: &lsproto.StringOrMarkupContent{
MarkupContent: &lsproto.MarkupContent{
Kind: lsproto.MarkupKindMarkdown,
Value: "Fancy name for 'blue'",
},
},
},
&lsproto.CompletionItem{
Label: "FancyPink",
Detail: PtrTo("(enum member) Colors.FancyPink = 1"),
Documentation: &lsproto.StringOrMarkupContent{
MarkupContent: &lsproto.MarkupContent{
Kind: lsproto.MarkupKindMarkdown,
Value: "Fancy name for 'pink'",
},
},
},
},
},
})
}

View File

@ -1,151 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCommentsLinePreservation(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `/** This is firstLine
* This is second Line
*
* This is fourth Line
*/
var /*a*/a: string;
/**
* This is firstLine
* This is second Line
*
* This is fourth Line
*/
var /*b*/b: string;
/**
* This is firstLine
* This is second Line
*
* This is fourth Line
*
*/
var /*c*/c: string;
/**
* This is firstLine
* This is second Line
* @param param
* @random tag This should be third line
*/
function /*d*/d(param: string) { /*1*/param = "hello"; }
/**
* This is firstLine
* This is second Line
* @param param
*/
function /*e*/e(param: string) { /*2*/param = "hello"; }
/**
* This is firstLine
* This is second Line
* @param param1 first line of param
*
* param information third line
* @random tag This should be third line
*/
function /*f*/f(param1: string) { /*3*/param1 = "hello"; }
/**
* This is firstLine
* This is second Line
* @param param1
*
* param information first line
* @random tag This should be third line
*/
function /*g*/g(param1: string) { /*4*/param1 = "hello"; }
/**
* This is firstLine
* This is second Line
* @param param1
*
* param information first line
*
* param information third line
* @random tag This should be third line
*/
function /*h*/h(param1: string) { /*5*/param1 = "hello"; }
/**
* This is firstLine
* This is second Line
* @param param1
*
* param information first line
*
* param information third line
*
*/
function /*i*/i(param1: string) { /*6*/param1 = "hello"; }
/**
* This is firstLine
* This is second Line
* @param param1
*
* param information first line
*
* param information third line
*/
function /*j*/j(param1: string) { /*7*/param1 = "hello"; }
/**
* This is firstLine
* This is second Line
* @param param1 hello @randomtag
*
* random information first line
*
* random information third line
*/
function /*k*/k(param1: string) { /*8*/param1 = "hello"; }
/**
* This is firstLine
* This is second Line
* @param param1 first Line text
*
* @param param1
*
* blank line that shouldnt be shown when starting this
* second time information about the param again
*/
function /*l*/l(param1: string) { /*9*/param1 = "hello"; }
/**
* This is firstLine
This is second Line
[1]: third * line
@param param1 first Line text
second line text
*/
function /*m*/m(param1: string) { /*10*/param1 = "hello"; }`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyQuickInfoAt(t, "a", "var a: string", "This is firstLine\nThis is second Line\n\nThis is fourth Line")
f.VerifyQuickInfoAt(t, "b", "var b: string", "This is firstLine\nThis is second Line\n\nThis is fourth Line")
f.VerifyQuickInfoAt(t, "c", "var c: string", "This is firstLine\nThis is second Line\n\nThis is fourth Line")
f.VerifyQuickInfoAt(t, "d", "function d(param: string): void", "This is firstLine\nThis is second Line")
f.VerifyQuickInfoAt(t, "1", "(parameter) param: string", "")
f.VerifyQuickInfoAt(t, "e", "function e(param: string): void", "This is firstLine\nThis is second Line")
f.VerifyQuickInfoAt(t, "2", "(parameter) param: string", "")
f.VerifyQuickInfoAt(t, "f", "function f(param1: string): void", "This is firstLine\nThis is second Line")
f.VerifyQuickInfoAt(t, "3", "(parameter) param1: string", "first line of param\n\nparam information third line")
f.VerifyQuickInfoAt(t, "g", "function g(param1: string): void", "This is firstLine\nThis is second Line")
f.VerifyQuickInfoAt(t, "4", "(parameter) param1: string", " param information first line")
f.VerifyQuickInfoAt(t, "h", "function h(param1: string): void", "This is firstLine\nThis is second Line")
f.VerifyQuickInfoAt(t, "5", "(parameter) param1: string", " param information first line\n\n param information third line")
f.VerifyQuickInfoAt(t, "i", "function i(param1: string): void", "This is firstLine\nThis is second Line")
f.VerifyQuickInfoAt(t, "6", "(parameter) param1: string", " param information first line\n\n param information third line")
f.VerifyQuickInfoAt(t, "j", "function j(param1: string): void", "This is firstLine\nThis is second Line")
f.VerifyQuickInfoAt(t, "7", "(parameter) param1: string", " param information first line\n\n param information third line")
f.VerifyQuickInfoAt(t, "k", "function k(param1: string): void", "This is firstLine\nThis is second Line")
f.VerifyQuickInfoAt(t, "8", "(parameter) param1: string", "hello")
f.VerifyQuickInfoAt(t, "l", "function l(param1: string): void", "This is firstLine\nThis is second Line")
f.VerifyQuickInfoAt(t, "9", "(parameter) param1: string", "first Line text\nblank line that shouldnt be shown when starting this \nsecond time information about the param again")
f.VerifyQuickInfoAt(t, "m", "function m(param1: string): void", "This is firstLine\nThis is second Line\n[1]: third * line")
f.VerifyQuickInfoAt(t, "10", "(parameter) param1: string", "first Line text\nsecond line text")
}

View File

@ -1,18 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCommentsUnion(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `var a: Array<string> | Array<number>;
a./*1*/length`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyQuickInfoAt(t, "1", "(property) Array<T>.length: number", "Gets or sets the length of the array. This is a number one higher than the highest index in the array.")
}

View File

@ -1,27 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionAfterAtChar(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `@a/**/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: CompletionGlobals,
},
})
}

View File

@ -1,27 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionAfterBackslashFollowingString(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `Harness.newLine = ""\n/**/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: CompletionGlobals,
},
})
}

View File

@ -1,29 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionAfterBrace(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `
}/**/
`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: CompletionGlobals,
},
})
}

View File

@ -1,27 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionAfterDotDotDot(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `.../**/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: CompletionGlobals,
},
})
}

View File

@ -1,35 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionAfterNewline2(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `let foo = 5 as const /*1*/
/*2*/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", nil)
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: CompletionGlobalsPlus(
[]fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "foo",
},
}, false),
},
})
}

View File

@ -1,36 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionAfterNewline(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `let foo /*1*/
/*2*/
/*3*/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", nil)
f.VerifyCompletions(t, []string{"2", "3"}, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: CompletionGlobalsPlus(
[]fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "foo",
},
}, false),
},
})
}

View File

@ -1,91 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionAfterQuestionDot(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @strict: true
class User {
#foo: User;
bar: User;
address?: {
city: string;
"postal code": string;
};
constructor() {
this.address[|?./*1*/|];
this[|?./*2*/|];
this?.bar[|?./*3*/|];
}
};`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "city",
Detail: PtrTo("(property) city: string"),
},
&lsproto.CompletionItem{
Label: "postal code",
InsertText: PtrTo("?.[\"postal code\"]"),
Detail: PtrTo("(property) \"postal code\": string"),
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "postal code",
Range: f.Ranges()[0].LSRange,
},
},
},
},
},
})
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "address",
},
&lsproto.CompletionItem{
Label: "bar",
},
},
},
})
f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "address",
},
&lsproto.CompletionItem{
Label: "bar",
},
},
},
})
}

View File

@ -1,40 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionAmbientPropertyDeclaration(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `class C {
/*1*/ declare property: number;
/*2*/
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: CompletionClassElementKeywords,
},
})
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: CompletionClassElementKeywords,
},
})
}

View File

@ -1,37 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionAsKeyword(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `const x = this /*1*/
function foo() {
const x = this /*2*/
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, []string{"1", "2"}, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "as",
SortText: PtrTo(string(ls.SortTextGlobalsOrKeywords)),
},
},
},
})
}

View File

@ -1,27 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionAtCaseClause(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `case /**/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: CompletionGlobals,
},
})
}

View File

@ -1,27 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionAtDottedNamespace(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `namespace wwer./**/w`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{},
},
})
}

View File

@ -1,59 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionAutoInsertQuestionDot(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @strict: true
interface User {
address?: {
city: string;
"postal code": string;
}
};
declare const user: User;
user.address[|./**/|]`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "city",
InsertText: PtrTo("?.city"),
Detail: PtrTo("(property) city: string"),
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "city",
Range: f.Ranges()[0].LSRange,
},
},
},
&lsproto.CompletionItem{
Label: "postal code",
InsertText: PtrTo("?.[\"postal code\"]"),
Detail: PtrTo("(property) \"postal code\": string"),
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "postal code",
Range: f.Ranges()[0].LSRange,
},
},
},
},
},
})
}

View File

@ -1,45 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionCloneQuestionToken(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: /file2.ts
type TCallback<T = any> = (options: T) => any;
type InKeyOf<E> = { [K in keyof E]?: TCallback<E[K]>; };
export class Bar<A> {
baz(a: InKeyOf<A>): void { }
}
// @Filename: /file1.ts
import { Bar } from './file2';
type TwoKeys = Record<'a' | 'b', { thisFails?: any; }>
class Foo extends Bar<TwoKeys> {
/**/
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "baz",
InsertText: PtrTo("baz(a: { a?: (options: { thisFails?: any; }) => any; b?: (options: { thisFails?: any; }) => any; }): void {\n}"),
FilterText: PtrTo("baz"),
},
},
},
})
}

View File

@ -1,103 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionDetailsOfContextSensitiveParameterNoCrash(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @strict: true
type __ = never;
interface CurriedFunction1<T1, R> {
(): CurriedFunction1<T1, R>;
(t1: T1): R;
}
interface CurriedFunction2<T1, T2, R> {
(): CurriedFunction2<T1, T2, R>;
(t1: T1): CurriedFunction1<T2, R>;
(t1: __, t2: T2): CurriedFunction1<T1, R>;
(t1: T1, t2: T2): R;
}
interface CurriedFunction3<T1, T2, T3, R> {
(): CurriedFunction3<T1, T2, T3, R>;
(t1: T1): CurriedFunction2<T2, T3, R>;
(t1: __, t2: T2): CurriedFunction2<T1, T3, R>;
(t1: T1, t2: T2): CurriedFunction1<T3, R>;
(t1: __, t2: __, t3: T3): CurriedFunction2<T1, T2, R>;
(t1: T1, t2: __, t3: T3): CurriedFunction1<T2, R>;
(t1: __, t2: T2, t3: T3): CurriedFunction1<T1, R>;
(t1: T1, t2: T2, t3: T3): R;
}
interface CurriedFunction4<T1, T2, T3, T4, R> {
(): CurriedFunction4<T1, T2, T3, T4, R>;
(t1: T1): CurriedFunction3<T2, T3, T4, R>;
(t1: __, t2: T2): CurriedFunction3<T1, T3, T4, R>;
(t1: T1, t2: T2): CurriedFunction2<T3, T4, R>;
(t1: __, t2: __, t3: T3): CurriedFunction3<T1, T2, T4, R>;
(t1: __, t2: __, t3: T3): CurriedFunction2<T2, T4, R>;
(t1: __, t2: T2, t3: T3): CurriedFunction2<T1, T4, R>;
(t1: T1, t2: T2, t3: T3): CurriedFunction1<T4, R>;
(t1: __, t2: __, t3: __, t4: T4): CurriedFunction3<T1, T2, T3, R>;
(t1: T1, t2: __, t3: __, t4: T4): CurriedFunction2<T2, T3, R>;
(t1: __, t2: T2, t3: __, t4: T4): CurriedFunction2<T1, T3, R>;
(t1: __, t2: __, t3: T3, t4: T4): CurriedFunction2<T1, T2, R>;
(t1: T1, t2: T2, t3: __, t4: T4): CurriedFunction1<T3, R>;
(t1: T1, t2: __, t3: T3, t4: T4): CurriedFunction1<T2, R>;
(t1: __, t2: T2, t3: T3, t4: T4): CurriedFunction1<T1, R>;
(t1: T1, t2: T2, t3: T3, t4: T4): R;
}
declare var curry: {
<T1, R>(func: (t1: T1) => R, arity?: number): CurriedFunction1<T1, R>;
<T1, T2, R>(func: (t1: T1, t2: T2) => R, arity?: number): CurriedFunction2<T1, T2, R>;
<T1, T2, T3, R>(func: (t1: T1, t2: T2, t3: T3) => R, arity?: number): CurriedFunction3<T1, T2, T3, R>;
<T1, T2, T3, T4, R>(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arity?: number): CurriedFunction4<T1, T2, T3, T4, R>;
(func: (...args: any[]) => any, arity?: number): (...args: any[]) => any;
placeholder: __;
};
export type StylingFunction = (
keys: (string | false | undefined) | (string | false | undefined)[],
...rest: unknown[]
) => object;
declare const getStylingByKeys: (
mergedStyling: object,
keys: (string | false | undefined) | (string | false | undefined)[],
...args: unknown[]
) => object;
declare var mergedStyling: object;
export const createStyling: CurriedFunction3<
(base16Theme: object) => unknown,
object | undefined,
object | undefined,
StylingFunction
> = curry<
(base16Theme: object) => unknown,
object | undefined,
object | undefined,
StylingFunction
>(
(
getStylingFromBase16: (base16Theme: object) => unknown,
options: object = {},
themeOrStyling: object = {},
...args
): StylingFunction => {
return curry(getStylingByKeys, 2)(mergedStyling, .../**/args);
},
3
);`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyBaselineHover(t)
}

View File

@ -1,45 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionEntryAfterASIExpressionInClass(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `class Parent {
protected shouldWork() {
console.log();
}
}
class Child extends Parent {
// this assumes ASI, but on next line wants to
x = () => 1
shoul/*insideid*/
}
class ChildTwo extends Parent {
// this assumes ASI, but on next line wants to
x = () => 1
/*root*/ //nothing
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, []string{"insideid", "root"}, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"shouldWork",
},
},
})
}

View File

@ -1,45 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionEntryClassMembersWithInferredFunctionReturnType1(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @filename: /tokenizer.ts
export default abstract class Tokenizer {
errorBuilder() {
return (pos: number, lineStart: number, curLine: number) => {};
}
}
// @filename: /expression.ts
import Tokenizer from "./tokenizer.js";
export default abstract class ExpressionParser extends Tokenizer {
/**/
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "errorBuilder",
InsertText: PtrTo("errorBuilder(): (pos: number, lineStart: number, curLine: number) => void {\n}"),
FilterText: PtrTo("errorBuilder"),
},
},
},
})
}

View File

@ -1,33 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionEntryForArgumentConstrainedToString(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `declare function test<P extends "a" | "b">(p: P): void;
test(/*ts*/)
`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, []string{"ts"}, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"\"a\"",
"\"b\"",
},
},
})
}

View File

@ -1,32 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionEntryForArrayElementConstrainedToString2(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `declare function test<T extends 'a' | 'b'>(a: { foo: T[] }): void
test({ foo: ['a', /*ts*/] })`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, []string{"ts"}, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"\"a\"",
"\"b\"",
},
},
})
}

View File

@ -1,32 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionEntryForArrayElementConstrainedToString(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `declare function test<T extends 'a' | 'b'>(a: { foo: T[] }): void
test({ foo: [/*ts*/] })`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, []string{"ts"}, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"\"a\"",
"\"b\"",
},
},
})
}

View File

@ -1,52 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionEntryForClassMembers_StaticWhenBaseTypeIsNotResolved(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: /node_modules/@types/react/index.d.ts
export = React;
export as namespace React;
declare namespace React {
function createElement(): any;
interface Component<P = {}, S = {}, SS = any> { }
class Component<P, S> {
static contextType?: any;
context: any;
constructor(props: Readonly<P>);
setState<K extends keyof S>(
state: ((prevState: Readonly<S>, props: Readonly<P>) => (Pick<S, K> | S | null)) | (Pick<S, K> | S | null),
callback?: () => void
): void;
}
}
// @Filename: /a.ts
import React from 'react'
class Slider extends React.Component {
static defau/**/ltProps = {
onMouseDown: () => { },
onMouseUp: () => { },
unit: 'px',
}
handleChange = () => 10;
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: CompletionClassElementKeywords,
},
})
}

View File

@ -1,71 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionEntryForConst(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `const c = "s";
/*1*/
const d = 1
d/*2*/
const e = 1
/*3*/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, []string{"1"}, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "c",
Detail: PtrTo("const c: \"s\""),
Kind: PtrTo(lsproto.CompletionItemKindVariable),
},
},
},
})
f.VerifyCompletions(t, []string{"2"}, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "d",
Detail: PtrTo("const d: 1"),
Kind: PtrTo(lsproto.CompletionItemKindVariable),
},
},
},
})
f.VerifyCompletions(t, []string{"3"}, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "e",
Detail: PtrTo("const e: 1"),
Kind: PtrTo(lsproto.CompletionItemKindVariable),
},
},
},
})
}

View File

@ -1,37 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionEntryForDeferredMappedTypeMembers(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: test.ts
interface A { a: A }
declare let a: A;
type Deep<T> = { [K in keyof T]: Deep<T[K]> }
declare function foo<T>(deep: Deep<T>): T;
const out = foo(a);
out./*1*/a
out.a./*2*/a
out.a.a./*3*/a`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, f.Markers(), &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
"a",
},
},
})
}

View File

@ -1,32 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionEntryForPropertyConstrainedToString(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `declare function test<P extends "a" | "b">(p: { type: P }): void;
test({ type: /*ts*/ })`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, []string{"ts"}, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
"\"a\"",
"\"b\"",
},
},
})
}

View File

@ -1,42 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionEntryForPropertyFromUnionOfModuleType(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `module E {
export var n = 1;
export var x = 0;
}
module F {
export var n = 1;
export var y = 0;
}
var q: typeof E | typeof F;
var j = q./*1*/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "n",
Detail: PtrTo("(property) n: number"),
},
},
},
})
}

View File

@ -1,33 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionEntryForShorthandPropertyAssignment(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `var person: {name:string; id:number} = {n/**/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "name",
Kind: PtrTo(lsproto.CompletionItemKindField),
},
},
},
})
}

View File

@ -1,88 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionEntryForUnionProperty2(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `interface One {
commonProperty: string;
commonFunction(): number;
anotherProperty: Record<string, number>;
}
interface Two {
commonProperty: number;
commonFunction(): number;
anotherProperty: { foo: number }
}
var x : One | Two;
x.commonProperty./*1*/;
x.anotherProperty./*2*/;`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "toLocaleString",
Detail: PtrTo("(method) toLocaleString(): string (+1 overload)"),
Documentation: &lsproto.StringOrMarkupContent{
MarkupContent: &lsproto.MarkupContent{
Kind: lsproto.MarkupKindMarkdown,
Value: "Returns a date converted to a string using the current locale.",
},
},
},
&lsproto.CompletionItem{
Label: "toString",
Detail: PtrTo("(method) toString(): string (+1 overload)"),
Documentation: &lsproto.StringOrMarkupContent{
MarkupContent: &lsproto.MarkupContent{
Kind: lsproto.MarkupKindMarkdown,
Value: "Returns a string representation of a string.",
},
},
},
&lsproto.CompletionItem{
Label: "valueOf",
Detail: PtrTo("(method) valueOf(): string | number"),
Documentation: &lsproto.StringOrMarkupContent{
MarkupContent: &lsproto.MarkupContent{
Kind: lsproto.MarkupKindMarkdown,
Value: "Returns the primitive value of the specified object.",
},
},
},
},
},
})
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "foo",
},
},
},
})
}

View File

@ -1,49 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionEntryForUnionProperty(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `interface One {
commonProperty: number;
commonFunction(): number;
}
interface Two {
commonProperty: string
commonFunction(): number;
}
var x : One | Two;
x./**/`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "commonFunction",
Detail: PtrTo("(method) commonFunction(): number"),
},
&lsproto.CompletionItem{
Label: "commonProperty",
Detail: PtrTo("(property) commonProperty: string | number"),
},
},
},
})
}

View File

@ -1,71 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionEntryOnNarrowedType(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `function foo(strOrNum: string | number) {
/*1*/
if (typeof strOrNum === "number") {
strOrNum/*2*/;
}
else {
strOrNum/*3*/;
}
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "strOrNum",
Detail: PtrTo("(parameter) strOrNum: string | number"),
},
},
},
})
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "strOrNum",
Detail: PtrTo("(parameter) strOrNum: number"),
},
},
},
})
f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "strOrNum",
Detail: PtrTo("(parameter) strOrNum: string"),
},
},
},
})
}

View File

@ -1,35 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionExportFrom(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `export * /*1*/;
export {} /*2*/;`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, []string{"1", "2"}, &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "from",
SortText: PtrTo(string(ls.SortTextGlobalsOrKeywords)),
},
},
},
})
}

View File

@ -1,50 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/ls"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionForComputedStringProperties(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `const p2 = "p2";
interface A {
["p1"]: string;
[p2]: string;
}
declare const a: A;
a[|./**/|]`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "p1",
},
&lsproto.CompletionItem{
Label: "p2",
InsertText: PtrTo("[p2]"),
SortText: PtrTo(string(ls.SortTextGlobalsOrKeywords)),
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "p2",
Range: f.Ranges()[0].LSRange,
},
},
},
},
},
})
}

View File

@ -1,60 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionForMetaProperty(t *testing.T) {
t.Parallel()
t.Skip()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `import./*1*/;
new./*2*/;
function test() { new./*3*/ }`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "meta",
Detail: PtrTo("(property) ImportMetaExpression.meta: ImportMeta"),
},
},
},
})
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{},
},
})
f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "target",
Detail: PtrTo("(property) NewTargetExpression.target: () => void"),
},
},
},
})
}

View File

@ -1,68 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionForQuotedPropertyInPropertyAssignment1(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `export interface Configfiles {
jspm: string;
'jspm:browser': string;
}
let files: Configfiles;
files = {
/*0*/: '',
'[|/*1*/|]': ''
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "0", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
"\"jspm:browser\"",
"jspm",
},
},
})
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "jspm",
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "jspm",
Range: f.Ranges()[0].LSRange,
},
},
},
&lsproto.CompletionItem{
Label: "jspm:browser",
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "jspm:browser",
Range: f.Ranges()[0].LSRange,
},
},
},
},
},
})
}

View File

@ -1,73 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionForQuotedPropertyInPropertyAssignment2(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `export interface Config {
files: ConfigFiles
}
export interface ConfigFiles {
jspm: string;
'jspm:browser': string;
}
let config: Config;
config = {
files: {
/*0*/: '',
'[|/*1*/|]': ''
}
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "0", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
"\"jspm:browser\"",
"jspm",
},
},
})
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "jspm",
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "jspm",
Range: f.Ranges()[0].LSRange,
},
},
},
&lsproto.CompletionItem{
Label: "jspm:browser",
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "jspm:browser",
Range: f.Ranges()[0].LSRange,
},
},
},
},
},
})
}

View File

@ -1,72 +0,0 @@
package fourslash_test
import (
"testing"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash"
. "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionForQuotedPropertyInPropertyAssignment3(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = ` let configFiles1: {
jspm: string;
'jspm:browser': string;
} = {
/*0*/: "",
}
let configFiles2: {
jspm: string;
'jspm:browser': string;
} = {
jspm: "",
'[|/*1*/|]': ""
}`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "0", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
"\"jspm:browser\"",
"jspm",
},
},
})
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "jspm",
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "jspm",
Range: f.Ranges()[0].LSRange,
},
},
},
&lsproto.CompletionItem{
Label: "jspm:browser",
TextEdit: &lsproto.TextEditOrInsertReplaceEdit{
TextEdit: &lsproto.TextEdit{
NewText: "jspm:browser",
Range: f.Ranges()[0].LSRange,
},
},
},
},
},
})
}

Some files were not shown because too many files have changed in this diff Show More