(applicable-refactors language-service file-name position-or-range)(applicable-refactors language-service file-name position-or-range preferences)(applicable-refactors language-service
file-name
position-or-range
preferences
trigger-reason)(applicable-refactors language-service
file-name
position-or-range
preferences
trigger-reason
kind)(applicable-refactors language-service
file-name
position-or-range
preferences
trigger-reason
kind
include-interactive-actions?)Parameters:
file-name: stringposition-or-range: number | TextRangepreferences: UserPreferences | undefinedtrigger-reason: RefactorTriggerReason | undefinedkind: string | undefinedinclude-interactive-actions?: boolean | undefined - Include refactor actions that require additional arguments to be
passed when calling getEditsForRefactor. When true, clients should inspect the isInteractive
property of each returned RefactorActionInfo and ensure they are able to collect the appropriate
arguments for any interactive action before offering it.Returns: ApplicableRefactorInfo[]
**Parameters:** - `file-name`: `string` - `position-or-range`: `number | TextRange` - `preferences`: `UserPreferences | undefined` - `trigger-reason`: `RefactorTriggerReason | undefined` - `kind`: `string | undefined` - `include-interactive-actions?`: `boolean | undefined` - Include refactor actions that require additional arguments to be passed when calling `getEditsForRefactor`. When true, clients should inspect the `isInteractive` property of each returned `RefactorActionInfo` and ensure they are able to collect the appropriate arguments for any interactive action before offering it. **Returns:** `ApplicableRefactorInfo[]`
(apply-code-action-command language-service action)(apply-code-action-command language-service action format-settings)(apply-code-action-command language-service file-name action)Parameters:
file-name: stringaction: InstallPackageAction | InstallPackageAction[]format-settings: FormatCodeSettings | undefinedReturns: Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>
**Parameters:** - `file-name`: `string` - `action`: `InstallPackageAction | InstallPackageAction[]` - `format-settings`: `FormatCodeSettings | undefined` **Returns:** `Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>`
(brace-matching-at-position language-service file-name position)Parameters:
file-name: stringposition: numberReturns: TextSpan[]
**Parameters:** - `file-name`: `string` - `position`: `number` **Returns:** `TextSpan[]`
(breakpoint-statement-at-position language-service file-name position)Parameters:
file-name: stringposition: numberReturns: TextSpan | undefined
**Parameters:** - `file-name`: `string` - `position`: `number` **Returns:** `TextSpan | undefined`
(cleanup-semantic-cache language-service)This is used as a part of restarting the language service.
Returns: void
This is used as a part of restarting the language service. **Returns:** `void`
(code-fixes-at-position language-service
file-name
start
end
error-codes
format-options
preferences)Parameters:
file-name: stringstart: numberend: numbererror-codes: readonly number[]format-options: FormatCodeSettingspreferences: UserPreferencesReturns: readonly CodeFixAction[]
**Parameters:** - `file-name`: `string` - `start`: `number` - `end`: `number` - `error-codes`: `readonly number[]` - `format-options`: `FormatCodeSettings` - `preferences`: `UserPreferences` **Returns:** `readonly CodeFixAction[]`
(combined-code-fix language-service scope fix-id format-options preferences)Parameters:
scope: CombinedCodeFixScopefix-id: {}format-options: FormatCodeSettingspreferences: UserPreferencesReturns: CombinedCodeActions
**Parameters:**
- `scope`: `CombinedCodeFixScope`
- `fix-id`: `{}`
- `format-options`: `FormatCodeSettings`
- `preferences`: `UserPreferences`
**Returns:** `CombinedCodeActions`(comment-selection language-service file-name text-range)Parameters:
file-name: stringtext-range: TextRangeReturns: TextChange[]
**Parameters:** - `file-name`: `string` - `text-range`: `TextRange` **Returns:** `TextChange[]`
(compiler-options-diagnostics language-service)Gets global diagnostics related to the program configuration and compiler options.
Returns: Diagnostic[]
Gets global diagnostics related to the program configuration and compiler options. **Returns:** `Diagnostic[]`
(completion-entry-details language-service file-name position entry-name)(completion-entry-details language-service
file-name
position
entry-name
format-options)(completion-entry-details language-service
file-name
position
entry-name
format-options
source)(completion-entry-details language-service
file-name
position
entry-name
format-options
source
preferences)(completion-entry-details language-service
file-name
position
entry-name
format-options
source
preferences
data)Gets the extended details for a completion entry retrieved from getCompletionsAtPosition.
Parameters:
file-name: string - The path to the fileposition: number - A zero based index of the character where you want the entriesentry-name: string - The name from an existing completion which came from getCompletionsAtPositionformat-options: FormatCodeSettings | FormatCodeOptions | undefined - How should code samples in the completions be formatted, can be undefined for backwards compatibilitysource: string | undefined - source property from the completion entrypreferences: UserPreferences | undefined - User settings, can be undefined for backwards compatibilitydata: CompletionEntryData | undefined - data property from the completion entryReturns: CompletionEntryDetails | undefined
Gets the extended details for a completion entry retrieved from `getCompletionsAtPosition`. **Parameters:** - `file-name`: `string` - The path to the file - `position`: `number` - A zero based index of the character where you want the entries - `entry-name`: `string` - The `name` from an existing completion which came from `getCompletionsAtPosition` - `format-options`: `FormatCodeSettings | FormatCodeOptions | undefined` - How should code samples in the completions be formatted, can be undefined for backwards compatibility - `source`: `string | undefined` - `source` property from the completion entry - `preferences`: `UserPreferences | undefined` - User settings, can be undefined for backwards compatibility - `data`: `CompletionEntryData | undefined` - `data` property from the completion entry **Returns:** `CompletionEntryDetails | undefined`
(completion-entry-symbol language-service file-name position name)(completion-entry-symbol language-service file-name position name source)Parameters:
file-name: stringposition: numbername: stringsource: string | undefinedReturns: Symbol | undefined
**Parameters:** - `file-name`: `string` - `position`: `number` - `name`: `string` - `source`: `string | undefined` **Returns:** `Symbol | undefined`
(completions-at-position language-service file-name position)(completions-at-position language-service file-name position options)(completions-at-position language-service
file-name
position
options
formatting-settings)Gets completion entries at a particular position in a file.
Parameters:
file-name: string - The path to the fileposition: number - A zero-based index of the character where you want the entriesoptions: GetCompletionsAtPositionOptions | undefined - An object describing how the request was triggered and what kinds
of code actions can be returned with the completions.formatting-settings: FormatCodeSettings | undefined - settings needed for calling formatting functions.Returns: WithMetadata<CompletionInfo> | undefined
Gets completion entries at a particular position in a file. **Parameters:** - `file-name`: `string` - The path to the file - `position`: `number` - A zero-based index of the character where you want the entries - `options`: `GetCompletionsAtPositionOptions | undefined` - An object describing how the request was triggered and what kinds of code actions can be returned with the completions. - `formatting-settings`: `FormatCodeSettings | undefined` - settings needed for calling formatting functions. **Returns:** `WithMetadata<CompletionInfo> | undefined`
(definition-and-bound-span language-service file-name position)Parameters:
file-name: stringposition: numberReturns: DefinitionInfoAndBoundSpan | undefined
**Parameters:** - `file-name`: `string` - `position`: `number` **Returns:** `DefinitionInfoAndBoundSpan | undefined`
(definition-at-position language-service file-name position)Parameters:
file-name: stringposition: numberReturns: readonly DefinitionInfo[] | undefined
**Parameters:** - `file-name`: `string` - `position`: `number` **Returns:** `readonly DefinitionInfo[] | undefined`
(doc-comment-template-at-position language-service file-name position)(doc-comment-template-at-position language-service file-name position options)(doc-comment-template-at-position language-service
file-name
position
options
format-options)Parameters:
file-name: stringposition: numberoptions: DocCommentTemplateOptions | undefinedformat-options: FormatCodeSettings | undefinedReturns: TextInsertion | undefined
**Parameters:** - `file-name`: `string` - `position`: `number` - `options`: `DocCommentTemplateOptions | undefined` - `format-options`: `FormatCodeSettings | undefined` **Returns:** `TextInsertion | undefined`
(document-highlights language-service file-name position files-to-search)Parameters:
file-name: stringposition: numberfiles-to-search: string[]Returns: DocumentHighlights[] | undefined
**Parameters:** - `file-name`: `string` - `position`: `number` - `files-to-search`: `string[]` **Returns:** `DocumentHighlights[] | undefined`
(edits-for-file-rename language-service
old-file-path
new-file-path
format-options)(edits-for-file-rename language-service
old-file-path
new-file-path
format-options
preferences)Parameters:
old-file-path: stringnew-file-path: stringformat-options: FormatCodeSettingspreferences: UserPreferences | undefinedReturns: readonly FileTextChanges[]
**Parameters:** - `old-file-path`: `string` - `new-file-path`: `string` - `format-options`: `FormatCodeSettings` - `preferences`: `UserPreferences | undefined` **Returns:** `readonly FileTextChanges[]`
(edits-for-refactor language-service
file-name
format-options
position-or-range
refactor-name
action-name)(edits-for-refactor language-service
file-name
format-options
position-or-range
refactor-name
action-name
preferences)(edits-for-refactor language-service
file-name
format-options
position-or-range
refactor-name
action-name
preferences
interactive-refactor-arguments)Parameters:
file-name: stringformat-options: FormatCodeSettingsposition-or-range: number | TextRangerefactor-name: stringaction-name: stringpreferences: UserPreferences | undefinedinteractive-refactor-arguments: InteractiveRefactorArguments | undefinedReturns: RefactorEditInfo | undefined
**Parameters:** - `file-name`: `string` - `format-options`: `FormatCodeSettings` - `position-or-range`: `number | TextRange` - `refactor-name`: `string` - `action-name`: `string` - `preferences`: `UserPreferences | undefined` - `interactive-refactor-arguments`: `InteractiveRefactorArguments | undefined` **Returns:** `RefactorEditInfo | undefined`
(emit-output language-service file-name)(emit-output language-service file-name emit-only-dts-files?)(emit-output language-service file-name emit-only-dts-files? force-dts-emit?)Parameters:
file-name: stringemit-only-dts-files?: boolean | undefinedforce-dts-emit?: boolean | undefinedReturns: EmitOutput
**Parameters:** - `file-name`: `string` - `emit-only-dts-files?`: `boolean | undefined` - `force-dts-emit?`: `boolean | undefined` **Returns:** `EmitOutput`
(encoded-semantic-classifications language-service file-name span)(encoded-semantic-classifications language-service file-name span format)Gets semantic highlights information for a particular file. Has two formats, an older version used by VS and a format used by VS Code.
Parameters:
file-name: string - The path to the filespan: TextSpanformat: SemanticClassificationFormat | undefined - Which format to use, defaults to "original"Returns: Classifications - a number array encoded as triples of [start, length, ClassificationType, ...].
Gets semantic highlights information for a particular file. Has two formats, an older version used by VS and a format used by VS Code. **Parameters:** - `file-name`: `string` - The path to the file - `span`: `TextSpan` - `format`: `SemanticClassificationFormat | undefined` - Which format to use, defaults to "original" **Returns:** `Classifications` - a number array encoded as triples of [start, length, ClassificationType, ...].
(encoded-syntactic-classifications language-service file-name span)Encoded as triples of [start, length, ClassificationType].
Parameters:
file-name: stringspan: TextSpanReturns: Classifications
Encoded as triples of [start, length, ClassificationType]. **Parameters:** - `file-name`: `string` - `span`: `TextSpan` **Returns:** `Classifications`
(file-references language-service file-name)Parameters:
file-name: stringReturns: ReferenceEntry[]
**Parameters:** - `file-name`: `string` **Returns:** `ReferenceEntry[]`
(find-references language-service file-name position)Parameters:
file-name: stringposition: numberReturns: ReferencedSymbol[] | undefined
**Parameters:** - `file-name`: `string` - `position`: `number` **Returns:** `ReferencedSymbol[] | undefined`
(find-rename-locations language-service
file-name
position
find-in-strings?
find-in-comments?)(find-rename-locations language-service
file-name
position
find-in-strings?
find-in-comments?
preferences)(find-rename-locations language-service
file-name
position
find-in-strings?
find-in-comments?
provide-prefix-and-suffix-text-for-rename?)Parameters:
file-name: stringposition: numberfind-in-strings?: booleanfind-in-comments?: booleanpreferences: UserPreferencesprovide-prefix-and-suffix-text-for-rename?: boolean | undefinedReturns: readonly RenameLocation[] | undefined
**Parameters:** - `file-name`: `string` - `position`: `number` - `find-in-strings?`: `boolean` - `find-in-comments?`: `boolean` - `preferences`: `UserPreferences` - `provide-prefix-and-suffix-text-for-rename?`: `boolean | undefined` **Returns:** `readonly RenameLocation[] | undefined`
(formatting-edits-after-keystroke language-service
file-name
position
key
options)Parameters:
file-name: stringposition: numberkey: stringoptions: FormatCodeSettings | FormatCodeOptionsReturns: TextChange[]
**Parameters:** - `file-name`: `string` - `position`: `number` - `key`: `string` - `options`: `FormatCodeSettings | FormatCodeOptions` **Returns:** `TextChange[]`
(formatting-edits-for-document language-service file-name options)Parameters:
file-name: stringoptions: FormatCodeSettings | FormatCodeOptionsReturns: TextChange[]
**Parameters:** - `file-name`: `string` - `options`: `FormatCodeSettings | FormatCodeOptions` **Returns:** `TextChange[]`
(formatting-edits-for-range language-service file-name start end options)Parameters:
file-name: stringstart: numberend: numberoptions: FormatCodeSettings | FormatCodeOptionsReturns: TextChange[]
**Parameters:** - `file-name`: `string` - `start`: `number` - `end`: `number` - `options`: `FormatCodeSettings | FormatCodeOptions` **Returns:** `TextChange[]`
(implementation-at-position language-service file-name position)Parameters:
file-name: stringposition: numberReturns: readonly ImplementationLocation[] | undefined
**Parameters:** - `file-name`: `string` - `position`: `number` **Returns:** `readonly ImplementationLocation[] | undefined`
(indentation-at-position language-service file-name position options)Parameters:
file-name: stringposition: numberoptions: EditorSettings | EditorOptionsReturns: number
**Parameters:** - `file-name`: `string` - `position`: `number` - `options`: `EditorSettings | EditorOptions` **Returns:** `number`
(jsx-closing-tag-at-position language-service file-name position)This will return a defined result if the position is after the > of the opening tag, or somewhere in the text, of a JSXElement with no closing tag.
Editors should call this after > is typed.
Parameters:
file-name: stringposition: numberReturns: JsxClosingTagInfo | undefined
This will return a defined result if the position is after the `>` of the opening tag, or somewhere in the text, of a JSXElement with no closing tag. Editors should call this after `>` is typed. **Parameters:** - `file-name`: `string` - `position`: `number` **Returns:** `JsxClosingTagInfo | undefined`
(linked-editing-range-at-position language-service file-name position)Parameters:
file-name: stringposition: numberReturns: LinkedEditingInfo | undefined
**Parameters:** - `file-name`: `string` - `position`: `number` **Returns:** `LinkedEditingInfo | undefined`
(move-to-refactoring-file-suggestions language-service
file-name
position-or-range)(move-to-refactoring-file-suggestions language-service
file-name
position-or-range
preferences)(move-to-refactoring-file-suggestions language-service
file-name
position-or-range
preferences
trigger-reason)(move-to-refactoring-file-suggestions language-service
file-name
position-or-range
preferences
trigger-reason
kind)Parameters:
file-name: stringposition-or-range: number | TextRangepreferences: UserPreferences | undefinedtrigger-reason: RefactorTriggerReason | undefinedkind: string | undefinedReturns: { newFileName: string; files: string[]; }
**Parameters:**
- `file-name`: `string`
- `position-or-range`: `number | TextRange`
- `preferences`: `UserPreferences | undefined`
- `trigger-reason`: `RefactorTriggerReason | undefined`
- `kind`: `string | undefined`
**Returns:** `{ newFileName: string; files: string[]; }`(name-or-dotted-name-span language-service file-name start-pos end-pos)Parameters:
file-name: stringstart-pos: numberend-pos: numberReturns: TextSpan | undefined
**Parameters:** - `file-name`: `string` - `start-pos`: `number` - `end-pos`: `number` **Returns:** `TextSpan | undefined`
(navigate-to-items language-service search-value)(navigate-to-items language-service search-value max-result-count)(navigate-to-items language-service search-value max-result-count file-name)(navigate-to-items language-service
search-value
max-result-count
file-name
exclude-dts-files?)(navigate-to-items language-service
search-value
max-result-count
file-name
exclude-dts-files?
exclude-lib-files?)Parameters:
search-value: stringmax-result-count: number | undefinedfile-name: string | undefinedexclude-dts-files?: boolean | undefinedexclude-lib-files?: boolean | undefinedReturns: NavigateToItem[]
**Parameters:** - `search-value`: `string` - `max-result-count`: `number | undefined` - `file-name`: `string | undefined` - `exclude-dts-files?`: `boolean | undefined` - `exclude-lib-files?`: `boolean | undefined` **Returns:** `NavigateToItem[]`
(navigation-bar-items language-service file-name)Parameters:
file-name: stringReturns: NavigationBarItem[]
**Parameters:** - `file-name`: `string` **Returns:** `NavigationBarItem[]`
(navigation-tree language-service file-name)Parameters:
file-name: stringReturns: NavigationTree
**Parameters:** - `file-name`: `string` **Returns:** `NavigationTree`
(organize-imports language-service args format-options)(organize-imports language-service args format-options preferences)Parameters:
args: OrganizeImportsArgsformat-options: FormatCodeSettingspreferences: UserPreferences | undefinedReturns: readonly FileTextChanges[]
**Parameters:** - `args`: `OrganizeImportsArgs` - `format-options`: `FormatCodeSettings` - `preferences`: `UserPreferences | undefined` **Returns:** `readonly FileTextChanges[]`
(outlining-spans language-service file-name)Parameters:
file-name: stringReturns: OutliningSpan[]
**Parameters:** - `file-name`: `string` **Returns:** `OutliningSpan[]`
(prepare-call-hierarchy language-service file-name position)Parameters:
file-name: stringposition: numberReturns: CallHierarchyItem | CallHierarchyItem[] | undefined
**Parameters:** - `file-name`: `string` - `position`: `number` **Returns:** `CallHierarchyItem | CallHierarchyItem[] | undefined`
(program language-service)Returns: Program | undefined
**Returns:** `Program | undefined`
(provide-call-hierarchy-incoming-calls language-service file-name position)Parameters:
file-name: stringposition: numberReturns: CallHierarchyIncomingCall[]
**Parameters:** - `file-name`: `string` - `position`: `number` **Returns:** `CallHierarchyIncomingCall[]`
(provide-call-hierarchy-outgoing-calls language-service file-name position)Parameters:
file-name: stringposition: numberReturns: CallHierarchyOutgoingCall[]
**Parameters:** - `file-name`: `string` - `position`: `number` **Returns:** `CallHierarchyOutgoingCall[]`
(provide-inlay-hints language-service file-name span)(provide-inlay-hints language-service file-name span preferences)Parameters:
file-name: stringspan: TextSpanpreferences: UserPreferences | undefinedReturns: InlayHint[]
**Parameters:** - `file-name`: `string` - `span`: `TextSpan` - `preferences`: `UserPreferences | undefined` **Returns:** `InlayHint[]`
(quick-info-at-position language-service file-name position)Gets semantic information about the identifier at a particular position in a file. Quick info is what you typically see when you hover in an editor.
Parameters:
file-name: string - The path to the fileposition: number - A zero-based index of the character where you want the quick infoReturns: QuickInfo | undefined
Gets semantic information about the identifier at a particular position in a file. Quick info is what you typically see when you hover in an editor. **Parameters:** - `file-name`: `string` - The path to the file - `position`: `number` - A zero-based index of the character where you want the quick info **Returns:** `QuickInfo | undefined`
(references-at-position language-service file-name position)Parameters:
file-name: stringposition: numberReturns: ReferenceEntry[] | undefined
**Parameters:** - `file-name`: `string` - `position`: `number` **Returns:** `ReferenceEntry[] | undefined`
(rename-info language-service file-name position)(rename-info language-service file-name position options)(rename-info language-service file-name position preferences)Parameters:
file-name: stringposition: numberoptions: RenameInfoOptions | undefinedpreferences: UserPreferencesReturns: RenameInfo
**Parameters:** - `file-name`: `string` - `position`: `number` - `options`: `RenameInfoOptions | undefined` - `preferences`: `UserPreferences` **Returns:** `RenameInfo`
(semantic-classifications language-service file-name span)(semantic-classifications language-service file-name span format)Parameters:
file-name: stringspan: TextSpanformat: SemanticClassificationFormatReturns: ClassifiedSpan[] | ClassifiedSpan2020[]
**Parameters:** - `file-name`: `string` - `span`: `TextSpan` - `format`: `SemanticClassificationFormat` **Returns:** `ClassifiedSpan[] | ClassifiedSpan2020[]`
(semantic-diagnostics language-service file-name)Gets warnings or errors indicating type system issues in a given file. Requesting semantic diagnostics may start up the type system and run deferred work, so the first call may take longer than subsequent calls.
Unlike the other get*Diagnostics functions, these diagnostics can potentially not include a reference to a source file. Specifically, the first time this is called, it will return global diagnostics with no associated location.
To contrast the differences between semantic and syntactic diagnostics, consider the sentence: "The sun is green." is syntactically correct; those are real English words with correct sentence structure. However, it is semantically invalid, because it is not true.
Parameters:
file-name: string - A path to the file you want semantic diagnostics forReturns: Diagnostic[]
Gets warnings or errors indicating type system issues in a given file. Requesting semantic diagnostics may start up the type system and run deferred work, so the first call may take longer than subsequent calls. Unlike the other get*Diagnostics functions, these diagnostics can potentially not include a reference to a source file. Specifically, the first time this is called, it will return global diagnostics with no associated location. To contrast the differences between semantic and syntactic diagnostics, consider the sentence: "The sun is green." is syntactically correct; those are real English words with correct sentence structure. However, it is semantically invalid, because it is not true. **Parameters:** - `file-name`: `string` - A path to the file you want semantic diagnostics for **Returns:** `Diagnostic[]`
(signature-help-items language-service file-name position)(signature-help-items language-service file-name position options)Parameters:
file-name: stringposition: numberoptions: SignatureHelpItemsOptions | undefinedReturns: SignatureHelpItems | undefined
**Parameters:** - `file-name`: `string` - `position`: `number` - `options`: `SignatureHelpItemsOptions | undefined` **Returns:** `SignatureHelpItems | undefined`
(smart-selection-range language-service file-name position)Parameters:
file-name: stringposition: numberReturns: SelectionRange
**Parameters:** - `file-name`: `string` - `position`: `number` **Returns:** `SelectionRange`
(span-of-enclosing-comment language-service file-name position only-multi-line?)Parameters:
file-name: stringposition: numberonly-multi-line?: booleanReturns: TextSpan | undefined
**Parameters:** - `file-name`: `string` - `position`: `number` - `only-multi-line?`: `boolean` **Returns:** `TextSpan | undefined`
(suggestion-diagnostics language-service file-name)Gets suggestion diagnostics for a specific file. These diagnostics tend to proactively suggest refactors, as opposed to diagnostics that indicate potentially incorrect runtime behavior.
Parameters:
file-name: string - A path to the file you want semantic diagnostics forReturns: DiagnosticWithLocation[]
Gets suggestion diagnostics for a specific file. These diagnostics tend to proactively suggest refactors, as opposed to diagnostics that indicate potentially incorrect runtime behavior. **Parameters:** - `file-name`: `string` - A path to the file you want semantic diagnostics for **Returns:** `DiagnosticWithLocation[]`
(supported-code-fixes language-service)(supported-code-fixes language-service file-name)Parameters:
file-name: string | undefinedReturns: readonly string[]
**Parameters:** - `file-name`: `string | undefined` **Returns:** `readonly string[]`
(syntactic-classifications language-service file-name span)(syntactic-classifications language-service file-name span format)Parameters:
file-name: stringspan: TextSpanformat: SemanticClassificationFormatReturns: ClassifiedSpan[] | ClassifiedSpan2020[]
**Parameters:** - `file-name`: `string` - `span`: `TextSpan` - `format`: `SemanticClassificationFormat` **Returns:** `ClassifiedSpan[] | ClassifiedSpan2020[]`
(syntactic-diagnostics language-service file-name)Gets errors indicating invalid syntax in a file.
In English, "this cdeo have, erorrs" is syntactically invalid because it has typos,
grammatical errors, and misplaced punctuation. Likewise, examples of syntax
errors in TypeScript are missing parentheses in an if statement, mismatched
curly braces, and using a reserved keyword as a variable name.
These diagnostics are inexpensive to compute and don't require knowledge of
other files. Note that a non-empty result increases the likelihood of false positives
from getSemanticDiagnostics.
While these represent the majority of syntax-related diagnostics, there are some
that require the type system, which will be present in getSemanticDiagnostics.
Parameters:
file-name: string - A path to the file you want syntactic diagnostics forReturns: DiagnosticWithLocation[]
Gets errors indicating invalid syntax in a file. In English, "this cdeo have, erorrs" is syntactically invalid because it has typos, grammatical errors, and misplaced punctuation. Likewise, examples of syntax errors in TypeScript are missing parentheses in an `if` statement, mismatched curly braces, and using a reserved keyword as a variable name. These diagnostics are inexpensive to compute and don't require knowledge of other files. Note that a non-empty result increases the likelihood of false positives from `getSemanticDiagnostics`. While these represent the majority of syntax-related diagnostics, there are some that require the type system, which will be present in `getSemanticDiagnostics`. **Parameters:** - `file-name`: `string` - A path to the file you want syntactic diagnostics for **Returns:** `DiagnosticWithLocation[]`
(to-line-column-offset language-service file-name position)Parameters:
file-name: stringposition: numberReturns: LineAndCharacter
**Parameters:** - `file-name`: `string` - `position`: `number` **Returns:** `LineAndCharacter`
(todo-comments language-service file-name descriptors)Parameters:
file-name: stringdescriptors: TodoCommentDescriptor[]Returns: TodoComment[]
**Parameters:** - `file-name`: `string` - `descriptors`: `TodoCommentDescriptor[]` **Returns:** `TodoComment[]`
(toggle-line-comment language-service file-name text-range)Parameters:
file-name: stringtext-range: TextRangeReturns: TextChange[]
**Parameters:** - `file-name`: `string` - `text-range`: `TextRange` **Returns:** `TextChange[]`
(toggle-multiline-comment language-service file-name text-range)Parameters:
file-name: stringtext-range: TextRangeReturns: TextChange[]
**Parameters:** - `file-name`: `string` - `text-range`: `TextRange` **Returns:** `TextChange[]`
(type-definition-at-position language-service file-name position)Parameters:
file-name: stringposition: numberReturns: readonly DefinitionInfo[] | undefined
**Parameters:** - `file-name`: `string` - `position`: `number` **Returns:** `readonly DefinitionInfo[] | undefined`
(uncomment-selection language-service file-name text-range)Parameters:
file-name: stringtext-range: TextRangeReturns: TextChange[]
**Parameters:** - `file-name`: `string` - `text-range`: `TextRange` **Returns:** `TextChange[]`
(valid-brace-completion-at-position? language-service
file-name
position
opening-brace)Parameters:
file-name: stringposition: numberopening-brace: numberReturns: boolean
**Parameters:** - `file-name`: `string` - `position`: `number` - `opening-brace`: `number` **Returns:** `boolean`
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |