Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9107015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:28:22+00:00 2026-06-17T02:28:22+00:00

After reading the src\services code, it seems this is the interface any host of

  • 0

After reading the src\services code, it seems this is the interface any host of a language service must satisfy:

//
// Public interface of the host of a language service instance.
//
export interface ILanguageServiceHost extends TypeScript.ILogger {
    getCompilationSettings(): TypeScript.CompilationSettings;
    getScriptCount(): number;
    getScriptId(scriptIndex: number): string;
    getScriptSourceText(scriptIndex: number, start: number, end: number): string;
    getScriptSourceLength(scriptIndex: number): number;
    getScriptIsResident(scriptIndex: number): bool;
    getScriptVersion(scriptIndex: number): number;
    getScriptEditRangeSinceVersion(scriptIndex: number, scriptVersion: number): TypeScript.ScriptEditRange;
}

I haven’t been able to find any documentation or samples, and while some methods are self-explanatory, others are not, notably:

getScriptId()
getScriptIsResident()
getScriptVersion()
getScriptEditRangeSinceVersion()

Is the language service API ready for use? Could someone explain briefly the purpose of the methods above?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T02:28:23+00:00Added an answer on June 17, 2026 at 2:28 am

    Disclaimer: The language service hosting API will be changing in future versions. I’m not sure what the full extent of the changes will be — I expect things will be mostly the same, but there will almost certainly be breaking changes.

    Also, there’s a full TypeScript implementation of the hosting API in src\harness\harness.ts used for the language service unit tests you can refer to. Here’s a conceptual breakdown of the functions you listed:

    getScriptId()

    You need to return a string that is unique for each file (script), but doesn’t change from invocation from invocation. Returning the filename of the script would work nicely.

    getScriptIsResident()

    The compiler has a notion of a ‘resident’ file that isn’t mutable (for example, lib.d.ts). Resident status is used for performance reasons — for example, types that came out of a resident file are considered immutable (this is why you see oddness in Visual Studio when you try to extend a type defined in lib.d.ts). You can safely return false for all files here, or if you know a file is immutable, you can return true. The concept of a ‘resident’ file will go away in some future version of the compiler once the improved type-checker comes online.

    getScriptVersion()

    Here, you need to return a monotonically increasing number that is incremented whenever the source text of the script changes. The language service uses this number to determine whether or not it should do reparsing / retypechecking of the files.

    getScriptEditRangeSinceVersion()

    This function should return a list of edit ranges (hopefully self-explanatory) that have occurred between now and the specified prior version number (see above getScriptVersion). Obviously this is a bit of a pain to implement, but it is allowable here to return TypeScript.ScriptEditRange.unknown(), at which point the language service will do a full reparse of the file (significant perf impact, so try to do this sparingly in interactive contexts).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After reading answer to this question: Make "make" default to "make -j 8" I
After reading the Bash man pages and with respect to this post , I
After reading this question, I need to clear up some things. IQueryable<Customer> custs =
After reading jQuery's CSS documentation , it doesn't look like it offers any advantages
After reading the Service Oriented Architecture Principles site and the respective Wikipedia article I
After reading this article, it makes sense to rebase to gather changes from the
After reading some stuff it seems I can map the SMBIOS memory and parse
After reading this nice article (The Care and Feeding of Pre-Compiled Headers), I have
EDIT I'd still like to know why this happened but after reading some stuff
After reading the documentation on logging , I know I can use code like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.