Skip to content

Latest commit

 

History

History
347 lines (256 loc) · 8.67 KB

custom-messages.md

File metadata and controls

347 lines (256 loc) · 8.67 KB

Features and modules

Custom methods

Currently the following custom methods are supported:

  • serializeJSONLD
  • updateConfiguration
  • filesInProject
  • cleanDiagnosticTree
  • fileUsage
  • conversion
  • serialization
  • didChangeConfiguration command
  • renameFile

serializeJSONLD

After initialization, provides notifications with the JSONLD when available (updates with changes).

Notification message from server to client:

{
  "uri": "DocumentUri",
  "model": "string"
}

updateConfiguration

Client notification to update the ALS-specific configuration.

Notification message from client to server:

{
    "formattingOptions": {
      "string": {
        "tabSize": "integer",
        "insertSpaces": "boolean"
      }
    },
    "genericOptions": {
      "string": "any"
    },              
    "templateType": "NONE|SIMPLE|FULL"
}

templateType values:

  • NONE: Turns templates off.
  • SIMPLE: Template will only contain the first level.
  • FULL: Template will contain the whole structure required for the definition. If no FULL option is available, by default it will show the SIMPLE template.
  • BOTH: Template will contain both the first and second level.

filesInProject

After initialization, provides notifications about the files included in a project (updates with changes).

Notification message from server to client:

{
    "uris": "DocumentUri[]"
}

cleanDiagnosticTree

Performs validation on a given document (without the use of cache).

Request message from client to server:

Request

{
  "textDocument": "TextDocumentIdentifier"
}

Response

{
  "uri": "DocumentUri",
  "diagnostics": "Diagnostic[]",
  "profile": "string"
}

fileUsage

For a given document, generates a list of other documents that reference it.

Request message from client to server:

Request

{
  "uri": "DocumentUri"
}

Response

[ "Location" ]

conversion

For a given document, performs AMF conversion for compatible specifications.

Request message from client to server:

Request

{
  "uri": "DocumentUri",
  "target": "string",          
  "syntax?": "string"
}

target values:

  • OAS 2.0
  • OAS 3.0
  • RAML 0.8
  • RAML 1.0
  • ASYNC 2.0
  • AMF Graph

syntax values:

  • json
  • yaml
  • raml

Response

{
  "uri": "DocumentUri",
  "model": "string"
}

serialization

For a given document, serializes AMF towards a specific model (similar to the JSONLD notifications, but on demand

Request message from client to server:

Request

{
  "documentIdentifier": "TextDocumentIdentifier"
}

Response

{
  "uri": "DocumentUri",
  "model": "string"
}
In JS artifact, instead of a string this will return a JS Object (for better performance)

textDocument/didFocus

Sent from the client to server to notice a new focus for a file, which will trigger new parse and diagnostic on isolated files (similar to textdocument/didOpen).

Notification from client to server:

{
  "uri": "DocumentUri",
  "version": "integer"
}

getWorkspaceConfiguration

Request from client to server to get the Workspace Configuration applied for a specific file.

Please bear in mind that the Workspace Configuration is not the same as the global Als Configuration.

Request

{
  "textDocument": "TextDocumentIdentifier" 
}

Response

{
  "workspace": string,
  "configuration": {
    "mainPath": string,
    "folder"?: string,
    "dependencies": string[],
    "customValidationProfiles": string[],
    "semanticExtensions": string[]
  }
}

Where:

  • workspace is the root folder of the workspace containing the file
  • mainPath is the main file uri of said workspace
  • folder same as workspace [optional]
  • dependencies uris of all immutable dependencies of the project
  • customValidationProfiles uris of all the active validation profiles on the workspace
  • semanticExtensions uris of all the active semantic extensions on the workspace (Not yet implemented)

didChangeConfiguration

Request message from client to server's workspace/executeCommand, to modify a workspace configuration.

Request

{
  "command": "didChangeConfiguration",
  "arguments": [
    {
      "mainPath"?: string,
      "folder": string,
      "dependencies": [
        {
          "uri": string,
          "scope"?: string 
        }
      ]
    }
  ]
}

Where:

  • folder uri pointing to the workspace for which this configuration change will be applied
  • mainPath [optional] sets the main file path of the workspace. Path will always be relative to the workspace folder uri.
  • dependencies the project's dependencies.
    • file the dependency URI
    • scope [optional] The scope given to the dependency, can have the following values:
      • "custom-validation": Custom Validation Profile
      • "semantic-extension": AML semantic extensions
      • "dialect": AML dialects
      • "dependency": cacheable dependency

Response

{}

indexDialect command

Request message from client to server's workspace/executeCommand:

Request

{
  "command": "indexDialect",
  "arguments": [
    {
      "uri": "DocumentUri",
      "content"?: "string"
    }
  ]
}

If a content is not provided, the dialect will be loaded from the provided uri.

Response

{}

Deprecated

WARNING: The use of these custom methods is discouraged and they will be removed in future release.

renameFile

Deprecated in favor of willRename, which is set to be implemented in the short run.

For a given document, provides all the requirements to rename the file and it's references inside a project.

Request message from client to server:

Request

{
  "oldDocument": "TextDocumentIdentifier",
  "newDocument": "TextDocumentIdentifier"
}

Response

{
  "edits": "WorkspaceEdit"
}

didFocusChange

Deprecated in favor of the textDocument/didFocus notification.

Request message from client to server's workspace/executeCommand:

Request

{
  "command": "didFocusChange",
  "arguments": [
    {
      "uri": "DocumentUri",
      "version": "integer"
    }
  ]
}

Response

{}