@@ -289,43 +289,110 @@ namespace ts {
289289 // with a language service host instance
290290 //
291291 export interface LanguageService {
292+ /** This is used as a part of restarting the language service. */
292293 cleanupSemanticCache ( ) : void ;
293294
295+ /**
296+ * Gets errors indicating invalid syntax in a file.
297+ *
298+ * In English, "this cdeo have, erorrs" is syntactically invalid because it has typos,
299+ * grammatical errors, and misplaced punctuation. Likewise, examples of syntax
300+ * errors in TypeScript are missing parentheses in an `if` statement, mismatched
301+ * curly braces, and using a reserved keyword as a variable name.
302+ *
303+ * These diagnostics are inexpensive to compute and don't require knowledge of
304+ * other files. Note that a non-empty result increases the likelihood of false positives
305+ * from `getSemanticDiagnostics`.
306+ *
307+ * While these represent the majority of syntax-related diagnostics, there are some
308+ * that require the type system, which will be present in `getSemanticDiagnostics`.
309+ *
310+ * @param fileName A path to the file you want syntactic diagnostics for
311+ */
294312 getSyntacticDiagnostics ( fileName : string ) : DiagnosticWithLocation [ ] ;
295- /** The first time this is called, it will return global diagnostics (no location). */
313+
314+ /**
315+ * Gets warnings or errors indicating type system issues in a given file.
316+ * Requesting semantic diagnostics may start up the type system and
317+ * run deferred work, so the first call may take longer than subsequent calls.
318+ *
319+ * Unlike the other get*Diagnostics functions, these diagnostics can potentially not
320+ * include a reference to a source file. Specifically, the first time this is called,
321+ * it will return global diagnostics with no associated location.
322+ *
323+ * To contrast the differences between semantic and syntactic diagnostics, consider the
324+ * sentence: "The sun is green." is syntactically correct; those are real English words with
325+ * correct sentence structure. However, it is semantically invalid, because it is not true.
326+ *
327+ * @param fileName A path to the file you want semantic diagnostics for
328+ */
296329 getSemanticDiagnostics ( fileName : string ) : Diagnostic [ ] ;
330+
331+ /**
332+ * Gets suggestion diagnostics for a specific file. These diagnostics tend to
333+ * proactively suggest refactors, as opposed to diagnostics that indicate
334+ * potentially incorrect runtime behavior.
335+ *
336+ * @param fileName A path to the file you want semantic diagnostics for
337+ */
297338 getSuggestionDiagnostics ( fileName : string ) : DiagnosticWithLocation [ ] ;
298339
299340 // TODO: Rename this to getProgramDiagnostics to better indicate that these are any
300341 // diagnostics present for the program level, and not just 'options' diagnostics.
301- getCompilerOptionsDiagnostics ( ) : Diagnostic [ ] ;
302342
303343 /**
304- * @deprecated Use getEncodedSyntacticClassifications instead .
344+ * Gets global diagnostics related to the program configuration and compiler options .
305345 */
346+ getCompilerOptionsDiagnostics ( ) : Diagnostic [ ] ;
347+
348+ /** @deprecated Use getEncodedSyntacticClassifications instead. */
306349 getSyntacticClassifications ( fileName : string , span : TextSpan ) : ClassifiedSpan [ ] ;
307350
308- /**
309- * @deprecated Use getEncodedSemanticClassifications instead.
310- */
351+ /** @deprecated Use getEncodedSemanticClassifications instead. */
311352 getSemanticClassifications ( fileName : string , span : TextSpan ) : ClassifiedSpan [ ] ;
312353
313354 // Encoded as triples of [start, length, ClassificationType].
314355 getEncodedSyntacticClassifications ( fileName : string , span : TextSpan ) : Classifications ;
315356 getEncodedSemanticClassifications ( fileName : string , span : TextSpan ) : Classifications ;
316357
358+ /**
359+ * Gets completion entries at a particular position in a file.
360+ *
361+ * @param fileName The path to the file
362+ * @param position A zero-based index of the character where you want the entries
363+ * @param options An object describing how the request was triggered and what kinds
364+ * of code actions can be returned with the completions.
365+ */
317366 getCompletionsAtPosition ( fileName : string , position : number , options : GetCompletionsAtPositionOptions | undefined ) : WithMetadata < CompletionInfo > | undefined ;
318- // "options" and "source" are optional only for backwards-compatibility
367+
368+ /**
369+ * Gets the extended details for a completion entry retrieved from `getCompletionsAtPosition`.
370+ *
371+ * @param fileName The path to the file
372+ * @param position A zero based index of the character where you want the entries
373+ * @param entryName The name from an existing completion which came from `getCompletionsAtPosition`
374+ * @param formatOptions How should code samples in the completions be formatted, can be undefined for backwards compatibility
375+ * @param source Source code for the current file, can be undefined for backwards compatibility
376+ * @param preferences User settings, can be undefined for backwards compatibility
377+ */
319378 getCompletionEntryDetails (
320379 fileName : string ,
321380 position : number ,
322- name : string ,
381+ entryName : string ,
323382 formatOptions : FormatCodeOptions | FormatCodeSettings | undefined ,
324383 source : string | undefined ,
325384 preferences : UserPreferences | undefined ,
326385 ) : CompletionEntryDetails | undefined ;
386+
327387 getCompletionEntrySymbol ( fileName : string , position : number , name : string , source : string | undefined ) : Symbol | undefined ;
328388
389+ /**
390+ * Gets semantic information about the identifier at a particular position in a
391+ * file. Quick info is what you typically see when you hover in an editor.
392+ *
393+ * @param fileName The path to the file
394+ * @param position A zero-based index of the character where you want the quick info
395+ */
329396 getQuickInfoAtPosition ( fileName : string , position : number ) : QuickInfo | undefined ;
330397
331398 getNameOrDottedNameSpan ( fileName : string , startPos : number , endPos : number ) : TextSpan | undefined ;
0 commit comments