110 Commits

Author SHA1 Message Date
Jake Bailey
9d7e087022
Remove cancellationToken.js (#60250) 2024-11-05 14:35:02 -08:00
Isabel Duan
52eaa7b02f
Enable --isolatedDeclarations on TS codebase (#59635)
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
Co-authored-by: Andrew Branch <andrew@wheream.io>
2024-09-15 18:10:52 -07:00
Jake Bailey
01a874a8ba
Update to eslint v9, typescript-eslint v8 (#59518) 2024-08-12 17:13:24 -07:00
Jake Bailey
ef339af128
Use regular imports instead of require where possible (#59017) 2024-06-25 13:56:05 -07:00
Jake Bailey
e30b5fbafe
Remove typescript-etw (#58832) 2024-06-13 13:04:51 -07:00
Jake Bailey
16beff101a
Use explicit extensions for imports within src (#58421) 2024-05-06 17:07:54 -07:00
Jake Bailey
17e420daf6
Use built-in no-restricted-syntax to ban null instead of plugin, ban null type too (#58095) 2024-04-18 09:06:32 -07:00
Jake Bailey
4cedfe40b0
Update dprint, don't force multiline imports for imports of single name (#58038) 2024-04-02 10:58:16 -07:00
Jake Bailey
3c0a802387
Remove sys.bufferFrom, duplicate Buffer declarations, etc (#57916) 2024-03-25 10:50:10 -07:00
Jake Bailey
dc113f8170
Don't indirect through _namespaces in tsserver/typingsInstaller (#57829) 2024-03-20 16:41:05 -07:00
Jake Bailey
aeddd65ab8
Make tsserver and typingsInstaller thin wrappers around public API (#55326) 2024-03-15 13:25:26 -07:00
Sheetal Nandi
e170bc59d4
Pull out parts of TI Adapter so we can test that more correctly instead of having to copy things (#56387) 2023-11-14 10:33:54 -08:00
Sheetal Nandi
934216f968
Support using client watch in tsserver using events (#54662) 2023-09-22 14:25:40 -07:00
Jake Bailey
0f91f7dff6
Run dprint on json (#55602) 2023-09-01 15:26:01 -07:00
Jake Bailey
5e8c261b6a
dprint the codebase (#54820) 2023-08-16 14:26:38 -07:00
Sheetal Nandi
a956bbc831
Instead of watching files in typing installer, forward it to projectService (#54028) 2023-04-26 13:31:36 -07:00
Sheetal Nandi
30fb9fa57e
Refactor plugin related code (#53942) 2023-04-20 16:49:47 -07:00
Jake Bailey
a727ca1571
Make perfLogger potentially undefined rather than using a noop logger (#53229) 2023-03-15 15:58:26 -07:00
Jake Bailey
ddcbd9ffbd
Remove old references to Node v4, small cleanup of node version stuff (#53174) 2023-03-09 14:32:15 -08:00
Jake Bailey
2a8436c529
Use eslint-plugin-simple-import-sort (#52090) 2023-02-02 14:36:21 -08:00
Sheetal Nandi
e5515164eb
Remove older deprecated APIs (#52338) 2023-01-20 12:55:04 -08:00
Jake Bailey
ddac387c3e
Deprecate CommandNames in favor of protocol.CommandTypes, direct import for better bundler output (#52208) 2023-01-19 16:31:50 -08:00
Jake Bailey
18794c7945
Enable noImplicitOverride (#52290) 2023-01-18 12:00:10 -08:00
Jake Bailey
f1ff0de943
Use native generators/iterables, remove helper cruft (#51921) 2023-01-06 14:40:56 -08:00
Nathan Shively-Sanders
5bb204e321
Remove webServer (#51699)
* Remove webServer

First draft; I may move some things around to be more readable.

* Refactor moved code

1. Move StartSessionOptions to common next to where it's first used.
2. Inline single-use BaseLogger base class into its only child class,
Logger.
3. Start using direct imports, eg `import {} from './common'`. I hope
this is OK?!

* Fix lint

* move imports back to namespace import

* hereby tsserver: remove exportIsTsObject
2022-12-06 08:41:01 -08:00
Jake Bailey
00dc0b6674
Flip imports to case insensitive sorting (#51579) 2022-11-17 15:35:28 -08:00
Jake Bailey
2d2a4343b8
Reformat imports to be one identifier per line (#51565) 2022-11-17 13:42:18 -08:00
Jake Bailey
9f64a3a58c
Remove ts.{Map,Set,ESMap,Iterator} and associated types (#51439) 2022-11-09 15:06:31 -08:00
Jake Bailey
c5a9573787 Ensure ts object passed to plugins contains deprecatedCompat declarations
We pass the entire "ts" object into plugins. However, we need to make
sure that that object contains the debug compat helpers.

In the old codebase, the deprecated compat code would tack things onto
the actual ts object, after the server code was executed, and later that
same object would be given to plugins.

But in modules, each TS project only sees the view of the "ts" namespace
that their references implied, not the ts object as some sort of
singleton. To ensure that plugins get the debug compat code, we have to
bring that into each project's view of the ts namespace, and not add it
on later in the executable projects.
2022-11-07 13:36:08 -08:00
Jake Bailey
8486229625 Export ts namespace from tsserver for hacky-post patching
Unlike our other exectuables, tsserver is used in web, which means that
there actually would have been a "ts" variable declared for those users
(e.g. in a web worker). It looks like VS Code needs this variable to be
declared, so change this bundle to look the same as other libraries.

Note that in Node, the IIFE will never actually return, so this can have
no effect. On web, it will return in order to yield control back to the
event loop (as on web, postMessage is used to communicate).
2022-11-07 13:35:48 -08:00
Jake Bailey
4139807e75 Add build via esbuild
This configures the existing build tasks to use esbuild by default. If
using the plain files is desired, passing `--bundle=false` will build
using plain files and still produce a runnable system.

This is only a basic build; a more efficient build is provided later
when gulp is replaced by hereby.
2022-11-07 13:34:44 -08:00
Jake Bailey
36e29448e9 Get codebase building pre bundling
This isn't totally complete, but enough to get everything building and
tests running manually. The next commit will make the build work fully.
2022-11-07 13:34:44 -08:00
Jake Bailey
8bd5e54af3 Undo changes needed to load codebase into ts-morph 2022-11-07 13:33:08 -08:00
Jake Bailey
07758c08ab Generated module conversion step - inlineImports
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".
2022-11-07 13:33:07 -08:00
Jake Bailey
b6c0538826 Generated module conversion step - stripNamespaces
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.
2022-11-07 13:32:03 -08:00
Jake Bailey
9a0b85ce2a Generated module conversion step - explicitify
This step makes all implicit namespace accesses explicit, e.g. "Node" turns into "ts.Node".
2022-11-07 13:29:05 -08:00
Jake Bailey
94724a8c2e Generated module conversion step - unindent
This step makes further commits look clearer by unindenting all of the top level namespaces preemptively.
2022-11-07 13:28:13 -08:00
Jake Bailey
df89c7457d Make a few changes to allow all code to be loaded as one project 2022-11-07 13:27:19 -08:00
Rafał Chłodnicki
9c87ded2b3
fix(51100): ensure tsserver shuts down when parent process is killed (#51107)
* fix(51100): ensure tsserver shuts down when parent process is killed

When using IPC channel (`--useNodeIpc`) for communicating with tsserver,
the child tsserver process did not shut down on parent process disconnecting
(for example due to it being killed).

Call exit() on IPC disconnect, same as stdio-based communication did
when pipe to parent process was destroyed.

* don't duplicate inherited method
2022-10-10 12:03:15 -07:00
Sheetal Nandi
fd05c0cc6d
Make useFsEvents as default strategy for the watching (#50366)
* Remove unnecessary parameter

* Dont store name unnecessarily in the watchers

* Polled watches and not files

* Use fs events as default watching

* Some refactoring

* Make single per directory native watchers now that we are using it as default

* Rename

* Comment
2022-09-06 13:14:50 -07:00
Andrew Casey
020ef41543
Add a simple queue implementation with better performance than Array.shift (#49623)
* Add a simple queue implementation with better performance than `Array.shift`

This lets us clean up the hack introduced in #49581

* Correct typo

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
2022-06-24 10:07:28 -07:00
Matt Bierner
3fc5f968ca
Enable TS Server plugins on web (#47377)
* Prototype TS plugins on web

This prototype allows service plugins to be loaded on web TSServer

Main changes:

- Adds a new host entryPoint called `importServicePlugin` for overriding how plugins can be loaded. This may be async
- Implement `importServicePlugin` for webServer
- The web server plugin implementation looks for a `browser` field in the plugin's `package.json`
- It then uses `import(...)` to load the plugin (the plugin source must be compiled to support being loaded as a module)

* use default export from plugins

This more or less matches how node plugins expect the plugin module to be an init function

* Allow configure plugin requests against any web servers in partial semantic mode

* Addressing some comments

- Use result value instead of try/catch (`ImportPluginResult`)
- Add awaits
- Add logging

* add tsserverWeb to patch in dynamic import

* Remove eval

We should throw instead when dynamic import is not implemented

* Ensure dynamically imported plugins are loaded in the correct order

* Add tests for async service plugin timing

* Update src/server/editorServices.ts

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

* Partial PR feedback

* Rename tsserverWeb to dynamicImportCompat

* Additional PR feedback

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-06-14 12:35:53 -07:00
Ron Buckton
1e65b330a7
Merge 'decorators' into 'modifiers' on various nodes (#49089)
* 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
2022-06-09 17:24:02 -07:00
Matt Bierner
55e2e15aa3
Use webworker typings for webServer (#46944)
Updates `webServer.ts` to include the webworker typings. This means we don't have to redeclare the web globals we use in this file
2022-02-17 13:18:20 -08:00
Matt Bierner
69662090a3
Use node ipc for TS Server (#46418)
* Use node ipc for TS Server

For #46417

This lets us use Node's built-in ipc for passing messages to/from the typescript server instead of using stdio

* Remove extra parse

* Add extra logging when using node IPC

* Split out to subclass

* Extract common writeMessage method

* Baseline accept
2022-01-05 16:39:45 -08:00
Eli Barzilay
39ff1568e9 Changes to enable the module conversion script
* shorthand -> long for `factory` since the typeformer script doesn't
  know how to handle it.

* Use setter to change `ts.sys` (similar to #35399).

* Fix `loggedIO` with empty namespaces to indicate dependency
  (similar to 50603eda).

* Move `Map` / `Set` stuff from `core.ts` to `corePublic.ts` since the
  types are there.
2021-10-16 08:12:59 -04:00
Ron Buckton
8590f0db40
Fix decorator emit regression for static fields (#44933) 2021-07-07 16:58:36 -07:00
Ron Buckton
069650f602
Change PerformanceObserver to be compatible with new Node types (#44884) 2021-07-03 21:26:56 -07:00
Oleksandr T
db01e84700
feat(eslint): consistent-type-assertions (#43556) 2021-05-18 06:20:57 -07:00
Andrew Casey
3db6d803d5
Don't build type catalog during server tracing (#43354)
Bonus: this also drops the redundant type catalog from the
non-diagnostics-producing checker.
2021-03-25 15:52:04 -07:00