Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support communicating with tsserver using IPC #585

Merged
merged 2 commits into from
Sep 12, 2022
Merged

Conversation

rchl
Copy link
Member

@rchl rchl commented Sep 11, 2022

Ported a bunch of code from "VSCode typescript features" to enable us to be able to communicate with tsserver over IPC instead of stdio. IPC is used for tsserver (typescript) versions 4.60+, otherwise the legacy stdio is used.

If this seems like a lot of code to handle that case then yes, it is, but it's part of the plan to align the code as closely as possible with VSCode to be able to support features like #358 without re-inventing the wheel.

@niebloomj
Copy link

I love the idea here! Anything others can do to help?

}

export const nodeRequestCancellerFactory = new class implements OngoingRequestCancellerFactory {
create(/*serverId: string, tracer: Tracer*/): OngoingRequestCanceller {
Copy link
Contributor

Choose a reason for hiding this comment

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

should /*serverId: string */ be commented out?

Copy link
Member Author

Choose a reason for hiding this comment

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

It should as it's not used currently. But forgot to comment out in the interfaces also.

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like serverId is not necessary or used in NodeRequestCanceller,
but it just looked strange to see serverId being commented out only for this method.

import { NodeTsServerProcessFactory } from './serverProcess.js';
import type { TypeScriptVersion } from './versionProvider.js';

export class TypeScriptServerSpawner {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it maybe planned to have multiple processes for each TsServerProcessKind?

export const enum TsServerProcessKind {
    Main = 'main',
    Syntax = 'syntax',
    Semantic = 'semantic',
    Diagnostics = 'diagnostics'
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if multiple for each but I don't think so...

It would be one of each at most, I imagine.

@rchl rchl changed the title feat: implement support for communicating with tsserver using IPC feat: support communicating with tsserver using IPC Sep 12, 2022
@rchl rchl merged commit 8725b9b into master Sep 12, 2022
@rchl rchl deleted the feat/ipc-tsserver branch September 12, 2022 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants