Options
All
  • Public
  • Public/Protected
  • All
Menu

Module languages

Index

Variables

Const onDidChangeDiagnostics

onDidChangeDiagnostics: Event<DiagnosticChangeEvent>

An event which fires when the global set of diagnostics changes. This is newly added and removed diagnostics.

Functions

createDiagnosticCollection

getDiagnostics

  • Get all diagnostics for a given resource. Note that this includes diagnostics from all extensions but not yet from the task framework.

    Parameters

    • resource: Uri

      A resource

    Returns Diagnostic[]

    An array of diagnostics objects or an empty array.

  • Get all diagnostics. Note that this includes diagnostics from all extensions but not yet from the task framework.

    Returns [Uri, Diagnostic[]][]

    An array of uri-diagnostics tuples or an empty array.

getLanguages

  • getLanguages(): PromiseLike<string[]>
  • Return the identifiers of all known languages.

    Returns PromiseLike<string[]>

    Promise resolving to an array of identifier strings.

match

  • Compute the match between a document selector and a document. Values greater than zero mean the selector matches the document.

    A match is computed according to these rules:

    1. When DocumentSelector is an array, compute the match for each contained DocumentFilter or language identifier and take the maximum value.
    2. A string will be desugared to become the language-part of a DocumentFilter, so "fooLang" is like { language: "fooLang" }.
    3. A DocumentFilter will be matched against the document by comparing its parts with the document. The following rules apply:
      1. When the DocumentFilter is empty ({}) the result is 0
      2. When scheme, language, or pattern are defined but one doesn’t match, the result is 0
      3. Matching against * gives a score of 5, matching via equality or via a glob-pattern gives a score of 10
      4. The result is the maximum value of each match

    Samples:

    // default document from disk (file-scheme)
    doc.uri; //'file:///my/file.js'
    doc.languageId; // 'javascript'
    match('javascript', doc); // 10;
    match({language: 'javascript'}, doc); // 10;
    match({language: 'javascript', scheme: 'file'}, doc); // 10;
    match('*', doc); // 5
    match('fooLang', doc); // 0
    match(['fooLang', '*'], doc); // 5
    
    // virtual document, e.g. from git-index
    doc.uri; // 'git:/my/file.js'
    doc.languageId; // 'javascript'
    match('javascript', doc); // 10;
    match({language: 'javascript', scheme: 'git'}, doc); // 10;
    match('*', doc); // 5

    Parameters

    Returns number

    A number >0 when the selector matches and 0 when the selector does not match.

registerCodeActionsProvider

  • Register a code action provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

registerCodeLensProvider

  • Register a code lens provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

registerCompletionItemProvider

  • Register a completion provider.

    Multiple providers can be registered for a language. In that case providers are sorted by their score and groups of equal score are sequentially asked for completion items. The process stops when one or many providers of a group return a result. A failing provider (rejected promise or exception) will not fail the whole operation.

    Parameters

    • selector: DocumentSelector

      A selector that defines the documents this provider is applicable to.

    • provider: CompletionItemProvider

      A completion provider.

    • Rest ...triggerCharacters: string[]

      Trigger completion when the user types one of the characters, like . or :.

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

registerDefinitionProvider

  • Register a definition provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

registerDocumentFormattingEditProvider

  • Register a formatting provider for a document.

    Multiple providers can be registered for a language. In that case providers are sorted by their score and the best-matching provider is used. Failure of the selected provider will cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

registerDocumentLinkProvider

  • Register a document link provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

registerDocumentRangeFormattingEditProvider

  • Register a formatting provider for a document range.

    Note: A document range provider is also a document formatter which means there is no need to register a document formatter when also registering a range provider.

    Multiple providers can be registered for a language. In that case providers are sorted by their score and the best-matching provider is used. Failure of the selected provider will cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

registerDocumentSymbolProvider

  • Register a document symbol provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

registerHoverProvider

  • Register a hover provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

registerOnTypeFormattingEditProvider

  • Register a formatting provider that works on type. The provider is active when the user enables the setting editor.formatOnType.

    Multiple providers can be registered for a language. In that case providers are sorted by their score and the best-matching provider is used. Failure of the selected provider will cause a failure of the whole operation.

    Parameters

    • selector: DocumentSelector

      A selector that defines the documents this provider is applicable to.

    • provider: OnTypeFormattingEditProvider

      An on type formatting edit provider.

    • firstTriggerCharacter: string

      A character on which formatting should be triggered, like }.

    • Rest ...moreTriggerCharacter: string[]

      More trigger characters.

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

registerReferenceProvider

  • Register a reference provider.

    Multiple providers can be registered for a language. In that case providers are asked in parallel and the results are merged. A failing provider (rejected promise or exception) will not cause a failure of the whole operation.

    Parameters

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

registerSignatureHelpProvider

  • Register a signature help provider.

    Multiple providers can be registered for a language. In that case providers are sorted by their score and called sequentially until a provider returns a valid result.

    Parameters

    • selector: DocumentSelector

      A selector that defines the documents this provider is applicable to.

    • provider: SignatureHelpProvider

      A signature help provider.

    • Rest ...triggerCharacters: string[]

      Trigger signature help when the user types one of the characters, like , or (.

    Returns Disposable

    A disposable that unregisters this provider when being disposed.

setLanguageConfiguration