Commit graph

12 commits

Author SHA1 Message Date
Sheetal Nandi 00cea41b65 Add sortText depending scope of symbols
Fixes #15024
2019-05-20 15:53:51 -07:00
Nathan Shively-Sanders be2db9db12
Add globalThis (#29332)
* Restore original code from bind-toplevel-this

With one or two additional comments

* Working in JS, but the symbol is not right.

Still need to

1. Make it work in Typescript.
2. Add test (and make them work) for the other uses of GlobalThis:
window, globalThis, etc.

* Check in TS also; update some tests

Lots of tests still fail, but all but 1 change so far has been correct.

* Update baselines

A couple of tests still fail and need to be fixed.

* Handle type references to globalThis

The type reference must be `typeof globalThis`. Just `globalThis` will
be treated as a value reference in type position -- an error.

* Restore former behaviour of implicitThis errors

I left the noImplicitThis rule for captured use of global this in an
arrow function, even though technically it isn't `any` any more --
it's typeof globalThis.  However, you should still use some other method
to access globals inside an arrow, because captured-global-this is super
confusing there.

* Test values with type globalThis

I ran into a problem with intersecting `Window & typeof globalThis`:

1. This adds a new index signature to Window, which is probably not
desired. In fact, with noImplicitAny, it's not desired on globalThis
either I think.
2. Adding this type requires editing TSJS-lib-generator, not this repo.

So I added the test cases and will probably update them later, when
those two problems are fixed.

* Add esnext declaration for globalThis

* Switch to symbol-based approach

I decided I didn't like the import-type-based approach.

Update baselines to reflect the difference.

* Do not suggest globals for completions at toplevel

* Add tests of element and property access

* Look up globalThis using normal resolution

globalThis is no longer constructed lazily. Its synthetic Identifier
node is also now more realistic.

* Update fourslash tests

* Add missed fourslash test update

* Remove esnext.globalthis.d.ts too

* Add chained globalThis self-lookup test

* Attempt at making globalThis readonly

In progress, had to interrupt for other work.

* Add/update tests

* Addres PR comments:

1. Add parameter to tryGetThisTypeAt to exclude globalThis.
2. Use combined Module flag instead combining them in-place.
3. SymbolDisplay doesn't print 'module globalThis' for this expressions
anymore.
2019-02-27 14:14:34 -08:00
Andy 437bc41e99
For path completions, include extension as a kindModifier (#28148) 2018-10-30 11:56:34 -07:00
Andy c97fc64972
Always use verify.completions when testing completions (#28137) 2018-10-29 10:03:25 -07:00
Andy d5142a7f45
Don't offer import completions in non-module files unless "--module" is set (#22951)
* Don't offer import completions in non-module files unless "--module" is set

* Even smarter shouldOfferImportCompletions
2018-04-02 10:21:14 -07:00
Andrew Casey 3ca1cc406a Clean up TODOs for #18445 2018-01-17 15:29:41 -08:00
Andrew Casey db3f7c538e Update test baselines 2018-01-17 15:18:54 -08:00
Mohamed Hegazy 65af685b49
Remove periods from refactor/quickfix messages (#20237)
* Fix #19959 and #19958: Remove un-localizable messages

* Update message

* Reorder error messages

* Fix https://github.com/Microsoft/TypeScript/issues/15399: remove periods at the end of messages

* Accept baselines for error code changes

* accept baselines for removed periods

* Update diagnostic messages
2017-12-01 16:38:59 -08:00
Mohamed Hegazy 6b3cfc7008
Fix #19959 and #19958: Remove un-localizable messages (#20019)
* Fix #19959 and #19958: Remove un-localizable messages

* Update message

* Update diagnostic messages
2017-11-24 22:02:48 -08:00
Andy 592ee00906
Have CompletionEntryDetails source use a relative path (#19917)
* Have CompletionEntryDetails source use a relative path

* Use getCanonicalFileName from services Instead of creating a new one
2017-11-14 14:26:49 -08:00
Andy bb7fb7dda9
For getCompletionsAtPosition, require a flag to provide completions with code actions (#19687)
* For getCompletionsAtPosition, require a flag to provide completions with code actions

* Change name

* Increase API version

* Update API baselines

* Add comment

* Update API baseline
2017-11-03 15:55:31 -07:00
Andy 9615e54e13 Support multiple completions with the same name but different source module (#19455)
* Support multiple completions with the same name but different source module

* Use optional parameters for source

* Simplify use of `uniques`

* Update test

* Fix `undefined` error
2017-10-26 08:22:17 -07:00