GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — TS Server by mhegazy · Pull Request #2041 · microsoft/TypeScript

Conversation

@mhegazy

@mhegazy Mohamed Hegazy (mhegazy) commented Feb 16, 2015

Copy link
Copy Markdown
Contributor

The basic LanguageService interface puts some requirements on the "host", such as an implementation of a ScriptSnapshot system to support incremental parsing, managing contexts, monitoring files on disk, scheduling diagnostic queries, maintaining line map for line/column for positions for files, etc.. Every editor plugin is required to implement the expected host functionality, possibly in different languages.

This change exposes a new interface to the Services layer (ts server), through a JSON-based communication protocol. Behind the protocol, the server supports all the common host functionality,:

  • A ScriptSnapshot management system with support for diffing script snapshots to allow efficient incremental parsing. A client would send a stream of text changes, and the server will maintain an updated version of the text in memory that can then be used to drive LS requests.
  • A Project management service that allows for figuring project structure a la VS Virtual Projects, allowing the client to ignore resolving references, and maintaining project structure. The project management service also should supports different modes e.g. lose files, ts config, /// references, and imports. The client just informs the server about open files, and the server takes the responsibility of figuring out what files are interesting to this context. the client then asks for operations like completions, quick info, etc.. directly on the file.
  • Managing closed file state without requiring the client to monitor them. The server adds file watches to all files in a project, and triggers re computation for errors and updates context once a file has changed on disk.
  • Diagnostics update scheduling, the client does not need to trigger diagnostics update requests; the server sends events with errors whenever this is needed.
  • A line/column interface with no need to keep a line map for all files. the server does not request any positions in its calls.

The server is mainly available as an IO process that a client would create in a separate process and communicates with it over stdin/stdout.

The change also adds a JS client implementation as a reference implementation to a client, and also used for tests.

The protocol definitions are all in protocol.d.ts.

Note: Reviewing the final change is probably easier.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Mohamed Hegazy (mhegazy) added 30 commits January 31, 2015 21:14
@mhegazy
Rename the main node package filename to match the package name
acd4914
@mhegazy
Merge branch 'master' into TSServer
e4128af
Conflicts:
	Jakefile
@mhegazy
Add support for stat and modified time on sys
9735b74
@mhegazy
Add indexer on the Formatting options interface
27a9084
@mhegazy
Initial checkin for server code
17f19b2
@mhegazy
Wire the build for the server code
7b28f20
@mhegazy
Wire tests to use the new server
abec4f9
@mhegazy
Add fomratting tests
54f3250
@mhegazy
Add type annotations
0963644
@mhegazy
wire package.json command for the server
ee3ee05
@mhegazy
Simplify host logic in client
07d37fa
@mhegazy
Remove redundant type definitions
6e94f39
@mhegazy
Supportt abbreviation
4a44b74
@mhegazy
Wire navto tests
c987ab9
@mhegazy
Use commmandNames module
3e86e55
@mhegazy
Support brace matching
c0b1254
@mhegazy
Add test for format on key
93aa3f1
@mhegazy
Add test for goto def
99373db
@mhegazy
Recover from git corruption
a0b557e
@mhegazy
Always default to using JSON and do not format it
dfd8a06
@mhegazy
use ts.getDefaultLibFileName to get the default library file name
b175045
@mhegazy
Get details for member completions as well as completions matching pr…
ce828d0
…efix
@mhegazy
Move fileWatching logic to the server to allow for testing on non-nod…
89267bc
…e systems
@mhegazy
Add test for completions
d396ddf
@mhegazy
Add a new definition test
9867e06
@mhegazy
Add test for find references
11e2460
@mhegazy
Add test for quickInfo
178e8f7
@mhegazy
Add test for rename
40d3cb7
@mhegazy
Add navbar test
2a02655
@mhegazy
Make method names inline with matching LS function names
50ca35a
DanielRosenwasser
DanielRosenwasser reviewed Feb 17, 2015
View reviewed changes
Comment thread src/server/editorServices.ts

@DanielRosenwasser Daniel Rosenwasser (DanielRosenwasser) Feb 17, 2015

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get this onto the same line as the =

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@DanielRosenwasser Daniel Rosenwasser (DanielRosenwasser) Feb 17, 2015

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awkward and a probably somewhat unnecessary.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
steveluc added 3 commits February 18, 2015 00:14
steveluc
Removed deleteLen from change request; added endLine, endCol that mark
3868fb5
the end of the deleted Range (inclusive).  DeleteLen was not always
accurate because editors normalize \r\n to \n in some cases, affecting
the length of ranges.  In Diagnostic response items, changed len field
to end to address the same range length issue.  Flattened
MessageDiagnosticChains in diagnostic message text, since clients expect
string there.  Renamed ts.server.protocol to simply protocol in
session.ts and client.ts since module name prefix is clear.

Based on protocol feedback: Changed LineCol to Location.  Changed
CodeLocation interface name prefix to FileLocation.  Changed DiagEvent
to DiagnosticEvent.  Removed anonymous types.
steveluc
Split completions req/response pair into two messages "completions" and
4b59083
"completionEntryDetails".   This mirrors the function of the LS API and
increases performance of completion in large projects.
steveluc
Style fixes.
d364f61
Steve Lucco (steveluc) added a commit that referenced this pull request Feb 19, 2015
@steveluc
Merge pull request #2041 from Microsoft/TSServer
6d7045e
TS Server
@steveluc
Steve Lucco (steveluc) merged commit 6d7045e into master Feb 19, 2015
@steveluc
Steve Lucco (steveluc) deleted the TSServer branch February 19, 2015 21:10
@druppy Bo Lorentsen (druppy) mentioned this pull request Feb 19, 2015
TS Server ? Phaiax/ArcticTypescript#21
Open
@basarat

Basarat Ali Syed (basarat) commented Mar 10, 2015

Copy link
Copy Markdown
Contributor

I reviewed the TSServer code today as it exists in https://github.com/Microsoft/TypeScript/tree/master/src/server

I think its really nicely done in that it takes the burden of watching files + efficient snapshoting off of editor package authors.

The limitations for us is that it does not (and cannot easily using stdout) expose getProgram. This means that for really advanced features we would either need to wait for them to become a part of languageService or reimplement the stuff from TSServer. Also I use a globbing that isn't there in TSServer.

I am okay with using TSServer as a reference implementation and copying all the good stuff over. But just wanted to leave this feedback about my reasons for doing so (and potentially other package authors might end up doing the same thing). Thanks again for the initiative ❤️

ref : Based on TypeStrong/atom-typescript#91 /cc Colin Snover (@csnover)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhegazy Mohamed Hegazy (mhegazy) mentioned this pull request Mar 11, 2015
TSServer : make the ScriptInfo standalone #2297
Closed
@mttcr Mathieu C. (mttcr) mentioned this pull request Mar 14, 2016
Code completion takes seconds using Control+Space palantir/eclipse-typescript#306
Closed
@microsoft Microsoft (microsoft) locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@mhegazy @basarat @DanielRosenwasser @mihailik @CyrusNajmabadi @steveluc @msftclas
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.