* fix services' type's isLiteral
* update literal completions tests
* initial prototype
* use symbol to expression. TODO: filter existing, replace import nodes
* WIP
* WIP
* remove booleans from literals
* trigger at case keyword positions
* clean up tests
* fix element access expression case
* refactor dealing with existing values into a tracker
* fix merge errors
* cleanup and more tests
* fix lint errors
* more merge conflict fixes and cleanup
* use appropriate quotes
* small indentation fix
* refactor case clause tracker
* experiment: support tabstops after each case clause
* address small CR comments
* fix completion entry details; add test case
* fix lint errors
* remove space before tab stops; refactor
This adds a "small" d.ts bundler script. This script is very basic,
using Node printing to produce its output. Generally speaking, this is
inadvisable as it completely disregards name shadowing, globals, etc.
However, in our case, we don't care about the globals, and we can opt to
restructure our codebase in order to avoid conflict, which we largely
had to do anyway when we were namespaces and everything was in scope.
If these are regular comments, then they won't appear in our d.ts files.
But, now we are relying on an external d.ts bundler to produce our final
merged, so they need to be present in the "input" d.ts files, meaning
they have to be JSDoc comments.
These comments only work today because all of our builds load their TS
files from scratch, so they see the actual source files and their
non-JSDoc comments.
The comments also need to be attached to a declaration, not floating,
otherwise they won't be used by api-extractor, so move them if needed.
This step converts as many explicit accesses as possible in favor of direct imports from the modules in which things were declared. This restores the code (as much as possible) back to how it looked originally before the explicitify step, e.g. instead of "ts.Node" and "ts.Symbol", we have just "Node" and "Symbol".
This step converts each file into an exported module by hoisting the namespace bodies into the global scope and transferring internal markers down onto declarations as needed.
The namespaces are reconstructed as "barrel"-style modules, which are identical to the old namespace objects in structure. These reconstructed namespaces are then imported in the newly module-ified files, making existing expressions like "ts." valid.
* feat(7481): add explicit type compatibility check with 'satisfies' expression
* Add failing test for lack of intersectioned contextual type
* Implement the behavior
* Add test corresponding to the 'if'
* Add test based on defined scenarios
* remove isExpression in favor of using type casting
* move tests from compiler to conformance folder
* update baseline
* add missing contextFlags argument
* use asserted type
* accept baseline
Co-authored-by: Ryan Cavanaugh <ryanca@microsoft.com>
* Demote priority of JS completions
Fixes#48498
Unchecked JS files gather identifier-based completions. Currently, this search
happens instead of `getCompletionEntriesFromSymbols` for TS/checked JS
files. However, identifier-based completions are much lower quality and
can be ignored by some editors.
Identifier-based completions should be gathered last, after gathering
other completions. That's what this PR does.
* Invert isUncheckedFile to avoid double negative
* dedupe calls to getCompletionEntriesFromSymbols
* Stop re-creating list of entry names
* more deduping + fix lint
* Merge 'decorators' into 'modifiers' on various Nodes
* Drop RESERVED argument in favor of removing parameter
* Ignore grammar error nodes when asserting invariants
* Revert 'illegalX' property renames
* PR Feedback
* Remove Node12, add Node16.
* Accepted baselines.
* Refactor checking for top-level await, give a better error message in CJS files.
* Accepted baselines.
* Stop erroring on JSON module imports in node ESM since they're no longer experimental.
* Accepted baselines.
* More refactoring, do the same checks for for-await loops.
* Accepted baselines.
* Adjust phrasing to permit for-await on CJS error.
* Accepted baselines.
* Accepted baselines.
* Fix lints.
* Add failing test
* Block auto-import module specifiers including node_modules path
* Eagerly resolve module specifiers in completions in nodenext so failures can be filtered
* Add completion info flags for telemetry
* Update API baseline
* Update completions baselines
* Fix missed boolean flip
* Fix remaining tests
* add label details to completion entry
* Use label details for obj literal method completions
* add label details support flag
* add label details support to fourslash
* support both label details and non-label details in object literal method snippets
* CR fixes
* fixes after rebasing
* fix tsserver tests
* skeleton of new feature
* working prototype
* refactor print and format code into its own function
* minor changes; don't support overloads
* have two completion entries
* get rid of accessor support
* add snippet support
* add formatting
* add trailing comma
* add sourcedisplay
* support auto-imports via completion details
* add user preference option and fix ordering of entries
* cleanup
* don't return code actions for no import fixes
* make sortText lower priority for snippets
* get rid of flag
* use optional member sort text
* update baselines
* don't collect method symbols if insert text is not supported
* remove comment
* return undefined if type is not function type
* only slice if needed
* use union reduction; more test cases
* WIP: modify sort text system
* Improve new sort text system
* add signature and union type check
* re-add flag
* fix tests
* rename sort text helper
* fix test and code for union case
* add new flag to protocol type
* fix spaces
* CR: minor fixes
* CR: more fixes
* CR: restructure main flow
* minor fix
* Do symbol name filtering before cache rehydration
* Fix typo
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Update test
* Fix variable clobbered in merge conflict
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Allow moduleSymbolToValidIdentifier to be uppercase for JSX tags
* Cleaner way of getting the uppercase name when needed
* Fix build errors, get rid of basically unnecessary ScriptTarget
* More accurate name for parameter
* Rename other parameter too
* Fix failing test
* Import fix
* Wire up completions, add sorting to fix
* Fix overlapping changes when there’s only one import specifier
* Update API baseline
* Add sorting and filtering back to UMD fix
* Use package.json cache in module specifier generation
* Let AutoImportProviderProject reuse module resolution cache of host project
* Add missing module resolution cache access, add logging to getRootFileNames
* Reuse packageJsonImportFilter
* Only log when the project will be created, update API baseline
* Remove override that could mess up watches