2020-05-15 13:41:26 +03:00
---
layout: developer-doc
title: Enso Protocol Language Server Message Specification
category: language-server
tags: [language-server, protocol, specification]
order: 4
---
# Enso Protocol Language Server Message Specification
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This document contains the specification of the Enso protocol messages that
pertain to the language server component. Please familiarise yourself with the
[common ](./protocol-common.md ) features of the protocol before reading this
document.
For information on the design and architecture of the protocol, as well as its
transport formats, please look [here ](./protocol-architecture ).
<!-- MarkdownTOC levels="2,3" autolink="true" -->
- [Types ](#types )
- [`ExpressionId` ](#expressionid )
- [`ContextId` ](#contextid )
- [`StackItem` ](#stackitem )
2023-05-31 18:47:48 +03:00
- [`MethodCall` ](#methodcall )
2020-05-15 13:41:26 +03:00
- [`MethodPointer` ](#methodpointer )
2021-05-26 17:08:41 +03:00
- [`ProfilingInfo` ](#profilinginfo )
2021-01-21 17:10:21 +03:00
- [`ExpressionUpdate` ](#expressionupdate )
2021-01-25 17:41:20 +03:00
- [`ExpressionUpdatePayload` ](#expressionupdatepayload )
2023-06-26 20:04:35 +03:00
- [`VisualizationConfiguration` ](#visualizationconfiguration )
- [`VisualizationExpression` ](#visualizationexpression )
2020-06-10 17:51:04 +03:00
- [`SuggestionEntryArgument` ](#suggestionentryargument )
- [`SuggestionEntry` ](#suggestionentry )
- [`SuggestionEntryType` ](#suggestionentrytype )
2020-08-04 13:31:56 +03:00
- [`SuggestionId` ](#suggestionid )
2022-03-25 10:49:37 +03:00
- [`DocSection` ](#docsection )
2020-08-04 13:31:56 +03:00
- [`SuggestionsDatabaseEntry` ](#suggestionsdatabaseentry )
2020-11-10 14:50:37 +03:00
- [`FieldAction` ](#fieldaction )
- [`FieldUpdate` ](#fieldupdate )
- [`SuggestionArgumentUpdate` ](#suggestionargumentupdate )
2020-06-10 17:51:04 +03:00
- [`SuggestionsDatabaseUpdate` ](#suggestionsdatabaseupdate )
2021-06-01 15:43:22 +03:00
- [`SuggestionsOrderDatabaseUpdate` ](#suggestionsorderdatabaseupdate )
2020-11-26 18:44:35 +03:00
- [`Export` ](#export )
2020-05-15 13:41:26 +03:00
- [`File` ](#file )
- [`DirectoryTree` ](#directorytree )
- [`FileAttributes` ](#fileattributes )
- [`UTCDateTime` ](#utcdatetime )
- [`FileEventKind` ](#fileeventkind )
- [`Position` ](#position )
- [`Range` ](#range )
- [`TextEdit` ](#textedit )
2020-10-15 16:03:45 +03:00
- [`DiagnosticType` ](#diagnostictype )
- [`StackTraceElement` ](#stacktraceelement )
2023-06-29 10:35:28 +03:00
- [`ExecutionResult` ](#executionresult )
2020-10-15 16:03:45 +03:00
- [`Diagnostic` ](#diagnostic )
2020-05-15 13:41:26 +03:00
- [`SHA3-224` ](#sha3-224 )
- [`FileEdit` ](#fileedit )
- [`FileContents` ](#filecontents )
- [`FileSystemObject` ](#filesystemobject )
- [`WorkspaceEdit` ](#workspaceedit )
2021-05-26 17:08:41 +03:00
- [`EnsoDigest` ](#ensodigest )
- [`FileSegment` ](#filesegment )
2021-07-05 12:23:29 +03:00
- [`ContentRoot` ](#contentroot )
2021-07-13 17:00:55 +03:00
- [`LibraryEntry` ](#libraryentry )
2021-08-20 11:23:05 +03:00
- [`LibraryVersion` ](#libraryversion )
- [`Contact` ](#contact )
2021-07-13 17:00:55 +03:00
- [`EditionReference` ](#editionreference )
2022-03-03 16:28:04 +03:00
- [`LibraryComponentGroups` ](#librarycomponentgroups )
2022-02-24 15:41:14 +03:00
- [`LibraryComponentGroup` ](#librarycomponentgroup )
2022-03-03 16:28:04 +03:00
- [`LibraryComponent` ](#librarycomponent )
2020-05-15 13:41:26 +03:00
- [Connection Management ](#connection-management )
- [`session/initProtocolConnection` ](#sessioninitprotocolconnection )
- [`session/initBinaryConnection` ](#sessioninitbinaryconnection )
- [Capability Management ](#capability-management )
- [`capability/acquire` ](#capabilityacquire )
- [`capability/release` ](#capabilityrelease )
- [`capability/granted` ](#capabilitygranted )
- [`capability/forceReleased` ](#capabilityforcereleased )
- [Capabilities ](#capabilities )
- [`text/canEdit` ](#textcanedit )
- [`file/receivesTreeUpdates` ](#filereceivestreeupdates )
- [`executionContext/canModify` ](#executioncontextcanmodify )
- [`executionContext/receivesUpdates` ](#executioncontextreceivesupdates )
2020-06-26 19:52:42 +03:00
- [`search/receivesSuggestionsDatabaseUpdates` ](#searchreceivessuggestionsdatabaseupdates )
2020-05-15 13:41:26 +03:00
- [File Management Operations ](#file-management-operations )
- [`file/write` ](#filewrite )
- [`file/read` ](#fileread )
- [`file/writeBinary` ](#filewritebinary )
- [`file/readBinary` ](#filereadbinary )
2021-05-26 17:08:41 +03:00
- [`file/writeBytes` ](#filewritebytes )
- [`file/readBytes` ](#filereadbytes )
2020-05-15 13:41:26 +03:00
- [`file/create` ](#filecreate )
- [`file/delete` ](#filedelete )
- [`file/copy` ](#filecopy )
- [`file/move` ](#filemove )
- [`file/exists` ](#fileexists )
- [`file/tree` ](#filetree )
- [`file/list` ](#filelist )
- [`file/info` ](#fileinfo )
2021-05-26 17:08:41 +03:00
- [`file/checksum` ](#filechecksum )
- [`file/checksumBytes` ](#filechecksumbytes )
2020-05-15 13:41:26 +03:00
- [`file/event` ](#fileevent )
- [`file/rootAdded` ](#filerootadded )
- [`file/rootRemoved` ](#filerootremoved )
2022-11-14 20:32:39 +03:00
- [Version Control System ](#vcs-operations )
- [`vcs/init` ](#vcsinit )
- [`vcs/list` ](#vcslist )
- [`vcs/restore` ](#vcsrestore )
- [`vcs/save` ](#vcssave )
- [`vcs/status` ](#vcsstatus )
2020-05-15 13:41:26 +03:00
- [Text Editing Operations ](#text-editing-operations )
- [`text/openFile` ](#textopenfile )
2022-06-20 15:30:33 +03:00
- [`text/openBuffer` ](#textopenbuffer )
2020-05-15 13:41:26 +03:00
- [`text/closeFile` ](#textclosefile )
- [`text/save` ](#textsave )
- [`text/applyEdit` ](#textapplyedit )
2022-06-20 15:30:33 +03:00
- [`text/applyExpressionValue` ](#textapplyexpressionvalue )
2020-05-15 13:41:26 +03:00
- [`text/didChange` ](#textdidchange )
2022-08-11 14:45:12 +03:00
- [`text/autoSave` ](#textautosave )
2023-07-10 19:50:14 +03:00
- [`text/fileModifiedOnDisk` ](#textfilemodifiedondisk )
2020-05-15 13:41:26 +03:00
- [Workspace Operations ](#workspace-operations )
2021-05-27 18:13:52 +03:00
- [`workspace/projectInfo` ](#workspaceprojectinfo )
2020-05-15 13:41:26 +03:00
- [Monitoring ](#monitoring )
- [`heartbeat/ping` ](#heartbeatping )
2020-12-02 18:56:47 +03:00
- [`heartbeat/init` ](#heartbeatinit )
- [Refactoring ](#refactoring )
- [`refactoring/renameProject` ](#refactoringrenameproject )
2023-08-11 00:16:33 +03:00
- [`refactoring/renameSymbol` ](#refactoringrenamesymbol )
2023-08-22 14:32:46 +03:00
- [`refactoring/projectRenamed` ](#refactoringprojectrenamed )
2020-05-15 13:41:26 +03:00
- [Execution Management Operations ](#execution-management-operations )
2020-06-10 17:51:04 +03:00
- [Execution Management Example ](#execution-management-example )
2020-05-15 13:41:26 +03:00
- [Create Execution Context ](#create-execution-context )
- [Push Item ](#push-item )
- [Pop Item ](#pop-item )
- [`executionContext/create` ](#executioncontextcreate )
- [`executionContext/destroy` ](#executioncontextdestroy )
- [`executionContext/fork` ](#executioncontextfork )
- [`executionContext/push` ](#executioncontextpush )
- [`executionContext/pop` ](#executioncontextpop )
- [`executionContext/recompute` ](#executioncontextrecompute )
2022-12-08 03:04:46 +03:00
- [`executionContext/interrupt` ](#executioncontextinterrupt )
2023-04-11 18:12:27 +03:00
- [`executionContext/setExecutionEnvironment` ](#executioncontextsetexecutionenvironment )
2022-04-14 16:12:18 +03:00
- [`executionContext/getComponentGroups` ](#executioncontextgetcomponentgroups )
2021-01-21 17:10:21 +03:00
- [`executionContext/expressionUpdates` ](#executioncontextexpressionupdates )
2020-10-15 16:03:45 +03:00
- [`executionContext/executionFailed` ](#executioncontextexecutionfailed )
2021-08-12 19:26:44 +03:00
- [`executionContext/executionComplete` ](#executioncontextexecutioncomplete )
2020-10-15 16:03:45 +03:00
- [`executionContext/executionStatus` ](#executioncontextexecutionstatus )
2021-05-21 16:19:21 +03:00
- [`executionContext/executeExpression` ](#executioncontextexecuteexpression )
2023-06-26 20:04:35 +03:00
- [`executionContext/attachVisualization` ](#executioncontextattachvisualization )
- [`executionContext/detachVisualization` ](#executioncontextdetachvisualization )
- [`executionContext/modifyVisualization` ](#executioncontextmodifyvisualization )
- [`executionContext/visualizationUpdate` ](#executioncontextvisualizationupdate )
- [`executionContext/visualizationEvaluationFailed` ](#executioncontextvisualizationevaluationfailed )
2020-06-10 17:51:04 +03:00
- [Search Operations ](#search-operations )
2020-12-02 18:56:47 +03:00
- [Suggestions Database Example ](#suggestions-database-example )
2020-06-10 17:51:04 +03:00
- [`search/getSuggestionsDatabase` ](#searchgetsuggestionsdatabase )
2020-12-02 18:56:47 +03:00
- [`search/invalidateSuggestionsDatabase` ](#searchinvalidatesuggestionsdatabase )
2020-06-10 17:51:04 +03:00
- [`search/getSuggestionsDatabaseVersion` ](#searchgetsuggestionsdatabaseversion )
- [`search/suggestionsDatabaseUpdate` ](#searchsuggestionsdatabaseupdate )
2021-06-01 15:43:22 +03:00
- [`search/suggestionsOrderDatabaseUpdate` ](#searchsuggestionsorderdatabaseupdate )
2020-06-10 17:51:04 +03:00
- [`search/completion` ](#searchcompletion )
2021-01-19 13:41:39 +03:00
- [Input/Output Operations ](#inputoutput-operations )
- [`io/redirectStandardOutput` ](#ioredirectstandardoutput )
- [`io/suppressStandardOutput` ](#iosuppressstandardoutput )
2020-06-10 17:51:04 +03:00
- [`io/standardOutputAppended` ](#iostandardoutputappended )
2020-12-02 18:56:47 +03:00
- [`io/redirectStandardError` ](#ioredirectstandarderror )
- [`io/suppressStandardError` ](#iosuppressstandarderror )
2020-06-10 17:51:04 +03:00
- [`io/standardErrorAppended` ](#iostandarderrorappended )
- [`io/feedStandardInput` ](#iofeedstandardinput )
- [`io/waitingForStandardInput` ](#iowaitingforstandardinput )
2021-07-13 17:00:55 +03:00
- [Library-Related Operations ](#library-related-operations )
- [`editions/listAvailable` ](#editionslistavailable )
- [`editions/resolve` ](#editionsresolve )
- [`editions/getProjectSettings` ](#editionsgetprojectsettings )
- [`editions/setProjectParentEdition` ](#editionssetprojectparentedition )
- [`editions/setProjectLocalLibrariesPreference` ](#editionssetprojectlocallibrariespreference )
- [`editions/listDefinedLibraries` ](#editionslistdefinedlibraries )
2022-02-24 15:41:14 +03:00
- [`editions/listDefinedComponents` ](#editionslistdefinedcomponents )
2021-07-13 17:00:55 +03:00
- [`library/listLocal` ](#librarylistlocal )
- [`library/create` ](#librarycreate )
- [`library/getMetadata` ](#librarygetmetadata )
- [`library/setMetadata` ](#librarysetmetadata )
2022-02-24 15:41:14 +03:00
- [`library/getPackage` ](#librarygetpackage )
2021-07-13 17:00:55 +03:00
- [`library/publish` ](#librarypublish )
- [`library/preinstall` ](#librarypreinstall )
2023-08-14 19:49:16 +03:00
- [Runtime Operations ](#runtime-operations )
- [`runtime/getComponentGroups` ](#runtime-getcomponentgroups )
2021-08-20 11:23:05 +03:00
- [Errors ](#errors-75 )
2021-05-26 17:08:41 +03:00
- [`Error` ](#error )
2020-05-15 13:41:26 +03:00
- [`AccessDeniedError` ](#accessdeniederror )
- [`FileSystemError` ](#filesystemerror )
- [`ContentRootNotFoundError` ](#contentrootnotfounderror )
- [`FileNotFound` ](#filenotfound )
2021-07-13 17:00:55 +03:00
- [`FileExists` ](#fileexists )
2020-05-15 13:41:26 +03:00
- [`OperationTimeoutError` ](#operationtimeouterror )
- [`NotDirectory` ](#notdirectory )
2021-05-26 17:08:41 +03:00
- [`NotFile` ](#notfile )
- [`CannotOverwrite` ](#cannotoverwrite )
- [`ReadOutOfBounds` ](#readoutofbounds )
2021-05-27 18:13:52 +03:00
- [`CannotDecode` ](#cannotdecode )
2020-05-15 13:41:26 +03:00
- [`StackItemNotFoundError` ](#stackitemnotfounderror )
- [`ContextNotFoundError` ](#contextnotfounderror )
- [`EmptyStackError` ](#emptystackerror )
- [`InvalidStackItemError` ](#invalidstackitemerror )
- [`ModuleNotFoundError` ](#modulenotfounderror )
2023-06-26 20:04:35 +03:00
- [`VisualizationNotFoundError` ](#visualizationnotfounderror )
- [`VisualizationExpressionError` ](#visualizationexpressionerror )
2020-05-15 13:41:26 +03:00
- [`FileNotOpenedError` ](#filenotopenederror )
- [`TextEditValidationError` ](#texteditvalidationerror )
- [`InvalidVersionError` ](#invalidversionerror )
- [`WriteDeniedError` ](#writedeniederror )
- [`CapabilityNotAcquired` ](#capabilitynotacquired )
- [`SessionNotInitialisedError` ](#sessionnotinitialisederror )
- [`SessionAlreadyInitialisedError` ](#sessionalreadyinitialisederror )
2021-03-04 19:59:05 +03:00
- [`ResourcesInitializationError` ](#resourcesinitializationerror )
2020-07-06 16:55:21 +03:00
- [`SuggestionsDatabaseError` ](#suggestionsdatabaseerror )
2020-12-02 18:56:47 +03:00
- [`ProjectNotFoundError` ](#projectnotfounderror )
- [`ModuleNameNotResolvedError` ](#modulenamenotresolvederror )
2021-01-19 13:41:39 +03:00
- [`SuggestionNotFoundError` ](#suggestionnotfounderror )
2021-07-13 17:00:55 +03:00
- [`EditionNotFoundError` ](#editionnotfounderror )
- [`LibraryAlreadyExists` ](#libraryalreadyexists )
- [`LibraryRepositoryAuthenticationError` ](#libraryrepositoryauthenticationerror )
- [`LibraryPublishError` ](#librarypublisherror )
- [`LibraryUploadError` ](#libraryuploaderror )
- [`LibraryDownloadError` ](#librarydownloaderror )
- [`LocalLibraryNotFound` ](#locallibrarynotfound )
- [`LibraryNotResolved` ](#librarynotresolved )
2021-08-09 17:00:04 +03:00
- [`InvalidLibraryName` ](#invalidlibraryname )
2021-11-23 11:51:17 +03:00
- [`DependencyDiscoveryError` ](#dependencydiscoveryerror )
2022-02-24 15:41:14 +03:00
- [`InvalidSemverVersion` ](#invalidsemverversion )
2023-08-11 00:16:33 +03:00
- [`ExpressionNotFoundError` ](#expressionnotfounderror )
- [`FailedToApplyEdits` ](#failedtoapplyedits )
- [`RefactoringNotSupported` ](#refactoringnotsupported )
2020-05-15 13:41:26 +03:00
<!-- /MarkdownTOC -->
## Types
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
There are a number of types that are used only within the language server's
protocol messages. These are specified here.
### `ExpressionId`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
An identifier used for Enso expressions.
```typescript
type ExpressionId = UUID;
```
### `ContextId`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
An identifier used for execution contexts.
```typescript
type ContextId = UUID;
```
### `StackItem`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
A representation of an executable position in code, used by the execution APIs.
`ExplicitCall` is a call performed at the top of the stack, to initialize the
2020-07-21 15:59:40 +03:00
context with first execution. The `thisArgumentsPosition` field can be omitted,
in which case the context will try to infer the argument on a best-effort basis.
2022-11-02 12:53:40 +03:00
E.g. for a module-level method, or a method defined on a parameter-less type,
`self` will be substituted for the unambiguous singleton instance.
2020-05-15 13:41:26 +03:00
`LocalCall` is a call corresponding to "entering a function call".
```typescript
2020-07-21 15:59:40 +03:00
type StackItem = ExplicitCall | LocalCall;
2020-05-15 13:41:26 +03:00
interface ExplicitCall {
methodPointer: MethodPointer;
thisArgumentExpression?: String;
positionalArgumentsExpressions: String[];
}
interface LocalCall {
expressionId: ExpressionId;
}
```
2023-05-31 18:47:48 +03:00
### `MethodCall`
A representation of a method call.
```typescript
interface MethodCall {
/** The method pointer of a call. */
methodPointer: MethodPointer;
/** Indexes of arguments that have not been applied to this method. */
notAppliedArguments: number[];
}
```
2020-05-15 13:41:26 +03:00
### `MethodPointer`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
Points to a method definition.
```typescript
interface MethodPointer {
2020-08-04 13:31:56 +03:00
/** The fully qualified module name. */
module: String;
/** The type on which the method is defined. */
2020-05-15 13:41:26 +03:00
definedOnType: String;
2020-08-04 13:31:56 +03:00
/** The method name. */
2020-05-15 13:41:26 +03:00
name: String;
}
```
2021-01-19 13:41:39 +03:00
### `ProfilingInfo`
Profiling information on an executed expression. It is implemented as a union as
additional types of information will be added in the future.
```typescript
type ProfilingInfo = ExecutionTime;
```
Where:
```typescript
interface ExecutionTime {
/** The time elapsed during the expression's evaluation, in nanoseconds */
nanoTime: Number;
2020-05-15 13:41:26 +03:00
}
```
2023-04-11 18:12:27 +03:00
### `ExecutionEnvironment`
The execution environment of Enso runtime.
```typescript
type ExecutionEnvironment = Design | Live;
```
2021-01-21 17:10:21 +03:00
### `ExpressionUpdate`
2021-01-25 17:41:20 +03:00
An update about the computed expression.
2021-01-21 17:10:21 +03:00
2021-01-25 17:41:20 +03:00
```typescript
interface ExpressionUpdate {
2021-01-21 17:10:21 +03:00
/**
* The id of updated expression.
*/
expressionId: ExpressionId;
/**
* The updated type of the expression.
*/
type?: String;
/**
2023-05-31 18:47:48 +03:00
* The updated method call info.
2021-01-21 17:10:21 +03:00
*/
2023-05-31 18:47:48 +03:00
methodCall?: MethodCall;
2021-01-25 17:41:20 +03:00
/**
* Profiling information about the expression.
*/
profilingInfo: ProfilingInfo[];
/**
* Wether or not the expression's value came from the cache.
*/
fromCache: bool;
/**
* An extra information about the computed value.
*/
payload: ExpressionUpdatePayload;
2021-01-21 17:10:21 +03:00
}
2021-01-25 17:41:20 +03:00
```
### `ExpressionUpdatePayload`
An information about the computed value.
```typescript
2022-09-28 15:35:12 +03:00
type ExpressionUpdatePayload = Value | DatafalowError | Panic | Pending;
2021-01-21 17:10:21 +03:00
/**
2023-01-28 06:13:38 +03:00
* Indicates that the expression was computed to a value.
2021-01-21 17:10:21 +03:00
*/
2023-01-28 06:13:38 +03:00
interface Value {
/**
* Information about attached warnings.
*/
warnings?: Warnings;
2023-06-30 16:31:48 +03:00
/**
* The schema of returned function value.
*/
functionSchema?: FunctionSchema;
2023-01-28 06:13:38 +03:00
}
2021-01-25 17:41:20 +03:00
/**
* Indicates that the expression was computed to an error.
*/
interface DataflowError {
2021-01-21 17:10:21 +03:00
/**
2021-01-25 17:41:20 +03:00
* The list of expressions leading to the root error.
2021-01-21 17:10:21 +03:00
*/
2021-01-25 17:41:20 +03:00
trace: ExpressionId[];
}
2021-01-21 17:10:21 +03:00
2021-01-25 17:41:20 +03:00
/**
* Indicates that the expression failed with the runtime exception.
*/
2021-02-02 12:02:00 +03:00
interface Panic {
2021-01-21 17:10:21 +03:00
/**
* The error message.
*/
message: String;
2021-01-25 17:41:20 +03:00
/**
* The stack trace.
*/
trace: ExpressionId[];
2021-01-21 17:10:21 +03:00
}
2022-09-28 15:35:12 +03:00
/**
* Indicates the expression is currently being computed. Optionally it
* provides description and percentage (`0.0-1.0`) of completeness.
*/
interface Pending {
/**
* Optional message describing current operation.
*/
message?: String;
/**
* Optional amount of already done work as a number between `0.0` to `1.0` .
*/
progress?: Number;
}
2023-01-28 06:13:38 +03:00
/**
* Information about warnings associated with the value.
*/
interface Warnings {
/**
* The number of attached warnings.
*/
count: number;
/**
* If the value has a single warning attached, this field contains textual
* representation of the attached warning. In general, warning values should
* be obtained by attaching an appropriate visualization to a value.
*/
value?: string;
}
2023-06-30 16:31:48 +03:00
/**
* Contains a method pointer with information on the partially applied argument
* positions.
*/
interface FunctionSchema {
/**
* The method pointer of this function.
*/
methodPointer: MethodPointer;
/**
* Indexes of arguments that have not been applied to this function.
*/
notAppliedArguments: number[];
}
2021-01-21 17:10:21 +03:00
```
2023-06-26 20:04:35 +03:00
### `VisualizationConfiguration`
2020-07-21 15:59:40 +03:00
2023-06-26 20:04:35 +03:00
A configuration object for properties of the visualization.
2020-05-15 13:41:26 +03:00
```typescript
2023-06-26 20:04:35 +03:00
interface VisualizationConfiguration {
/** An execution context of the visualization. */
2020-05-15 13:41:26 +03:00
executionContextId: UUID;
2022-08-10 15:01:33 +03:00
2020-05-15 13:41:26 +03:00
/**
2023-06-27 18:19:42 +03:00
* A qualified name of the module to be used to evaluate the arguments for the visualization expression.
2020-05-15 13:41:26 +03:00
*/
2023-06-27 18:19:42 +03:00
visualizationModule: String;
2022-08-10 15:01:33 +03:00
2023-06-26 20:04:35 +03:00
/** An expression that creates a visualization. */
2022-08-10 15:01:33 +03:00
expression: String | MethodPointer;
2022-09-01 15:33:46 +03:00
/** A list of arguments to pass to the visualization expression. */
positionalArgumentsExpressions?: string[];
2020-05-15 13:41:26 +03:00
}
```
2020-06-10 17:51:04 +03:00
### `SuggestionEntryArgument`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
The argument of a [`SuggestionEntry` ](#suggestionentry ).
#### Format
2020-06-26 19:52:42 +03:00
```typescript
2022-11-02 12:53:40 +03:00
// The argument of a constructor, method or function suggestion.
2020-06-26 19:52:42 +03:00
interface SuggestionEntryArgument {
2022-12-05 16:29:18 +03:00
/** The argument name. */
2020-06-26 19:52:42 +03:00
name: string;
2022-12-05 16:29:18 +03:00
/** The argument type. String 'Any' is used to specify generic types. */
2020-06-26 19:52:42 +03:00
type: string;
2022-12-05 16:29:18 +03:00
/** Indicates whether the argument is lazy. */
2020-06-26 19:52:42 +03:00
isSuspended: bool;
2022-12-05 16:29:18 +03:00
/** Indicates whether the argument has default value. */
2020-06-26 19:52:42 +03:00
hasDefault: bool;
2022-12-05 16:29:18 +03:00
/** Optional default value. */
2020-06-26 19:52:42 +03:00
defaultValue?: string;
2022-12-05 16:29:18 +03:00
/** Optional list of possible values that this argument takes. */
tagValues?: string[];
2020-06-10 17:51:04 +03:00
}
```
### `SuggestionEntry`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
The language construct that can be returned as a suggestion.
#### Format
2020-06-26 19:52:42 +03:00
```typescript
// The definition scope
interface SuggestionEntryScope {
2020-07-20 11:00:49 +03:00
// The start position of the definition scope
start: Position;
// The end position of the definition scope
end: Position;
2020-06-26 19:52:42 +03:00
}
2020-06-10 17:51:04 +03:00
// A type of suggestion entries.
2020-07-30 12:26:14 +03:00
type SuggestionEntry =
2021-07-20 19:10:53 +03:00
// A module
2022-11-02 12:53:40 +03:00
| Module
// A type
| Type
// A type constructor
| Constructor
2020-06-10 17:51:04 +03:00
// A method defined on a type
2022-11-02 12:53:40 +03:00
| Method
2020-06-10 17:51:04 +03:00
// A function
2022-11-02 12:53:40 +03:00
| Function
2020-06-10 17:51:04 +03:00
// A local value
2022-11-02 12:53:40 +03:00
| Local;
2020-06-10 17:51:04 +03:00
2022-11-02 12:53:40 +03:00
interface Module {
2021-07-20 19:10:53 +03:00
/** The fully qualified module name. */
module: string;
/** The documentation string. */
documentation?: string;
/** The fully qualified module name re-exporting this module. */
reexport?: string;
}
2022-11-02 12:53:40 +03:00
interface Type {
2021-07-20 19:10:53 +03:00
/** The external id. */
2020-11-10 14:50:37 +03:00
externalId?: UUID;
2021-07-20 19:10:53 +03:00
2022-11-02 12:53:40 +03:00
/** The type name. */
2020-06-26 19:52:42 +03:00
name: string;
2021-07-20 19:10:53 +03:00
2022-11-02 12:53:40 +03:00
/** The qualified module name where the type is defined. */
module: string;
/** The list of type parameters. */
params: SuggestionEntryArgument[];
2022-11-07 16:21:04 +03:00
/** Qualified name of the parent type. */
parentType?: string;
2022-11-02 12:53:40 +03:00
/** The fully qualified module name re-exporting this type. */
reexport?: string;
/** The documentation string. */
documentation?: string;
}
interface Constructor {
/** The external id. */
externalId?: UUID;
/** The constructor name. */
name: string;
/** The qualified module name where this constructor is defined. */
2020-06-26 19:52:42 +03:00
module: string;
2021-07-20 19:10:53 +03:00
/** The list of arguments. */
2020-11-10 14:50:37 +03:00
arguments: SuggestionEntryArgument[];
2021-07-20 19:10:53 +03:00
2022-11-02 12:53:40 +03:00
/** The type of the constructor. */
2020-06-26 19:52:42 +03:00
returnType: string;
2021-07-20 19:10:53 +03:00
2022-11-02 12:53:40 +03:00
/** The fully qualified module name re-exporting this constructor. */
reexport?: string;
2021-07-20 19:10:53 +03:00
/** The documentation string. */
2020-06-26 19:52:42 +03:00
documentation?: string;
2023-06-02 10:26:01 +03:00
/** The list of annotations. */
annotations: string[];
2020-06-10 17:51:04 +03:00
}
2022-11-02 12:53:40 +03:00
interface Method {
2021-07-20 19:10:53 +03:00
/** The external id. */
2020-11-10 14:50:37 +03:00
externalId?: UUID;
2021-07-20 19:10:53 +03:00
/** The method name. */
2020-06-26 19:52:42 +03:00
name: string;
2021-07-20 19:10:53 +03:00
/** The module name where this method is defined. */
2020-06-26 19:52:42 +03:00
module: string;
2021-07-20 19:10:53 +03:00
/** The list of arguments. */
2020-11-10 14:50:37 +03:00
arguments: SuggestionEntryArgument[];
2021-07-20 19:10:53 +03:00
/** The method self type. */
2020-06-26 19:52:42 +03:00
selfType: string;
2021-07-20 19:10:53 +03:00
/** The return type of this method. */
2020-06-26 19:52:42 +03:00
returnType: string;
2021-07-20 19:10:53 +03:00
2022-10-26 12:12:45 +03:00
/** The flag indicating whether this method is static or instance. */
isStatic: boolean;
2022-11-02 12:53:40 +03:00
/** The fully qualified module name re-exporting this method. */
reexport?: string;
2021-07-20 19:10:53 +03:00
/** The documentation string. */
2020-06-26 19:52:42 +03:00
documentation?: string;
2023-06-02 10:26:01 +03:00
/** The list of annotations. */
annotations: string[];
2020-06-10 17:51:04 +03:00
}
2022-11-02 12:53:40 +03:00
interface Function {
2021-07-20 19:10:53 +03:00
/** The external id. */
2020-11-10 14:50:37 +03:00
externalId?: UUID;
2021-07-20 19:10:53 +03:00
/** The function name. */
2020-06-26 19:52:42 +03:00
name: string;
2021-07-20 19:10:53 +03:00
/** The module name where this function is defined. */
2020-06-26 19:52:42 +03:00
module: string;
2021-07-20 19:10:53 +03:00
/** The list of arguments. */
2020-11-10 14:50:37 +03:00
arguments: SuggestionEntryArgument[];
2021-07-20 19:10:53 +03:00
/** The function return type. */
2020-06-26 19:52:42 +03:00
returnType: string;
2021-07-20 19:10:53 +03:00
/** The scope where the function is defined. */
2020-06-26 19:52:42 +03:00
scope: SuggestionEntryScope;
2023-01-10 19:59:53 +03:00
/** The documentation string. */
documentation?: string;
2020-06-10 17:51:04 +03:00
}
2022-11-02 12:53:40 +03:00
interface Local {
2021-07-20 19:10:53 +03:00
/** The external id. */
2020-11-10 14:50:37 +03:00
externalId?: UUID;
2021-07-20 19:10:53 +03:00
/** The name of a value. */
2020-06-26 19:52:42 +03:00
name: string;
2021-07-20 19:10:53 +03:00
/** The module where this value is defined. */
2020-06-26 19:52:42 +03:00
module: string;
2021-07-20 19:10:53 +03:00
/** The type of a value. */
2020-06-26 19:52:42 +03:00
returnType: string;
2021-07-20 19:10:53 +03:00
/** The scope where the value is defined. */
2020-06-26 19:52:42 +03:00
scope: SuggestionEntryScope;
2023-01-10 19:59:53 +03:00
/** The documentation string. */
documentation?: string;
2020-06-10 17:51:04 +03:00
}
```
### `SuggestionEntryType`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
The suggestion entry type that is used as a filter in search requests.
#### Format
2020-06-26 19:52:42 +03:00
```typescript
2020-06-10 17:51:04 +03:00
// The kind of a suggestion.
2022-11-02 12:53:40 +03:00
type SuggestionEntryType =
| Module
| Type
| Constructor
| Method
| Function
| Local;
2020-06-10 17:51:04 +03:00
```
2020-08-04 13:31:56 +03:00
### `SuggestionId`
The suggestion entry id of the suggestions database.
#### Format
```typescript
type SuggestionId = number;
```
2022-03-25 10:49:37 +03:00
### `SuggestionsDatabaseEntry`
2021-06-01 15:43:22 +03:00
2022-03-25 10:49:37 +03:00
The entry in the suggestions database.
2021-06-01 15:43:22 +03:00
#### Format
```typescript
2022-03-25 10:49:37 +03:00
interface SuggestionsDatabaseEntry {
2021-06-01 15:43:22 +03:00
/**
2022-03-25 10:49:37 +03:00
* The suggestion entry id.
2021-06-01 15:43:22 +03:00
*/
2022-03-25 10:49:37 +03:00
id: SuggestionId;
2021-06-01 15:43:22 +03:00
/**
2022-03-25 10:49:37 +03:00
* The suggestion entry.
2021-06-01 15:43:22 +03:00
*/
2022-03-25 10:49:37 +03:00
suggestion: SuggestionEntry;
2021-06-01 15:43:22 +03:00
}
```
2020-11-10 14:50:37 +03:00
### `FieldAction`
The modifying action on a record field.
#### Format
```typescript
type FieldAction = Remove | Set;
```
### `FieldUpdate`
An object representing a modification of a field in a record.
#### Format
```typescript
interface FieldUpdate< T > {
/**
* The modifying action.
*/
tag: FieldAction;
/**
* The updated value.
*/
value?: T;
}
```
### `SuggestionArgumentUpdate`
An operation applied to the suggestion argument.
#### Format
```typescript
type SuggestionArgumentUpdate = Add | Remove | Modify;
interface Add {
/**
* The position of the argument.
*/
index: int;
/**
* The argument to add.
*/
argument: SuggestionEntryArgument;
}
interface Remove {
/**
* The position of the argument.
*/
index: int;
}
interface Modify {
/**
* The position of the argument.
*/
index: int;
/**
* The name to update.
*/
name?: FieldUpdate< String > ;
/**
* The argument type to update.
*/
reprType?: FieldUpdate< String > ;
/**
* The isSuspended flag to update.
*/
isSuspended?: FieldUpdate< Boolean > ;
/**
* The hasDefault flag to update.
*/
hasDefault?: FieldUpdate< Boolean > ;
/**
* The default value to update.
*/
defaultValue?: FieldUpdate< String > ;
}
```
2020-06-10 17:51:04 +03:00
### `SuggestionsDatabaseUpdate`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
The update of the suggestions database.
#### Format
2020-06-26 19:52:42 +03:00
```typescript
2020-11-10 14:50:37 +03:00
/**
* The kind of the suggestions database update.
*/
2020-07-21 15:59:40 +03:00
type SuggestionsDatabaseUpdate = Add | Remove | Modify;
2020-06-10 17:51:04 +03:00
2020-07-06 16:55:21 +03:00
interface Add {
2020-11-10 14:50:37 +03:00
/**
* Suggestion entry id.
*/
2020-08-04 13:31:56 +03:00
id: SuggestionId;
2020-11-10 14:50:37 +03:00
/**
* Suggestion entry.
*/
2020-07-06 16:55:21 +03:00
suggestion: SuggestionEntry;
2020-06-10 17:51:04 +03:00
}
2020-07-06 16:55:21 +03:00
interface Remove {
2020-11-10 14:50:37 +03:00
/**
* Suggestion entry id.
*/
2020-08-04 13:31:56 +03:00
id: SuggestionId;
2020-07-20 11:00:49 +03:00
}
interface Modify {
2020-11-10 14:50:37 +03:00
/**
* Suggestion entry id.
*/
2020-08-04 13:31:56 +03:00
id: SuggestionId;
2020-11-10 14:50:37 +03:00
/**
* The external id to update.
*/
externalId?: FieldUpdate< UUID > ;
/**
* The list of argument updates.
*/
arguments?: SuggestionArgumentUpdate[];
2021-04-06 14:23:12 +03:00
/**
* The module name to update.
*/
module?: FieldUpdate< String > ;
/**
* The self type to update.
*/
selfType?: FieldUpdate< String > ;
2020-11-10 14:50:37 +03:00
/**
* The return type to update.
*/
returnType?: FieldUpdate< String > ;
/**
* The documentation string to update.
*/
documentation?: FieldUpdate< String > ;
/**
* The scope to update.
*/
scope?: FieldUpdate< SuggestionEntryScope > ;
2021-07-20 19:10:53 +03:00
/**
* The reexport field to update.
*/
reexport?: FieldUpdate< String > ;
2020-07-20 11:00:49 +03:00
}
2020-06-10 17:51:04 +03:00
```
2021-06-01 15:43:22 +03:00
### `SuggestionsOrderDatabaseUpdate`
The update of the suggestions order database.
#### Format
```typescript
/**
* The kind of the suggestions order database update.
*/
type SuggestionsOrderDatabaseUpdate = AddOrder | RemoveOrder | ModifyOrder;
interface AddOrder {
entry: SuggestionOrderDatabaseEntry;
}
interface RemoveOrder {
/**
* The unique identifier of a suggestion.
*/
suggestionId: SuggestionId;
}
interface ModifyOrder {
/**
* The unique identifier of a suggestion.
*/
suggestionId: SuggestionId;
/**
* The previous suggestion id to update.
*/
prevId?: FieldUpdate< SuggestionId > ;
/**
* The next suggestion id to update.
*/
nextId?: FieldUpdate< SuggestionId > ;
}
```
2020-11-26 18:44:35 +03:00
### `Export`
The info about module re-export.
#### Format
```typescript
type Export = Qualified | Unqualified;
interface Qualified {
/**
* The module that re-exports the given module.
*/
module: String;
/**
* The new name of the given module if it was renamed in the export clause.
*
* I.e. `X` in `export A.B as X` .
*/
alias?: String;
}
interface Unqualified {
/**
* The module name that re-exports the given module.
*/
module: String;
}
```
2020-05-15 13:41:26 +03:00
### `File`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
A representation of a file on disk.
#### Format
```typescript
interface File {
name: String; // Includes the file extension
type: String;
}
```
### `DirectoryTree`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
A directory tree is a recursive type used to represent tree structures of files
and directories. It contains files and symlinks in the `files` section and
directories in the `directories` section. When the tree was requested with the
parameter limiting the maximum depth, the bottom of the `DirectoryTree` will
contain `Directory` node in the `files` section indicating that there is a
directory, but the contents are unknown because we've reached the maximum depth.
#### Format
```typescript
interface DirectoryTree {
path: Path;
name: String;
files: [FileSystemObject];
directories: [DirectoryTree];
}
```
### `FileAttributes`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
A description of the attributes of a file required by the IDE. These attributes
may be expanded in future.
#### Format
```typescript
/**
* A representation of the attributes of a file.
*
* @param creationTime creation time
* @param lastAccessTime last access time
* @param lastModifiedTime last modified time
2021-05-26 17:08:41 +03:00
* @param kind type of [[FileSystemObject]], can be: `Directory` , `File` , `Other`
2020-05-15 13:41:26 +03:00
* @param byteSize size in bytes
*/
interface FileAttributes {
creationTime: UTCDateTime;
lastAccessTime: UTCDateTime;
lastModifiedTime: UTCDateTime;
kind: FileSystemObject;
byteSize: number;
}
```
### `UTCDateTime`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
Time in UTC time zone represented as ISO-8601 string
#### Format
```typescript
type UTCDateTime = String;
```
### `FileEventKind`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
The kind of event being described for a watched file.
#### Format
```typescript
type FileEventKind = Added | Removed | Modified;
```
### `Position`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
A representation of a position in a text file.
#### Format
```typescript
interface Position {
/**
* Line position in a document (zero-based).
*/
line: number;
/**
* Character offset on a line in a document (zero-based). Assuming that the
* line is represented as a string, the `character` value represents the gap
* between the `character` and `character + 1` .
*
* If the character value is greater than the line length it defaults back to
* the line length.
*/
character: number;
}
```
2020-07-21 15:59:40 +03:00
```idl
2020-06-10 17:51:04 +03:00
namespace org.enso.languageserver.protocol.binary;
struct Position {
// Line position in a document (zero-based)
line: uint64;
// Character offset on a line in a document (zero-based)
character: uint64;
}
```
2020-05-15 13:41:26 +03:00
### `Range`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
A representation of a range of text in a text file.
2022-02-22 13:21:24 +03:00
For example, given the function.
```
0|inc x =
1| x + 1
^^^^^^^^^
012345678
```
The range of `inc` is
```typescript
{
start: { line: 0, character: 0},
end: { line: 0, character: 3}
}
```
The range of `1` is
```typescript
{
start: { line: 1, character: 8},
end: { line: 1, character: 9}
}
```
2020-05-15 13:41:26 +03:00
#### Format
```typescript
interface Range {
/**
2022-02-22 13:21:24 +03:00
* The range's start position (inclusive).
2020-05-15 13:41:26 +03:00
*/
start: Position;
/**
2022-02-22 13:21:24 +03:00
* The range's end position (exclusive).
2020-05-15 13:41:26 +03:00
*/
end: Position;
}
```
### `TextEdit`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
A representation of a change to a text file at a given position.
#### Format
```typescript
interface TextEdit {
2022-06-20 15:30:33 +03:00
/** The range of text in a text file. */
2020-05-15 13:41:26 +03:00
range: Range;
2022-06-20 15:30:33 +03:00
/** The change to a text file. */
text: string;
2020-05-15 13:41:26 +03:00
}
```
2020-10-15 16:03:45 +03:00
### `DiagnosticType`
The type of diagnostic message.
#### Format
```typescript
type DiagnosticType = Error | Warning;
```
### `StackTraceElement`
The frame of the stack trace. If the error refer to a builtin node, the `path`
and `location` fields will be empty.
#### Format
```typescript
interface StackTraceElement {
/**
* The function name containing the stack trace element.
*/
functionName: String;
/**
* The location of the file.
*/
path?: Path;
/**
* The location of the element in a file.
*/
location?: Range;
}
```
2023-06-29 10:35:28 +03:00
### `ExecutionResult`
An execution result object is produced as a result of an execution attempt.
Compared to `Diagnostic` object it can also represent a critical failure
information.
2020-10-15 16:03:45 +03:00
### `Diagnostic`
A diagnostic object is produced as a result of an execution attempt, like
pushing the method pointer to a call stack, or editing the file. It can
represent a compiler warning, a compilation error, or a runtime error. The
message has optional `path` , `location` and `stack` fields containing
information about the location in the source code.
In case of the runtime errors, the `path` and `location` fields may be empty if
the error happens in a builtin node. Then, to locate the error in the code, you
can use the `stack` field with a stack trace to find the first element with
non-empty location (as the head of the stack will point to the builtin element).
#### Format
```typescript
interface Diagnostic {
/**
* The type of diagnostic message.
*/
kind: DiagnosticType;
/**
* The diagnostic message.
*/
message: String;
/**
* The location of a file containing the diagnostic.
*/
path?: Path;
/**
* The location of the diagnostic object in a file.
*/
location?: Range;
2021-01-25 17:41:20 +03:00
/**
* The id of related expression.
*/
expressionId?: ExpressionId;
2020-10-15 16:03:45 +03:00
/**
* The stack trace.
*/
stack: StackTraceElement[];
}
```
2020-05-15 13:41:26 +03:00
### `SHA3-224`
2020-07-21 15:59:40 +03:00
2021-05-26 17:08:41 +03:00
The `SHA3-224` message digest encoded as a base16 string. For the equivalent
structure on the binary connection please see [`EnsoDigest` ](#ensodigest )
2020-05-15 13:41:26 +03:00
#### Format
2020-07-21 15:59:40 +03:00
```typescript
2020-05-15 13:41:26 +03:00
type SHA3-224 = String;
```
### `FileEdit`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
A representation of a batch of edits to a file, versioned.
`SHA3-224` represents hash of the file contents. `oldVersion` is the version
you're applying your update on, `newVersion` is what you compute as the hash
after applying the changes. In other words,
2020-07-21 15:59:40 +03:00
```python
2020-05-15 13:41:26 +03:00
hash(origFile) == oldVersion
hash(applyEdits(origFile, edits)) == newVersion
```
it's a sanity check to make sure that the diffs are applied consistently.
2020-05-22 18:23:39 +03:00
Consecutive text edits are applied sequentially, every one acting on the result
of applying previous ones on the original buffer contents. In pseudocode:
```haskell
applyEdits buffer [] = buffer
applyEdits buffer (first : rest) = applyEdits (applyTextEdit buffer first) rest
```
2020-05-15 13:41:26 +03:00
#### Format
```typescript
interface FileEdit {
path: Path;
edits: [TextEdit];
oldVersion: SHA3-224;
newVersion: SHA3-224;
}
```
### `FileContents`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
A representation of the contents of a file.
#### Format
```typescript
2021-06-16 13:00:42 +03:00
interface FileContents< T > {
2020-05-15 13:41:26 +03:00
contents: T;
}
2021-06-16 13:00:42 +03:00
class TextFileContents extends FileContents< String > {}
2020-05-15 13:41:26 +03:00
```
### `FileSystemObject`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
A representation of what kind of type a filesystem object can be.
#### Format
```typescript
2020-07-21 15:59:40 +03:00
type FileSystemObject = Directory | SymlinkLoop | File | Other;
2020-05-15 13:41:26 +03:00
/**
* Represents a directory.
*
* @param name a name of the directory
* @param path a path to the directory
*/
interface Directory {
name: String;
path: Path;
}
/**
* Represents a symbolic link that creates a loop.
*
* @param name a name of the symlink
* @param path a path to the symlink
* @param target a target of the symlink. Since it is a loop,
* target is a subpath of the symlink
*/
interface SymlinkLoop {
name: String;
path: Path;
target: Path;
}
/**
* Represents a file.
*
* @param name a name of the file
* @param path a path to the file
*/
interface File {
name: String;
path: Path;
}
/**
* Represents unrecognized object.
* Example is a broken symbolic link.
*/
interface Other {
name: String;
path: Path;
}
```
### `WorkspaceEdit`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This is a message to be specified once we better understand the intricacies of
undo/redo.
> The actionables for this section are:
>
> - Work out the design of this message.
> - Specify this message.
2021-05-26 17:08:41 +03:00
### `EnsoDigest`
A counterpart to [SHA3-224 ](#sha3-224 ) for the binary connection, this is a
standard message digest encoded using FlatBuffers.
```idl
namespace org.enso.languageserver.protocol.binary;
table EnsoDigest {
2021-05-28 15:27:41 +03:00
bytes : [ubyte] (required);
2021-05-26 17:08:41 +03:00
}
```
Notes:
- It is an error for the length of the vector `bytes` to not be equal to 28 (224
/ 8). This is the length of the chosen digest in bytes.
### `FileSegment`
A representation of a segment of a file for use in the binary protocol.
```idl
namespace org.enso.languageserver.protocol.binary;
table FileSegment {
// The file to access.
path : Path (required);
// The byte offset in the file to read from.
2021-05-28 15:27:41 +03:00
byteOffset : ulong;
2021-05-26 17:08:41 +03:00
// The number of bytes to read.
2021-05-28 15:27:41 +03:00
length : ulong;
2021-05-26 17:08:41 +03:00
}
```
The `byteOffset` property is zero-indexed, so the last byte in the file is at
index `file.length - 1` .
2021-06-16 13:00:42 +03:00
### `ContentRoot`
A representation of a content root for use in the IDE. A content root represents
a location on a real file-system that has been virtualised for use in the Enso
VFS.
```typescript
2021-07-05 12:23:29 +03:00
type ContentRoot = Project | FileSystemRoot | Home | Library | Custom;
```
```typescript
/** This content root points to the project home. */
interface Project {
2021-06-16 13:00:42 +03:00
// A unique identifier for the content root.
id: UUID;
2021-07-05 12:23:29 +03:00
}
2021-06-16 13:00:42 +03:00
2021-07-05 12:23:29 +03:00
/**
* This content root points to the system root (`/`) on unix systems, or to a
* drive root on Windows. In Windows' case, there may be multiple `Root` entries
* corresponding to the various drives.
*/
interface FileSystemRoot {
// A unique identifier for the content root.
id: UUID;
// The absolute filesystem path of the content root.
path: String;
}
/** The user's home directory. */
interface Home {
// A unique identifier for the content root.
id: UUID;
2021-06-16 13:00:42 +03:00
}
2021-07-05 12:23:29 +03:00
/** An Enso library location. */
interface Library {
// A unique identifier for the content root.
id: UUID;
2021-06-16 13:00:42 +03:00
2021-07-05 12:23:29 +03:00
// The namespace of the library.
namespace: String;
2021-06-16 13:00:42 +03:00
2021-07-05 12:23:29 +03:00
// The name of the library.
name: String;
2021-06-16 13:00:42 +03:00
2021-07-05 12:23:29 +03:00
/**
* The version of the library.
*
* It is either a semver version of the library or the string "local".
*/
version: String;
}
2021-06-16 13:00:42 +03:00
2021-07-05 12:23:29 +03:00
/** A content root that has been added by the IDE (unused for now). */
interface Custom {
// A unique identifier for the content root.
id: UUID;
}
```
2021-06-16 13:00:42 +03:00
2021-07-13 17:00:55 +03:00
### `LibraryEntry`
Represents a library available in a resolved edition.
```typescript
interface LibraryEntry {
namespace: String;
name: String;
version: LibraryVersion;
2021-08-19 18:21:31 +03:00
isCached: Boolean;
2021-07-13 17:00:55 +03:00
}
```
2021-08-20 11:23:05 +03:00
### `LibraryVersion`
Represents a library version, as returned in `LibraryEntry` .
2021-07-13 17:00:55 +03:00
```typescript
type LibraryVersion = LocalLibraryVersion | PublishedLibraryVersion;
/** A library version that references a version of the library published in some
* repository.
*/
interface PublishedLibraryVersion {
// A semver-compliant version of the library.
version: String;
// URL to the repository that this library will be downloaded from.
repositoryUrl: String;
}
// A library version that references a locally editable version of the library.
interface LocalLibraryVersion {}
```
2021-08-20 11:23:05 +03:00
### `Contact`
Represents contact information of authors or maintainers.
Both fields are optional, but for the contact to be valid, at least one of them
must be defined.
```typescript
interface Contact {
name?: String;
email?: String;
}
```
2021-07-13 17:00:55 +03:00
### `EditionReference`
A reference to a specific edition.
Currently, it can either reference an edition by its name, or reference the
edition associated with the currently open project.
```typescript
type EditionReference = NamedEdition | CurrentProjectEdition;
// The edition associated with the current project, with all of its overrides.
interface CurrentProjectEdition {}
// An edition stored under a given name.
interface NamedEdition {
editionName: String;
}
```
2022-03-03 16:28:04 +03:00
### `LibraryComponentGroups`
2022-02-24 15:41:14 +03:00
The description of component groups provided by the package. Object fields can
be omitted if the corresponding list is empty.
```typescript
2022-03-03 16:28:04 +03:00
interface LibraryComponentGroups {
2022-02-24 15:41:14 +03:00
/** The list of component groups provided by the package. */
2022-03-03 16:28:04 +03:00
newGroups?: LibraryComponentGroup[];
2022-02-24 15:41:14 +03:00
/** The list of component groups that this package extends.*/
2022-03-03 16:28:04 +03:00
extendedGroups?: LibraryComponentGroup[];
2022-02-24 15:41:14 +03:00
}
```
2022-03-03 16:28:04 +03:00
### `LibraryComponentGroup`
2022-02-24 15:41:14 +03:00
2022-03-03 16:28:04 +03:00
The component group provided by a library.
2022-02-24 15:41:14 +03:00
```typescript
2022-03-03 16:28:04 +03:00
interface LibraryComponentGroup {
/**
2022-06-03 20:18:20 +03:00
* The fully qualified library name. A string consisting of a namespace and
2022-03-03 16:28:04 +03:00
* a library name separated by the dot < namespace > .< library name > ,
* i.e. `Standard.Base` .
*/
library: string;
2022-04-14 16:12:18 +03:00
/** The group name without the library name prefix.
* E.g. given the `Standard.Base.Group 1` group reference,
2022-06-03 20:18:20 +03:00
* the `name` field contains `Group 1` .
2022-03-03 16:28:04 +03:00
*/
2022-06-03 20:18:20 +03:00
name: string;
2022-02-24 15:41:14 +03:00
color?: string;
icon?: string;
/** The list of components provided by this component group. */
2022-03-03 16:28:04 +03:00
exports: LibraryComponent[];
2022-02-24 15:41:14 +03:00
}
```
2022-03-03 16:28:04 +03:00
### `LibraryComponent`
2022-02-24 15:41:14 +03:00
A single component of a component group.
```typescript
2022-03-03 16:28:04 +03:00
interface LibraryComponent {
2022-02-24 15:41:14 +03:00
/** The component name. */
name: string;
/** The component shortcut. */
shortcut?: string;
}
```
2020-05-15 13:41:26 +03:00
## Connection Management
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
In order to properly set-up and tear-down the language server connection, we
need a set of messages to control this process.
### `session/initProtocolConnection`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This message initialises the connection used to send the textual protocol
messages. This initialisation is important such that the client identifier can
be correlated between the textual and data connections.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
clientId: UUID;
}
```
#### Result
```typescript
{
2021-06-21 12:46:19 +03:00
contentRoots: [ContentRoot];
2020-05-15 13:41:26 +03:00
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`SessionAlreadyInitialisedError` ](#sessionalreadyinitialisederror ) to signal
2020-07-21 15:59:40 +03:00
that session is already initialised.
2021-03-04 19:59:05 +03:00
- [`ResourcesInitializationError` ](#resourcesinitializationerror ) to signal
about the error during the initialization of Language Server resources.
2020-05-15 13:41:26 +03:00
### `session/initBinaryConnection`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This message initialises the data connection used for transferring binary data
between engine and clients. This initialisation is important such that the
client identifier can be correlated between the data and textual connections.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Data
- **Visibility:** Public
#### Parameters
```idl
namespace org.enso.languageserver.protocol.binary;
//A command initializing a data session.
table InitSessionCommand {
//A unique identifier of a client initializing the session.
identifier: EnsoUUID (required);
}
root_type InitSessionCommand;
```
#### Result
```
namespace org.enso.languageserver.protocol.binary;
//Indicates an operation has succeeded.
table Success {}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
N/A
## Capability Management
2020-07-21 15:59:40 +03:00
In order to mediate between multiple clients properly, the language server has a
robust notion of capability management to grant and remove permissions from
2020-05-15 13:41:26 +03:00
clients.
### `capability/acquire`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This requests that the server grant the specified capability to the requesting
client.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
method: String;
registerOptions?: any;
}
```
The `registerOptions` are determined by the `method` . The method must be listed
in the section on [capabilities ](#capabilities ) below.
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
TBC
### `capability/release`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This requests that the server acknowledge that the client is releasing a given
capability.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
registration: CapabilityRegistration;
}
```
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
TBC
### `capability/granted`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This notifies the client that it has been granted a capability without any
action on its part.
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
registration: CapabilityRegistration;
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
TBC
### `capability/forceReleased`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This notifies the client that a capability has been forcibly removed from its
capability set.
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
registration: CapabilityRegistration;
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
TBC
## Capabilities
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
The capability management features work with the following capabilities.
### `text/canEdit`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This capability states that the capability has the ability to perform both
`text/applyEdit` and `text/save` for the specified file.
- **method:** `text/canEdit`
- **registerOptions:** `{path: Path;}`
#### Enables
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`text/applyEdit` ](#textapplyedit )
- [`text/save` ](#textsave )
#### Disables
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
None
### `file/receivesTreeUpdates`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This capability states that the client will receive updates for any watched
content roots in the current project.
- **method:** `file/receivesTreeUpdates`
- **registerOptions:** `{ path: Path; }`
#### Enables
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`file/event` ](#fileevent )
#### Disables
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
None
#### Errors
[`capability/acquire` ](#capabilityacquire ):
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
- [`FileNotFound` ](#filenotfound ) informs that path cannot be found.
[`capability/release` ](#capabilityrelease ):
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`CapabilityNotAcquired` ](#capabilitynotacquired ) informs that requested
capability is not acquired.
### `executionContext/canModify`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This capability states that the client has the ability to modify an execution
context, including modifying the execution stack, invalidating caches, or
destroying the context.
- **method:** `executionContext/canModify`
2020-07-21 15:59:40 +03:00
- **registerOptions:** `{ contextId: ContextId; }`
2020-05-15 13:41:26 +03:00
#### Enables
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`executionContext/destroy` ](#executioncontextdestroy )
- [`executionContext/recompute` ](#executioncontextrecompute )
2022-12-08 03:04:46 +03:00
- [`executionContext/interrupt` ](#executioncontextinterrupt )
2020-05-15 13:41:26 +03:00
- [`executionContext/push` ](#executioncontextpush )
- [`executionContext/pop` ](#executioncontextpop )
2021-05-21 16:19:21 +03:00
- [`executionContext/executeExpression` ](#executioncontextexecuteexpression )
2023-06-26 20:04:35 +03:00
- [`executionContext/attachVisualization` ](#executioncontextattachvisualization )
- [`executionContext/modifyVisualization` ](#executioncontextmodifyvisualization )
- [`executionContext/detachVisualization` ](#executioncontextdetachvisualization )
- [`executionContext/visualizationUpdate` ](#executioncontextvisualizationupdate )
- [`executionContext/visualizationEvaluationFailed` ](#executioncontextvisualizationevaluationfailed )
2020-05-15 13:41:26 +03:00
#### Disables
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
None
### `executionContext/receivesUpdates`
2020-07-21 15:59:40 +03:00
This capability states that the client receives expression value updates from a
given execution context.
2020-05-15 13:41:26 +03:00
- **method:** `executionContext/receivesUpdates`
2020-06-10 17:51:04 +03:00
- **registerOptions:** `{ contextId: ContextId; }`
2020-05-15 13:41:26 +03:00
#### Enables
2020-07-21 15:59:40 +03:00
2021-01-21 17:10:21 +03:00
- [`executionContext/expressionUpdates` ](#executioncontextexpressionupdates )
2020-10-15 16:03:45 +03:00
- [`executionContext/executionFailed` ](#executioncontextexecutionfailed )
- [`executionContext/executionStatus` ](#executioncontextexecutionstatus )
2020-05-15 13:41:26 +03:00
#### Disables
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
None
2020-06-10 17:51:04 +03:00
### `search/receivesSuggestionsDatabaseUpdates`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
This capability states that the client receives the search database updates for
a given execution context.
- **method:** `search/receivesSuggestionsDatabaseUpdates`
2020-06-26 19:52:42 +03:00
- **registerOptions:** `{}`
2020-06-10 17:51:04 +03:00
2021-05-26 17:08:41 +03:00
#### Enables
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
- [`search/suggestionsDatabaseUpdate` ](#suggestionsdatabaseupdate )
2021-06-01 15:43:22 +03:00
- [`search/suggestionsOrderDatabaseUpdate` ](#suggestionsorderdatabaseupdate )
2020-06-10 17:51:04 +03:00
2021-05-26 17:08:41 +03:00
#### Disables
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
None
2020-05-15 13:41:26 +03:00
## File Management Operations
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
The language server also provides file operations to the IDE.
### `file/write`
2020-07-21 15:59:40 +03:00
This requests that the file manager component write to a specified file with the
specified contents.
2020-05-15 13:41:26 +03:00
- **Type:** Request
- **Direction:** Client -> Server
This request is _explicitly_ allowed to write to files that do not exist, and
will create them under such circumstances. If a file is recorded as 'open' by
2020-07-21 15:59:40 +03:00
one of the clients, and another client attempts to write to that file, the write
must fail.
2020-05-15 13:41:26 +03:00
#### Parameters
```typescript
{
path: Path;
2021-06-16 13:00:42 +03:00
contents: FileContents< T > ;
2020-05-15 13:41:26 +03:00
}
```
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
- [`ContentRootNotFoundError` ](#contentrootnotfounderror ) to signal that the
requested content root cannot be found.
- [`AccessDeniedError` ](#accessdeniederror ) to signal that a user doesn't have
access to a resource.
### `file/read`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This requests that the file manager component reads the contents of a specified
file.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
If the file is recorded as open by the language server, then the result will
return the contents from the in-memory buffer rather than the file on disk.
#### Parameters
```typescript
{
path: Path;
}
```
#### Result
```typescript
{
2021-06-16 13:00:42 +03:00
contents: FileContents< T > ;
2020-05-15 13:41:26 +03:00
}
```
#### Errors
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
- [`ContentRootNotFoundError` ](#contentrootnotfounderror ) to signal that the
requested content root cannot be found.
- [`AccessDeniedError` ](#accessdeniederror ) to signal that a user doesn't have
access to a resource.
- [`FileNotFound` ](#filenotfound ) informs that file cannot be found.
### `file/writeBinary`
2020-07-21 15:59:40 +03:00
This requests that the file manager component write to a specified file with the
binary contents.
2020-05-15 13:41:26 +03:00
- **Type:** Request
- **Connection:** Binary
- **Direction:** Client -> Server
This request is _explicitly_ allowed to write to files that do not exist, and
will create them under such circumstances. If a file is recorded as 'open' by
2020-07-21 15:59:40 +03:00
one of the clients, and another client attempts to write to that file, the write
must fail.
2020-05-15 13:41:26 +03:00
#### Parameters
```idl
namespace org.enso.languageserver.protocol.binary;
//A command writing binary contents to a file.
table WriteFileCommand {
//A path to a file.
path: Path;
//Binary contents.
contents: [ubyte];
}
```
#### Result
```idl
namespace org.enso.languageserver.protocol.binary;
//Indicates an operation has succeeded.
table Success {}
```
#### Errors
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
- [`ContentRootNotFoundError` ](#contentrootnotfounderror ) to signal that the
requested content root cannot be found.
- [`AccessDeniedError` ](#accessdeniederror ) to signal that a user doesn't have
access to a resource.
### `file/readBinary`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This requests that the file manager component reads the binary contents of a
specified file.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Binary
- **Visibility:** Public
If the file is recorded as open by the language server, then the result will
return the contents from the in-memory buffer rather than the file on disk.
#### Parameters
```idl
namespace org.enso.languageserver.protocol.binary;
//A command reading binary contents from a file.
table ReadFileCommand {
//A path to a file.
path: Path;
}
```
#### Result
```idl
namespace org.enso.languageserver.protocol.binary;
//A reply for a ReadFileCommand.
table FileContentsReply {
//Binary contents.
contents: [ubyte];
}
```
#### Errors
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
- [`ContentRootNotFoundError` ](#contentrootnotfounderror ) to signal that the
requested content root cannot be found.
- [`AccessDeniedError` ](#accessdeniederror ) to signal that a user doesn't have
access to a resource.
- [`FileNotFound` ](#filenotfound ) informs that file cannot be found.
2021-05-26 17:08:41 +03:00
### `file/writeBytes`
This requests that the file manager component writes a set of bytes to the
specified file at the specified offset.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Binary
- **Visibility:** Public
This method will create a file if no file is present at `path` .
- The `overwriteExisting` boolean should be set if `byteOffset` is less than the
length of the file.
- The `byteOffset` property is zero-indexed. To append to the file you begin
writing at index `file.length` .
2021-06-11 16:48:28 +03:00
- If `byteOffset` is less than the length of the file and `overwriteExisting` is
set, it will truncate the file to length `byteOffset + bytes.length` .
2021-05-26 17:08:41 +03:00
- If `byteOffset > file.length` , the bytes in the range
2021-06-11 16:48:28 +03:00
`[file.length, byteOffset)` will be filled with null bytes. Please note that,
in this case, the checksum in the response will also be calculated on the null
bytes.
2021-05-26 17:08:41 +03:00
#### Parameters
```idl
namespace org.enso.languageserver.protocol.binary;
2021-05-28 15:27:41 +03:00
table WriteBytesCommand {
2021-05-26 17:08:41 +03:00
// The file to write to.
path : Path (required);
// The byte offset in the file to write from.
2021-05-28 15:27:41 +03:00
byteOffset : ulong;
2021-05-26 17:08:41 +03:00
// Whether existing content should be overwritten.
2021-05-28 15:27:41 +03:00
overwriteExisting : bool;
2021-05-26 17:08:41 +03:00
// The file contents.
bytes : [ubyte] (required);
}
```
#### Result
```idl
namespace org.enso.languageserver.protocol.binary;
2021-05-28 15:27:41 +03:00
table WriteBytesReply {
2021-05-26 17:08:41 +03:00
// The checksum of the written bytes.
checksum : EnsoDigest (required);
}
```
Notes:
- The `checksum` is only of the `bytes` in the request as they were written to
disk. This does _not_ include checksumming the entire file. For that, please
see [`file/checksumBytes` ](#file-checksumbytes ).
#### Errors
- [`CannotOverwrite` ](#cannotoverwrite ) to signal that an overwrite would be
necessary to perform the operation but that `overwriteExisting` is not set.
- [`NotFile` ](#notfile ) if the provided `segment.path` is not a file.
### `file/readBytes`
Asks the language server to read the specified number of bytes at the specified
offset in the file.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Binary
- **Visibility:** Public
It will attempt to read _as many as_ `segment.length` bytes, but does not
guarantee that the response will contain `segment.length` bytes (e.g. if
`segment.length` would require reading off the end of the file).
#### Parameters
```idl
namespace org.enso.languageserver.protocol.binary;
2021-05-28 15:27:41 +03:00
table ReadBytesCommand {
2021-05-26 17:08:41 +03:00
// The segment in a file to read bytes from.
segment : FileSegment (required);
}
```
#### Result
```idl
namespace org.enso.languageserver.protocol.binary;
2021-05-28 15:27:41 +03:00
table ReadBytesReply {
2021-05-26 17:08:41 +03:00
// The checksum of the bytes in this response.
checksum : EnsoDigest (required);
// The requested file contents.
bytes : [ubyte] (required);
}
```
Notes:
- The `checksum` is of the `bytes` as they have been read from disk.
#### Errors
- [`FileNotFound` ](#filenotfound ) if the file at `segment.path` does not exist.
- [`ReadOutOfBounds` ](#readoutofbounds ) if `segment.byteOffset` is not present
in the file at `segment.path` .
- [`NotFile` ](#notfile ) if the provided `segment.path` is not a file.
2020-05-15 13:41:26 +03:00
### `file/create`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This request asks the file manager to create the specified file system object.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
This will fail if the specified object already exists.
#### Parameters
```typescript
{
object: FileSystemObject;
}
```
#### Response
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
- [`ContentRootNotFoundError` ](#contentrootnotfounderror ) to signal that the
requested content root cannot be found.
- [`AccessDeniedError` ](#accessdeniederror ) to signal that a user doesn't have
access to a resource.
### `file/delete`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This request asks the file manager to delete the specified file system object.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
path: Path;
}
```
#### Result
```
null
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
- [`ContentRootNotFoundError` ](#contentrootnotfounderror ) to signal that the
requested content root cannot be found.
- [`FileNotFound` ](#filenotfound ) informs that file cannot be found.
- [`FileExists` ](#fileexists ) informs that file already exists
### `file/copy`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This request asks the file manager to copy a specified filesystem object to
another location.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
from: Path;
to: Path;
}
```
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
- [`ContentRootNotFoundError` ](#contentrootnotfounderror ) to signal that the
requested content root cannot be found.
- [`FileNotFound` ](#filenotfound ) informs that file cannot be found.
### `file/move`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This request asks the file manager to move a specified filesystem object to
another location.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
The move should be specified by filesystem events, and such notifications should
inform the client that the currently edited file has been moved.
#### Parameters
```typescript
{
from: Path;
to: Path;
}
```
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
- [`ContentRootNotFoundError` ](#contentrootnotfounderror ) to signal that the
requested content root cannot be found.
- [`FileNotFound` ](#filenotfound ) informs that file cannot be found.
- [`FileExists` ](#fileexists ) informs that target file already exists.
### `file/exists`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This request asks the file manager to check whether a filesystem object exists
at the specified path.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
path: Path;
}
```
#### Result
```typescript
{
exists: Boolean;
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`ContentRootNotFoundError` ](#contentrootnotfounderror ) to signal that the
requested content root cannot be found.
### `file/tree`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This request asks the file manager component to generate and provide the
directory tree starting at a given path.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
path: Path;
2020-06-10 17:51:04 +03:00
depth?: Number;
2020-05-15 13:41:26 +03:00
}
```
#### Result
```typescript
{
tree: DirectoryTree;
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`ContentRootNotFoundError` ](#contentrootnotfounderror ) to signal that the
requested content root cannot be found.
- [`FileNotFound` ](#filenotfound ) informs that requested path does not exist or
provided depth argument is < = 0.
- [`NotDirectory` ](#notdirectory ) informs that requested path is not a
directory.
### `file/list`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This request lists the contents of a given filesystem object. For a file it will
just return the file, while for a directory it will list the contents of the
directory.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
path: Path;
}
```
#### Result
```typescript
{
paths: [FileSystemObject];
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`ContentRootNotFoundError` ](#contentrootnotfounderror ) to signal that the
requested content root cannot be found.
- [`FileNotFound` ](#filenotfound ) informs that requested path does not exist.
- [`NotDirectory` ](#notdirectory ) informs that requested path is not a
directory.
### `file/info`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This request gets information about a specified filesystem object.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
This request should work for all kinds of filesystem object.
#### Parameters
```typescript
{
path: Path;
}
```
#### Result
```typescript
{
attributes: FileAttributes;
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`ContentRootNotFoundError` ](#contentrootnotfounderror ) to signal that the
requested content root cannot be found.
- [`FileNotFound` ](#filenotfound ) informs that requested path does not exist.
2021-05-26 17:08:41 +03:00
### `file/checksum`
Requests that the language server provide the checksum of the provided file.
Only defined when the provided `path` is a file.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
It calculates the checksum of the entire file.
#### Parameters
```typescript
interface ChecksumRequest {
// The path to the file to get the checksum for.
path: Path;
}
```
#### Result
```typescript
interface ChecksumResponse {
// The checksum of the file at `path` .
checksum : SHA3-224;
}
```
#### Errors
- [`FileNotFound` ](#filenotfound ) if the file at `path` does not exist.
- [`NotFile` ](#notfile ) if the provided `path` does not point to a file.
### `file/checksumBytes`
Requests that the language server provides the checksum of the provided byte
range.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Binary
- **Visibility:** Public
#### Parameters
```idl
namespace org.enso.languageserver.protocol.binary;
2021-05-28 15:27:41 +03:00
table ChecksumBytesCommand {
2021-05-26 17:08:41 +03:00
// The segment in a file to checksum.
segment : FileSegment (required);
}
```
#### Result
```idl
namespace org.enso.languageserver.protocol.binary;
2021-05-28 15:27:41 +03:00
table ChecksumBytesReply {
2021-05-26 17:08:41 +03:00
// The segment in a file to checksum.
checksum : EnsoDigest;
}
```
#### Errors
- [`FileNotFound` ](#filenotfound ) if the file at `segment.path` does not exist.
- [`ReadOutOfBounds` ](#readoutofbounds ) if `segment.byteOffset` is not present
in the file at `segment.path` , or if `segment.length` does not fit within the
file.
- [`NotFile` ](#notfile ) if the provided `segment.path` is not a file.
2020-05-15 13:41:26 +03:00
### `file/event`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This is a notification that is sent every time something under a watched content
root changes. It is used to ensure that the client's filesystem representation
stays in synchronisation with reality.
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
Events should be sent from server to client for every event observed under one
of the (possibly multiple) content roots.
#### Parameters
```typescript
{
path: Path;
kind: FileEventKind;
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
None
### `file/rootAdded`
2020-07-21 15:59:40 +03:00
2021-06-29 19:52:26 +03:00
This is a notification sent to all clients to inform them that a content root
has been added.
At the beginning, a series of notifications is sent that lists all content roots
that are present at the current moment. This message may contain the same
content roots that were already present in the `session/initProtocolConnection` .
That is done, because there is no guarantee that no root has been added between
the init message and the time when notifications start being sent, and this
ensures that no content root is missed.
2020-05-15 13:41:26 +03:00
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
2021-06-29 19:52:26 +03:00
root: ContentRoot;
2020-05-15 13:41:26 +03:00
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
TBC
### `file/rootRemoved`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This is a notification sent to all clients other than the one performing the
removal of the content root in order to inform them of the removal of the root.
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
id: UUID; // The content root ID
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
TBC
2022-11-14 20:32:39 +03:00
## Version Control System Operations
The language server has a set of version control operations to keep track of
changes made to the projects.
### `vcs/init`
This requests that the VCS manager component initializes version control for the
project identified by the root directory.
- **Type:** Request
- **Direction:** Client -> Server
This request assumes that no prior VCS is present for the project at a specified
location. If VCS has already been initialized once, the operation will fail.
#### Parameters
```typescript
{
root: Path;
}
```
#### Result
```typescript
null;
```
#### Errors
- [`VCSError` ](#vcserror ) to signal a generic, unrecoverable VCS error.
- [`ProjectNotFound` ](#projectnotfounderror ) to signal that the requested
project does not exist
- [`VCSAlreadyPresent` ](#vcsalreadyexistserror ) to signal that the requested
project does not exist
### `vcs/save`
This requests that the VCS manager component record any changes made to the
project, compared to the last save.
- **Type:** Request
- **Direction:** Client -> Server
This request assumes that the project at a specified location exists and VCS has
been initialized for it with `vcs/init` operation. If the project is not under
Enso's version control system, the operation must fail. If no changes have been
recorded since the last save, the operation must still succeed. All saves
include a timestamp when the request was made. For easier identification, the
request has an optional `name` parameter that will prefix the timestamp.
#### Parameters
```typescript
{
root: Path;
name?: String;
}
```
#### Result
```typescript
{
commitId: String;
message: String;
}
```
#### Errors
- [`VCSError` ](#vcserror ) to signal a generic, unrecoverable VCS error.
- [`ProjectNotFound` ](#projectnotfounderror ) to signal that the requested
project does not exist
- [`VCSNotFound` ](#vcsnotfounderror ) to signal that the project is not under
Enso's version control
### `vcs/status`
This requests that the VCS manager component report the current status of the
changes made to the project.
- **Type:** Request
- **Direction:** Client -> Server
This request assumes that the project at a specified location exists and VCS has
been initialized for it with `vcs/init` operation. If the project is not under
Enso's version control system, the operation must fail. The status of the
project includes:
- `dirtty` flag, indicating if any of the project files has been modified, added
or deleted
- list of paths to the modified files, if any
2022-12-13 01:13:03 +03:00
- the metadata of a last save, if any
2022-11-14 20:32:39 +03:00
#### Parameters
```typescript
{
root: Path;
}
```
#### Result
```typescript
{
dirty: Boolean;
changed: [Path];
lastSave: {
commitId: String;
message: String;
}
}
```
#### Errors
- [`VCSError` ](#vcserror ) to signal a generic, unrecoverable VCS error.
- [`ProjectNotFound` ](#projectnotfounderror ) to signal that the requested
project does not exist
- [`VCSNotFound` ](#vcsnotfounderror ) to signal that the project is not under
Enso's version control
### `vcs/restore`
This requests that the VCS manager component restores the project to a past
state recorded in Enso's VCS. All unsaved changes will be lost.
- **Type:** Request
- **Direction:** Client -> Server
This request assumes that the project at a specified location exists and VCS has
been initialized for it with `vcs/init` operation. If the project is not under
Enso's version control system, the operation must fail.
The request has an optional `commitId` parameter that refers to the past
checkpoint recorded with `vcs/save` . If no save exists with a provided
`commitId` , the request must fail. If no `commitId` exists, the operation will
restore the project to the last saved state, will all current modifications
forgotten.
2023-01-05 17:00:00 +03:00
If the contents of any open buffer has changed as a result of this operation,
all subscribed clients will be notified about the new version of the file via
`text/didChange` push notification.
A file might have been removed during the operation while there were still open
buffers for that file. Any such clients will be modified of a file removal via
the `file/event` notification.
The result of the call returns a list of files that have been modified during
the operation.
2022-11-14 20:32:39 +03:00
#### Parameters
```typescript
{
root: Path;
commitId?: String
}
```
#### Errors
- [`VCSError` ](#vcserror ) to signal a generic, unrecoverable VCS error.
- [`ProjectNotFound` ](#projectnotfounderror ) to signal that the requested
project does not exist
- [`VCSNotFound` ](#vcsnotfounderror ) to signal that the project is not under
Enso's version control
- [`SaveNotFound` ](#savenotfounderror ) to signat that the requested save could
not be identified in the project's version control
#### Result
```typescript
2023-01-05 17:00:00 +03:00
{
changed: [Path];
}
2022-11-14 20:32:39 +03:00
```
### `vcs/list`
This requests that the VCS manager component returns a list of project's saves.
- **Type:** Request
- **Direction:** Client -> Server
By default, the operation will return all project's saves. An optional `limit`
parameter will ensure that only the last `limti` ones are reported.
This request assumes that the project at a specified location exists and VCS has
been initialized for it with `vcs/init` operation. If the project is not under
Enso's version control system, the operation must fail.
#### Parameters
```typescript
{
root: Path;
limit?: Number
}
```
#### Result
```typescript
{
saves: [
{
commitId: String;
message: String;
}
]
}
```
#### Errors
- [`VCSError` ](#vcserror ) to signal a generic, unrecoverable VCS error.
- [`ProjectNotFound` ](#projectnotfounderror ) to signal that the requested
project does not exist
- [`VCSNotFound` ](#vcsnotfounderror ) to signal that the project is not under
Enso's version control
2020-05-15 13:41:26 +03:00
## Text Editing Operations
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
The language server also has a set of text editing operations to ensure that it
stays in sync with the clients.
### `text/openFile`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This requests the language server to open the specified file.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
2020-07-21 15:59:40 +03:00
If no client has write lock on the opened file, the capability is granted to the
client that sent the `text/openFile` message.
2020-05-15 13:41:26 +03:00
#### Parameters
```typescript
{
path: Path;
}
```
#### Result
```typescript
{
writeCapability?: CapabilityRegistration;
content: String;
currentVersion: SHA3-224;
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
- [`ContentRootNotFoundError` ](#contentrootnotfounderror ) to signal that the
requested content root cannot be found.
- [`AccessDeniedError` ](#accessdeniederror ) to signal that a user doesn't have
access to a resource.
- [`FileNotFound` ](#filenotfound ) informs that file cannot be found.
2022-06-20 15:30:33 +03:00
### `text/openBuffer`
This requests the language server to open a specified in-memory buffer mapped to
the provided path. If the path exists, this command behaves the same as
[`text/openFile` ](#textopenfile ). If the path does not exist, the command
creates empty in-memory buffer for the provided path.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
If no client has write lock on the opened file, the capability is granted to the
client that sent the `text/openBuffer` message. The in-memory buffers can be
used to define hidden modules with visualization functions. In a nutshell, the
request behaves the same as [`text/openFile` ](#textopenfile ) but does not
require the file to exist.
#### Parameters
```typescript
{
path: Path;
}
```
#### Result
```typescript
{
writeCapability?: CapabilityRegistration;
content: String;
currentVersion: SHA3-224;
}
```
#### Errors
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
- [`ContentRootNotFoundError` ](#contentrootnotfounderror ) to signal that the
requested content root cannot be found.
- [`AccessDeniedError` ](#accessdeniederror ) to signal that a user doesn't have
access to a resource.
2020-05-15 13:41:26 +03:00
### `text/closeFile`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This requests the language server to close the specified file.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
2022-11-14 20:32:39 +03:00
Any pending changes to files will be saved before closing the file.
2020-05-15 13:41:26 +03:00
#### Parameters
```typescript
{
path: Path;
}
```
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`FileNotOpenedError` ](#filenotopenederror ) to signal that a file wasn't
opened.
### `text/save`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This requests for the language server to save the specified file.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
The request may fail if the requesting client does not have permission to edit
2022-11-14 20:32:39 +03:00
that file, or if the client is requesting a save of an outdated version. Note
that language-server autosaves changes to the file, making this operation
obsolete.
2020-05-15 13:41:26 +03:00
#### Parameters
```typescript
{
path: Path;
2020-07-21 15:59:40 +03:00
currentVersion: SHA3 - 224;
2020-05-15 13:41:26 +03:00
}
```
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`FileNotOpenedError` ](#filenotopenederror ) to signal that the file isn't
open.
- [`InvalidVersionError` ](#invalidversionerror ) to signal that the version
provided by the client doesn't match the version computed by the server.
- [`WriteDeniedError` ](#writedeniederror ) to signal that the client doesn't hold
write lock for the buffer.
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
- [`ContentRootNotFoundError` ](#contentrootnotfounderror ) to signal that the
requested content root cannot be found.
- [`AccessDeniedError` ](#accessdeniederror ) to signal that the user doesn't have
access to a resource.
### `text/applyEdit`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This requests that the server apply a series of edits to the project. These
edits solely concern text files.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
This operation may fail if the requesting client does not have permission to
edit the resources for which edits are sent. This failure _may_ be partial, in
that some edits are applied and others are not.
#### Parameters
```typescript
{
2022-06-20 15:30:33 +03:00
/** The file edit. */
2020-05-15 13:41:26 +03:00
edit: FileEdit;
2022-06-20 15:30:33 +03:00
/** The flag indicating whether we should re-execute the program after
* applying the edit. Default value is `true` , to re-execute the program.
*/
execute?: boolean;
2020-05-15 13:41:26 +03:00
}
```
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`FileNotOpenedError` ](#filenotopenederror ) to signal that the file isn't
open.
- [`TextEditValidationError` ](#texteditvalidationerror ) to signal that
validation has failed for a series of edits.
- [`InvalidVersionError` ](#invalidversionerror ) to signal that the version
provided by the client doesn't match the version computed by the server.
- [`WriteDeniedError` ](#writedeniederror ) to signal that the client doesn't hold
write lock for the buffer.
2022-06-20 15:30:33 +03:00
### `text/applyExpressionValue`
This requests to set an expression to a new value. For example, it can update a
literal value, like changing `98` to `99` , `true` to `false` or `"Hello"` to
`"World!"` . This method is a more specific version of
[`text/applyEdit` ](#textapplyedit ) and guarantees that the syntax tree is not
changed after applying the edit. This way the engine can perform a more
efficient value swap instead of reparsing and recompiling the whole module.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
This operation may fail if the requesting client does not have permission to
edit the resources for which edits are sent.
#### Parameters
```typescript
interface TextApplyExpressionValue {
/** The expression id to update. */
expressionId: ExpressionId;
2022-07-13 18:59:47 +03:00
/** The path to a file. */
2022-06-20 15:30:33 +03:00
path: Path;
2022-07-13 18:59:47 +03:00
/** The file edit containing the new expression value. */
edit: TextEdit;
/** The current version of a buffer. */
2022-06-20 15:30:33 +03:00
oldVersion: SHA3-224;
2022-07-13 18:59:47 +03:00
/** The version of a buffer after applying the edit. */
2022-06-20 15:30:33 +03:00
newVersion: SHA3-224;
}
```
#### Result
```typescript
null;
```
#### Errors
- [`FileNotOpenedError` ](#filenotopenederror ) to signal that the file isn't
open.
- [`TextEditValidationError` ](#texteditvalidationerror ) to signal that
validation has failed for this edit.
- [`InvalidVersionError` ](#invalidversionerror ) to signal that the version
provided by the client doesn't match the version computed by the server.
- [`WriteDeniedError` ](#writedeniederror ) to signal that the client doesn't hold
write lock for the buffer.
2020-05-15 13:41:26 +03:00
### `text/didChange`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This is a notification sent from the server to the clients to inform them of any
changes made to files that they have open.
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
This notification must _only_ be sent for files that the client has open.
#### Parameters
```typescript
{
edits: [FileEdit];
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
2022-08-11 14:45:12 +03:00
### `text/autoSave`
This is a notification sent from the server to the clients to inform them of any
successful auto-save action.
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
This notification must _only_ be sent for files that the client has open.
#### Parameters
```typescript
{
path: Path;
}
```
#### Errors
```typescript
null;
```
2023-07-10 19:50:14 +03:00
### `text/fileModifiedOnDisk`
This is a notification sent from the server to the clients to inform them that
the file was modified on disk by an external editor.
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
path: Path;
}
```
#### Errors
```typescript
null;
```
2020-05-15 13:41:26 +03:00
## Workspace Operations
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
The language server also has a set of operations useful for managing the client
workspace.
2021-05-27 18:13:52 +03:00
### `workspace/projectInfo`
This request allows the IDE to request information about the currently open
project in situations where it does not have a project manager to connect to.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
}
```
#### Result
```typescript
{
// The name of the project.
projectName: String;
// The engine version on which the project is running.
engineVersion: String;
// The version of graal on which the project is running.
graalVersion: String;
}
```
#### Errors
- [`CannotDecode` ](#cannotdecode ) if the project configuration cannot be
decoded.
- [`FileNotFound` ](#filenotfound ) if the project configuration cannot be found.
2020-05-15 13:41:26 +03:00
## Monitoring
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
The language server also has a heartbeat operation to monitor the Language
server. This API is private and should be used only by the Project Manager.
### `heartbeat/ping`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This request is sent from the supervisor process to the server to check the
health of the Language Server.
- **Type:** Request
- **Direction:** Supervisor -> Server
- **Connection:** Protocol
- **Visibility:** Private
#### Parameters
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
None
2020-12-02 18:56:47 +03:00
### `heartbeat/init`
This request is sent from the bootloader to check if the started language server
instance has finished initialization. A reply should only be sent when the main
module has been fully initialized.
- **Type:** Request
- **Direction:** Supervisor -> Server
- **Connection:** Protocol
- **Visibility:** Private
#### Parameters
```typescript
null;
```
#### Result
```typescript
null;
```
#### Errors
None
2020-07-01 16:55:50 +03:00
## Refactoring
2020-07-21 15:59:40 +03:00
2020-07-06 16:55:21 +03:00
The language server also provides refactoring operations to restructure an
2020-07-01 16:55:50 +03:00
internal body of code.
### `refactoring/renameProject`
2020-07-21 15:59:40 +03:00
2020-07-06 16:55:21 +03:00
This request is sent from the project manager to the server to refactor project
2020-07-01 16:55:50 +03:00
name in an interpreter runtime.
- **Type:** Request
- **Direction:** Project Manager -> Server
- **Connection:** Protocol
- **Visibility:** Private
#### Parameters
```typescript
{
2021-06-24 13:42:24 +03:00
namespace: String;
2020-07-01 16:55:50 +03:00
oldName: String;
newName: String;
}
```
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-07-01 16:55:50 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-07-01 16:55:50 +03:00
None
2023-08-11 00:16:33 +03:00
### `refactoring/renameSymbol`
Sent from the client to the server to rename a symbol in the program. The text
edits required to perform the refactoring will be returned as a
[`text/didChange` ](#textdidchange ) notification.
- **Type:** Request
- **Direction:** Project Manager -> Server
- **Connection:** Protocol
- **Visibility:** Private
#### Supported refactorings
Refactorins supports only limited cases listed below.
##### Local definition
```text
main =
operator1 = 42
^^^^^^^^^
```
Expression id in the request should point to the left hand side symbol of the
assignment.
##### Module method
```text
function1 x = x
^^^^^^^^^
main =
operator1 = Main.function1 42
```
Expression id in the request should point to the symbol defining the function.
Current limitations of the method renaming are:
- Methods defined on types are not supported, i.e.
```text
Main.function1 x = x
```
- Method calls where the self type is not specified will not be renamed, i.e.
```text
function1 x = x
main =
operator1 = function1 42
```
#### Parameters
```typescript
{
/**
* The qualified module name.
*/
module: string;
/**
* The symbol to rename.
*/
expressionId: ExpressionId;
/**
* The new name of the symbol. If the provided name is not a valid Enso
* identifier (contains unsupported symbols, spaces, etc.), it will be normalized.
* The final name will be returned in the response.
*/
newName: string;
}
```
#### Result
```typescript
{
newName: string;
}
```
#### Errors
- [`ModuleNotFoundError` ](#modulenotfounderror ) to signal that the requested
module cannot be found.
- [`ExpressionNotFoundError` ](#expressionnotfounderror ) to signal that the given
expression cannot be found.
- [`FailedToApplyEdits` ](#failedtoapplyedits ) to signal that the refactoring
operation was not able to apply generated edits.
- [`RefactoringNotSupported` ](#refactoringnotsupported ) to signal that the
refactoring of the given expression is not supported.
2023-08-22 14:32:46 +03:00
### `refactoring/projectRenamed`
This is a notification sent from the server to the clients to inform them about
the new project name.
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
/**
* Old normalized name of the project.
*/
oldNormalizedName: string;
/**
* New normalized name of the prject.
*/
newNormalizedName: string;
/**
* New display name of the project.
*/
newName: string;
}
```
#### Errors
None
2020-05-15 13:41:26 +03:00
## Execution Management Operations
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
The execution management portion of the language server API deals with exposing
2020-07-21 15:59:40 +03:00
fine-grained control over program and expression execution to the clients of the
language server. This is incredibly important for enabling the high levels of
interactivity required by Enso Studio.
2020-05-15 13:41:26 +03:00
2020-06-10 17:51:04 +03:00
### Execution Management Example
2020-05-15 13:41:26 +03:00
Given the default project structure.
2020-07-21 15:59:40 +03:00
```text
2020-05-15 13:41:26 +03:00
├── package.yaml
└── src
└── Main.enso
```
2020-07-21 15:59:40 +03:00
```bash
2020-05-15 13:41:26 +03:00
$ cat src/Main.enso
main =
x = 6
y = x.foo 5
z = y + 5
z
Number.foo = x ->
y = this + 3
z = y * x
z
#### METADATA ####
[[{"index": {"value": 98}, "size": {"value": 5}}, "5fc0c11d-bd83-4ca3-b847-b8e362f7658c"],[{"index": {"value": 81}, "size": {"value": 8}}, "1cda3676-bd62-41f8-b6a1-a1e1b7c73d18"],[{"index": {"value": 42}, "size": {"value": 5}}, "899a11e5-4d2b-43dc-a867-2f2ef2d2ba62"],[{"index": {"value": 26}, "size": {"value": 7}}, "37f284d4-c593-4e65-a4be-4948fbd2adfb"],[{"index": {"value": 16}, "size": {"value": 1}}, "c553533e-a2b9-4305-9f12-b8fe7781f933"]]
[]
```
Notice extra newline in the beginning of the `Main.enso` file, it is important
for the precalculated metadata indexes.
### Create Execution Context
2020-07-21 15:59:40 +03:00
```json
2020-05-15 13:41:26 +03:00
{
2020-07-21 15:59:40 +03:00
"jsonrpc": "2.0",
"method": "executionContext/create",
"id": 0,
"params": null
2020-05-15 13:41:26 +03:00
}
```
Return capabilities together with a newly created `ContextId` .
2020-07-21 15:59:40 +03:00
```json
2020-05-15 13:41:26 +03:00
{
2020-07-21 15:59:40 +03:00
"jsonrpc": "2.0",
"id": 0,
"result": {
"contextId": "1eb5ad04-4094-4c1f-be54-e9d29ddf19a3",
"canModify": {
"method": "executionContext/canModify",
"registerOptions": {
"contextId": "1eb5ad04-4094-4c1f-be54-e9d29ddf19a3"
2020-05-15 13:41:26 +03:00
}
},
2020-07-21 15:59:40 +03:00
"receivesUpdates": {
"method": "executionContext/receivesUpdates",
"registerOptions": {
"contextId": "1eb5ad04-4094-4c1f-be54-e9d29ddf19a3"
2020-05-15 13:41:26 +03:00
}
}
}
}
```
### Push Item
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
Entering the `main` method. First item on the stack should always be an
`ExplicitCall` .
2020-07-21 15:59:40 +03:00
```json
2020-05-15 13:41:26 +03:00
{
2020-07-21 15:59:40 +03:00
"jsonrpc": "2.0",
"method": "executionContext/push",
"id": 0,
"params": {
"contextId": "1eb5ad04-4094-4c1f-be54-e9d29ddf19a3",
"stackItem": {
"type": "ExplicitCall",
"methodPointer": {
"file": {
"rootId": "18f642a2-5f69-4fc8-add6-13bf199ca326",
"segments": ["src", "Main.enso"]
2020-05-15 13:41:26 +03:00
},
2020-07-21 15:59:40 +03:00
"definedOnType": "Main",
"name": "main"
2020-05-15 13:41:26 +03:00
},
2020-07-21 15:59:40 +03:00
"thisArgumentExpression": null,
"positionalArgumentsExpressions": []
2020-05-15 13:41:26 +03:00
}
}
}
```
Returns successful reponse.
2020-07-21 15:59:40 +03:00
```json
2020-05-15 13:41:26 +03:00
{
2020-07-21 15:59:40 +03:00
"jsonrpc": "2.0",
"id": 0,
"result": null
2020-05-15 13:41:26 +03:00
}
```
And a value update, result of the method `foo` call defined on type `Number` .
2020-07-21 15:59:40 +03:00
```json
2020-05-15 13:41:26 +03:00
{
2020-07-21 15:59:40 +03:00
"jsonrpc": "2.0",
"method": "executionContext/expressionValuesComputed",
"params": {
"contextId": "1eb5ad04-4094-4c1f-be54-e9d29ddf19a3",
"updates": [
2020-05-15 13:41:26 +03:00
{
2020-07-21 15:59:40 +03:00
"id": "37f284d4-c593-4e65-a4be-4948fbd2adfb",
"type": "Number",
"shortValue": "45",
"methodCall": {
"file": {
"rootId": "18f642a2-5f69-4fc8-add6-13bf199ca326",
"segments": ["src", "Main.enso"]
2020-05-15 13:41:26 +03:00
},
2020-07-21 15:59:40 +03:00
"definedOnType": "Number",
"name": "foo"
2020-05-15 13:41:26 +03:00
}
}
]
}
}
```
We can go deeper and evaluate the method `foo` call by pushing the `LocalCall`
on the stack. In general, all consequent stack items should be `LocalCall` s.
2020-07-21 15:59:40 +03:00
```json
2020-05-15 13:41:26 +03:00
{
2020-07-21 15:59:40 +03:00
"jsonrpc": "2.0",
"method": "executionContext/push",
"id": 0,
"params": {
"contextId": "1eb5ad04-4094-4c1f-be54-e9d29ddf19a3",
"stackItem": {
"type": "LocalCall",
"expressionId": "37f284d4-c593-4e65-a4be-4948fbd2adfb"
2020-05-15 13:41:26 +03:00
}
}
}
```
2023-01-05 17:00:00 +03:00
Returns successful response.
2020-05-15 13:41:26 +03:00
2020-07-21 15:59:40 +03:00
```json
2020-05-15 13:41:26 +03:00
{
2020-07-21 15:59:40 +03:00
"jsonrpc": "2.0",
"id": 0,
"result": null
2020-05-15 13:41:26 +03:00
}
```
And update of some value inside the function `foo` .
2020-07-21 15:59:40 +03:00
```json
2020-05-15 13:41:26 +03:00
{
2020-07-21 15:59:40 +03:00
"jsonrpc": "2.0",
"method": "executionContext/expressionValuesComputed",
"params": {
"contextId": "1eb5ad04-4094-4c1f-be54-e9d29ddf19a3",
"updates": [
2020-05-15 13:41:26 +03:00
{
2020-07-21 15:59:40 +03:00
"id": "1cda3676-bd62-41f8-b6a1-a1e1b7c73d18",
"type": "Number",
"shortValue": "9",
"methodCall": null
2020-05-15 13:41:26 +03:00
}
]
}
}
```
### Pop Item
2020-07-21 15:59:40 +03:00
```json
2020-05-15 13:41:26 +03:00
{
2020-07-21 15:59:40 +03:00
"jsonrpc": "2.0",
"method": "executionContext/pop",
"id": 0,
"params": {
"contextId": "1eb5ad04-4094-4c1f-be54-e9d29ddf19a3"
2020-05-15 13:41:26 +03:00
}
}
```
Popping one item will return us into the `main` method. Second call will clear
the stack. Subsequent pop calls will result in an error indicating that the
stack is empty.
### `executionContext/create`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
Sent from the client to the server to create a new execution context. Return
capabilities [`executionContext/canModify` ](#executioncontextcanmodify ) and
2022-07-11 14:59:38 +03:00
[`executionContext/receivesUpdates` ](#executioncontextreceivesupdates ). The
command takes optional `contextId` parameter with the id to create. The command
is idempotent and returns success if the context with provided id already
exists.
2020-05-15 13:41:26 +03:00
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
```typescript
2022-07-11 14:59:38 +03:00
{
contextId?: ContextId
}
2020-05-15 13:41:26 +03:00
```
#### Result
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
```typescript
{
contextId: ContextId;
canModify: CapabilityRegistration;
receivesUpdates: CapabilityRegistration;
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
None
### `executionContext/destroy`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
Sent from the client to the server destroy an execution context and free its
resources.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
```typescript
{
contextId: ContextId;
}
```
#### Result
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`AccessDeniedError` ](#accessdeniederror ) when the user does not hold the
`executionContext/canModify` capability for this context.
- [`ContextNotFoundError` ](#contextnotfounderror ) when context can not be found
by provided id.
### `executionContext/fork`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
Sent from the client to the server to duplicate an execution context, creating
2020-07-21 15:59:40 +03:00
an independent copy, containing all the data precomputed in the first one.
Return capabilities [`executionContext/canModify` ](#executioncontextcanmodify )
and [`executionContext/receivesUpdates` ](#executioncontextreceivesupdates ).
2020-05-15 13:41:26 +03:00
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
```typescript
{
contextId: ContextId;
}
```
#### Result
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
```typescript
{
contextId: ContextId;
canModify: CapabilityRegistration;
receivesUpdates: CapabilityRegistration;
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
No known errors.
### `executionContext/push`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
Sent from the client to the server execute item and move the execution context
to a new location deeper down the stack. If a stack item becomes invalid because
of a text edit (e.g. the root function of the view was removed), it will stop
executing. If the function reappears, execution should resume as normal.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
```typescript
{
contextId: ContextId;
stackItem: StackItem;
}
```
#### Result
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`AccessDeniedError` ](#accessdeniederror ) when the user does not hold the
`executionContext/canModify` capability for this context.
- [`StackItemNotFoundError` ](#stackitemnotfounderror ) when the request stack
item could not be found.
- [`InvalidStackItemError` ](#invalidstackitemerror ) when pushing `LocalCall` on
top of the empty stack, or pushing `ExplicitCall` on top of non-empty stack.
### `executionContext/pop`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
Sent from the client to the server move the execution context up the stack,
corresponding to the client clicking out of the current breadcrumb.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
```typescript
{
contextId: ContextId;
}
```
#### Result
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`AccessDeniedError` ](#accessdeniederror ) when the user does not hold the
`executionContext/canModify` capability for this context.
- [`EmptyStackError` ](#emptystackerror ) when the user tries to pop an empty
stack.
### `executionContext/recompute`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
Sent from the client to the server to force recomputation of current position.
May include a list of expressions for which caches should be invalidated.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
```typescript
{
2023-04-11 18:12:27 +03:00
/** The execution context identifier. */
2020-05-15 13:41:26 +03:00
contextId: ContextId;
2023-04-11 18:12:27 +03:00
/** The expressions that will be invalidated before the execution. */
2020-05-15 13:41:26 +03:00
invalidatedExpressions?: "all" | [ExpressionId]
2023-04-11 18:12:27 +03:00
/** The execution environment that will be used in the execution. */
executionEnvironment?: ExecutionEnvironment
2020-05-15 13:41:26 +03:00
}
```
#### Result
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`AccessDeniedError` ](#accessdeniederror ) when the user does not hold the
`executionContext/canModify` capability for this context.
- [`EmptyStackError` ](#emptystackerror ) when the user tries to recompute an
empty stack.
2022-12-08 03:04:46 +03:00
### `executionContext/interrupt`
Sent from the client to the server to interrupt the program execution in the
provided execution context.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
contextId: ContextId;
}
```
#### Result
```typescript
null;
```
#### Errors
2023-04-11 18:12:27 +03:00
- [`AccessDeniedError` ](#accessdeniederror ) when the user does not hold the
`executionContext/canModify` capability for this context.
### `executionContext/setExecutionEnvironment`
Sent from the client to the server to set the execution context environment.
After setting the environment, the runtime interrupts the current execution,
clears the caches, and schedules execution of the context.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
contextId: ContextId;
executionEnvironment: ExecutionEnvironment;
}
```
#### Result
```typescript
null;
```
#### Errors
2022-12-08 03:04:46 +03:00
- [`AccessDeniedError` ](#accessdeniederror ) when the user does not hold the
`executionContext/canModify` capability for this context.
2022-04-14 16:12:18 +03:00
### `executionContext/getComponentGroups`
Sent from the client to the server to get the list of component groups available
in runtime.
2023-08-14 19:49:16 +03:00
#### Deprecated
The request is deprecated in favor of
[`runtime/getComponentGroups` ](#runtime-getcomponentgroups ).
2022-06-15 11:32:05 +03:00
2022-04-14 16:12:18 +03:00
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
contextId: ContextId;
}
```
#### Result
```typescript
{
componentGroups: LibraryComponentGroup[];
}
```
#### Errors
- [`AccessDeniedError` ](#accessdeniederror ) when context with the provided id
does not exist.
2021-01-21 17:10:21 +03:00
### `executionContext/expressionUpdates`
Sent from the server to the client to inform about new information for certain
expressions becoming available. Supersedes the
`executionContext/expressionValuesComputed` notification, that will be removed
in future versions.
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
contextId: ContextId;
updates: [ExpressionUpdate];
}
```
#### Errors
None
2020-06-16 14:16:07 +03:00
### `executionContext/executionFailed`
2020-07-21 15:59:40 +03:00
2023-06-29 10:35:28 +03:00
Sent from the server to the client to inform about a failure when attempting to
execute a context.
2020-10-15 16:03:45 +03:00
2023-06-29 10:35:28 +03:00
The [`executionContext/executionStatus` ](#executioncontextexecutionstatus )
notifies about potential problems in the code found by compiler which did not
prevent the execution from completing successfully. This message signals about
the non-critical errors during runtime, or critical failures in the logic or the
implementation. A critical failure can be a compiler crash, an attempt to
execute an empty stack, an error location a method or a module when issuing a
2020-10-15 16:03:45 +03:00
[`executionContext/push` ](#executioncontextpush ) command.
2020-06-16 14:16:07 +03:00
2023-06-29 10:35:28 +03:00
`executionContext/executionFailed` and
[`executionContext/executionComplete` ](#executioncontextexecutioncomplete )
messages are mutually exclusive, indicating a failed or a successful execution,
respectively.
2020-06-16 14:16:07 +03:00
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
2020-07-21 15:59:40 +03:00
2020-06-16 14:16:07 +03:00
```typescript
{
2020-10-15 16:03:45 +03:00
/**
* The identifier of the execution context.
*/
2020-06-16 14:16:07 +03:00
contextId: ContextId;
2020-10-15 16:03:45 +03:00
/**
2023-06-29 10:35:28 +03:00
* The details of the failed execution.
2020-10-15 16:03:45 +03:00
*/
2023-06-29 10:35:28 +03:00
result: ExecutionResult;
2020-10-15 16:03:45 +03:00
}
```
#### Errors
None
2021-08-12 19:26:44 +03:00
### `executionContext/executionComplete`
Sent from the server to the client to inform about the successful execution of a
context.
2023-06-29 10:35:28 +03:00
`executionContext/executionFailed` and
[`executionContext/executionComplete` ](#executioncontextexecutioncomplete )
messages are mutually exclusive, indicating a failed or a successful execution,
respectively.
2021-08-12 19:26:44 +03:00
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
/** The identifier of the execution context. */
contextId: ContextId;
}
```
#### Errors
None
2020-10-15 16:03:45 +03:00
### `executionContext/executionStatus`
Sent from the server to the client to inform about a status of execution.
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
/**
* The identifier of the execution context.
*/
contextId: ContextId;
/**
* The list of encountered problems.
*/
diagnostics: Diagnostic[];
2020-06-16 14:16:07 +03:00
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-06-16 14:16:07 +03:00
None
2021-05-21 16:19:21 +03:00
### `executionContext/executeExpression`
This message allows the client to execute an arbitrary expression on a given
node. It behaves like oneshot
2023-06-26 20:04:35 +03:00
[`executionContext/attachVisualization` ](#executioncontextattachvisualization )
visualization request, meaning that the visualization expression will be
2021-05-21 16:19:21 +03:00
executed only once.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
interface ExecuteExpressionRequest {
2023-06-26 20:04:35 +03:00
visualizationId: UUID;
2021-05-21 16:19:21 +03:00
expressionId: UUID;
2023-06-26 20:04:35 +03:00
visualizationConfig: VisualizationConfiguration;
2021-05-21 16:19:21 +03:00
}
```
#### Result
```typescript
null;
```
#### Errors
- [`AccessDeniedError` ](#accessdeniederror ) when the user does not hold the
`executionContext/canModify` capability for this context.
- [`ContextNotFoundError` ](#contextnotfounderror ) when context can not be found
by provided id.
- [`ModuleNotFoundError` ](#modulenotfounderror ) to signal that the module with
2023-06-26 20:04:35 +03:00
the visualization cannot be found.
- [`VisualizationExpressionError` ](#visualizationexpressionerror ) to signal that
the expression specified in the `VisualizationConfiguration` cannot be
2021-05-21 16:19:21 +03:00
evaluated.
2023-06-26 20:04:35 +03:00
### `executionContext/attachVisualization`
2020-07-21 15:59:40 +03:00
2023-06-26 20:04:35 +03:00
This message allows the client to attach a visualization, potentially
2020-05-15 13:41:26 +03:00
preprocessed by some arbitrary Enso code, to a given node in the program.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
2023-06-26 20:04:35 +03:00
interface AttachVisualizationRequest {
visualizationId: UUID;
2020-05-15 13:41:26 +03:00
expressionId: UUID;
2023-06-26 20:04:35 +03:00
visualizationConfig: VisualizationConfiguration;
2020-05-15 13:41:26 +03:00
}
```
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`AccessDeniedError` ](#accessdeniederror ) when the user does not hold the
`executionContext/canModify` capability for this context.
- [`ContextNotFoundError` ](#contextnotfounderror ) when context can not be found
by provided id.
- [`ModuleNotFoundError` ](#modulenotfounderror ) to signal that the module with
2023-06-26 20:04:35 +03:00
the visualization cannot be found.
- [`VisualizationExpressionError` ](#visualizationexpressionerror ) to signal that
the expression specified in the `VisualizationConfiguration` cannot be
2020-07-21 15:59:40 +03:00
evaluated.
2020-05-15 13:41:26 +03:00
2023-06-26 20:04:35 +03:00
### `executionContext/detachVisualization`
2020-07-21 15:59:40 +03:00
2023-06-26 20:04:35 +03:00
This message allows a client to detach a visualization from the executing code.
2020-05-15 13:41:26 +03:00
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
2023-06-26 20:04:35 +03:00
interface DetachVisualizationRequest {
2020-05-15 13:41:26 +03:00
executionContextId: UUID;
2023-06-26 20:04:35 +03:00
visualizationId: UUID;
2020-05-15 13:41:26 +03:00
expressionId: UUID;
}
```
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`AccessDeniedError` ](#accessdeniederror ) when the user does not hold the
`executionContext/canModify` capability for this context.
- [`ContextNotFoundError` ](#contextnotfounderror ) when context can not be found
by provided id.
2023-06-26 20:04:35 +03:00
- [`VisualizationNotFoundError` ](#visualizationnotfounderror ) when a
visualization can not be found.
2020-05-15 13:41:26 +03:00
2023-06-26 20:04:35 +03:00
### `executionContext/modifyVisualization`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This message allows a client to modify the configuration for an existing
2023-06-26 20:04:35 +03:00
visualization.
2020-05-15 13:41:26 +03:00
2021-08-20 14:53:58 +03:00
A successful response means that the new visualization configuration has been
applied. In case of an error response, the visualization state does not change.
2020-05-15 13:41:26 +03:00
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
2023-06-26 20:04:35 +03:00
interface ModifyVisualizationRequest {
visualizationId: UUID;
visualizationConfig: VisualizationConfiguration;
2020-05-15 13:41:26 +03:00
}
```
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-15 13:41:26 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
- [`AccessDeniedError` ](#accessdeniederror ) when the user does not hold the
`executionContext/canModify` capability for this context.
- [`ContextNotFoundError` ](#contextnotfounderror ) when context can not be found
by provided id.
- [`ModuleNotFoundError` ](#modulenotfounderror ) to signal that the module with
2023-06-26 20:04:35 +03:00
the visualization cannot be found.
- [`VisualizationExpressionError` ](#visualizationexpressionerror ) to signal that
the expression specified in the `VisualizationConfiguration` cannot be
2020-07-21 15:59:40 +03:00
evaluated.
2023-06-26 20:04:35 +03:00
- [`VisualizationNotFoundError` ](#visualizationnotfounderror ) when a
visualization can not be found.
2020-05-15 13:41:26 +03:00
2023-06-26 20:04:35 +03:00
### `executionContext/visualizationUpdate`
2020-07-21 15:59:40 +03:00
2023-06-26 20:04:35 +03:00
This message is responsible for providing a visualization data update to the
2020-05-15 13:41:26 +03:00
client.
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Data
- **Visibility:** Public
2023-06-26 20:04:35 +03:00
The `visualizationData` component of the table definition _must_ be
2020-05-15 13:41:26 +03:00
pre-serialized before being inserted into this message. As far as this level of
transport is concerned, it is just a binary blob.
#### Parameters
```idl
namespace org.enso.languageserver.protocol.binary;
2023-06-26 20:04:35 +03:00
//A visualization context identifying a concrete visualization.
table VisualizationContext {
2020-05-15 13:41:26 +03:00
2023-06-26 20:04:35 +03:00
//A visualization identifier.
visualizationId: EnsoUUID (required);
2020-05-15 13:41:26 +03:00
//A context identifier.
contextId: EnsoUUID (required);
//An expression identifier.
expressionId: EnsoUUID (required);
}
2023-06-26 20:04:35 +03:00
//An event signaling visualization update.
table VisualizationUpdate {
2020-05-15 13:41:26 +03:00
2023-06-26 20:04:35 +03:00
//A visualization context identifying a concrete visualization.
visualizationContext: VisualizationContext (required);
2020-05-15 13:41:26 +03:00
2023-06-26 20:04:35 +03:00
//A visualization data.
2020-05-15 13:41:26 +03:00
data: [ubyte] (required);
}
2023-06-26 20:04:35 +03:00
root_type VisualizationUpdate;
2020-05-15 13:41:26 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
N/A
2023-06-26 20:04:35 +03:00
### `executionContext/visualizationEvaluationFailed`
2021-04-21 16:32:22 +03:00
2023-06-26 20:04:35 +03:00
Signals that an evaluation of a visualization expression on the computed value
2021-04-21 16:32:22 +03:00
has failed.
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
2023-06-26 20:04:35 +03:00
interface VisualizationEvaluationFailed {
2021-04-21 16:32:22 +03:00
/**
* An execution context identifier.
*/
contextId: ContextId;
/**
2023-06-26 20:04:35 +03:00
* A visualization identifier.
2021-04-21 16:32:22 +03:00
*/
2023-06-26 20:04:35 +03:00
visualizationId: UUID;
2021-04-21 16:32:22 +03:00
/**
* An identifier of a visualised expression.
*/
expressionId: UUID;
/**
* An error message.
*/
message: string;
/**
* Detailed information about the error.
*/
diagnostic?: Diagnostic;
}
```
#### Errors
N/A
2020-06-10 17:51:04 +03:00
## Search Operations
Search operations allow requesting for the autocomplete suggestions and search
for the documentation. Search operations return links to the items in the
Suggestions Database instead of returning full entries. Suggestions Database is
a key-value storage with [`SuggestionEntry` ](#suggestionentry ) values.
### Suggestions Database Example
The following code snippet shows examples of the database entries.
2020-07-21 15:59:40 +03:00
```ruby
2020-06-10 17:51:04 +03:00
type MyType a b
type Maybe
Nothing
Just a
is_just = case this of
Just _ -> true
Nothing -> false
foo x =
10 - x
Number.baz x =
this + x * 10
main =
x = foo 42
y = x.baz x
IO.println y
```
#### MyType
2020-07-21 15:59:40 +03:00
```typescript
2022-11-02 12:53:40 +03:00
< Constructor > {
2020-07-21 15:59:40 +03:00
name: "MyType",
2020-06-10 17:51:04 +03:00
arguments: [],
2020-07-21 15:59:40 +03:00
returnType: "MyType",
2020-06-10 17:51:04 +03:00
};
```
#### Maybe.Nothing
2020-07-21 15:59:40 +03:00
```typescript
2022-11-02 12:53:40 +03:00
< Constructor > {
2020-07-21 15:59:40 +03:00
name: "Nothing",
2020-06-10 17:51:04 +03:00
arguments: [],
2020-07-21 15:59:40 +03:00
returnType: "Maybe",
2020-06-10 17:51:04 +03:00
};
```
#### Maybe.Just
2020-07-21 15:59:40 +03:00
```typescript
2022-11-02 12:53:40 +03:00
< Constructor > {
2020-07-21 15:59:40 +03:00
name: "Just",
2020-06-10 17:51:04 +03:00
arguments: [
{
2020-07-21 15:59:40 +03:00
name: "a",
type: "Any",
2020-06-10 17:51:04 +03:00
isSuspended: false,
hasDefault: false,
2020-07-21 15:59:40 +03:00
},
2020-06-10 17:51:04 +03:00
],
2020-07-21 15:59:40 +03:00
returnType: "Maybe",
2020-06-10 17:51:04 +03:00
};
```
#### Maybe.is_just
2020-07-21 15:59:40 +03:00
```typescript
2022-11-02 12:53:40 +03:00
< Method > {
2020-07-21 15:59:40 +03:00
name: "is_just",
2020-06-10 17:51:04 +03:00
arguments: [],
2020-07-21 15:59:40 +03:00
selfType: "Maybe",
returnType: "Bool",
2020-06-10 17:51:04 +03:00
};
```
#### foo
2020-07-21 15:59:40 +03:00
```typescript
2022-11-02 12:53:40 +03:00
< Function > {
2020-07-21 15:59:40 +03:00
name: "foo",
2020-06-10 17:51:04 +03:00
arguments: [
{
2020-07-21 15:59:40 +03:00
name: "x",
type: "Number",
2020-06-10 17:51:04 +03:00
isSuspended: false,
hasDefault: false,
2020-07-21 15:59:40 +03:00
},
2020-06-10 17:51:04 +03:00
],
2020-07-21 15:59:40 +03:00
returnType: "Bool",
2020-06-10 17:51:04 +03:00
};
```
#### Number.baz
2020-07-21 15:59:40 +03:00
```typescript
2022-11-02 12:53:40 +03:00
< Method > {
2020-07-21 15:59:40 +03:00
name: "baz",
2020-06-10 17:51:04 +03:00
arguments: [
{
2020-07-21 15:59:40 +03:00
name: "x",
type: "Number",
2020-06-10 17:51:04 +03:00
isSuspended: false,
hasDefault: false,
2020-07-21 15:59:40 +03:00
},
2020-06-10 17:51:04 +03:00
],
2020-07-21 15:59:40 +03:00
selfType: "Number",
returnType: "Number",
2020-06-10 17:51:04 +03:00
};
```
#### Local x
2020-07-21 15:59:40 +03:00
```typescript
2022-11-02 12:53:40 +03:00
< Local > {
2020-07-21 15:59:40 +03:00
name: "x",
returnType: "Number",
2020-06-10 17:51:04 +03:00
};
```
#### Local y
2020-07-21 15:59:40 +03:00
```typescript
2022-11-02 12:53:40 +03:00
< Local > {
2020-07-21 15:59:40 +03:00
name: "y",
returnType: "Number",
2020-06-10 17:51:04 +03:00
};
```
### `search/getSuggestionsDatabase`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
Sent from client to the server to receive the full suggestions database.
2023-04-06 10:47:23 +03:00
#### Deprecated
The request always returns empty `entries` field with the correct
`currentVersion` . The suggestions are sent during the initial project
compilation as a part of
[`search/suggestionsDatabaseUpdate` ](#searchsuggestionsdatabaseupdate )
notification.
2020-06-10 17:51:04 +03:00
- **Type:** Request
- **Direction:** Client -> Server
2020-07-29 14:51:00 +03:00
- **Connection:** Protocol
2020-06-10 17:51:04 +03:00
- **Visibility:** Public
#### Parameters
2020-07-21 15:59:40 +03:00
2020-06-26 19:52:42 +03:00
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-06-10 17:51:04 +03:00
```
#### Result
2020-07-21 15:59:40 +03:00
2020-06-26 19:52:42 +03:00
```typescript
{
2020-06-10 17:51:04 +03:00
// The list of suggestions database entries
2020-07-20 11:00:49 +03:00
entries: [SuggestionsDatabaseEntry];
2020-06-10 17:51:04 +03:00
// The version of received suggestions database
2020-06-26 19:52:42 +03:00
currentVersion: number;
2020-06-10 17:51:04 +03:00
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-07-20 11:00:49 +03:00
- [`SuggestionsDatabaseError` ](#suggestionsdatabaseerror ) an error accessing the
suggestions database
- [`ProjectNotFoundError` ](#projectnotfounderror ) project is not found in the
root directory
2020-06-10 17:51:04 +03:00
2020-07-29 14:51:00 +03:00
### `search/invalidateSuggestionsDatabase`
Sent from client to the server to clean the suggestions database resetting the
version.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
null;
```
#### Result
```typescript
null;
```
#### Errors
- [`SuggestionsDatabaseError` ](#suggestionsdatabaseerror ) an error accessing the
suggestions database
2020-06-10 17:51:04 +03:00
### `search/getSuggestionsDatabaseVersion`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
Sent from client to the server to receive the current version of the suggestions
database.
- **Type:** Request
- **Direction:** Client -> Server
2020-07-29 14:51:00 +03:00
- **Connection:** Protocol
2020-06-10 17:51:04 +03:00
- **Visibility:** Public
#### Parameters
2020-07-21 15:59:40 +03:00
2020-06-26 19:52:42 +03:00
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-06-10 17:51:04 +03:00
```
#### Result
2020-07-21 15:59:40 +03:00
2020-06-26 19:52:42 +03:00
```typescript
{
2020-06-10 17:51:04 +03:00
// The version of the suggestions database
2020-06-26 19:52:42 +03:00
currentVersion: number;
2020-06-10 17:51:04 +03:00
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-07-20 11:00:49 +03:00
- [`SuggestionsDatabaseError` ](#suggestionsdatabaseerror ) an error accessing the
suggestions database
- [`ProjectNotFoundError` ](#projectnotfounderror ) project is not found in the
root directory
2020-06-10 17:51:04 +03:00
### `search/suggestionsDatabaseUpdate`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
Sent from server to the client to inform abouth the change in the suggestions
database.
- **Type:** Notification
- **Direction:** Server -> Client
2020-07-29 14:51:00 +03:00
- **Connection:** Protocol
2020-06-10 17:51:04 +03:00
- **Visibility:** Public
#### Parameters
2020-06-26 19:52:42 +03:00
```typescript
{
updates: [SuggestionsDatabaseUpdate];
currentVersion: number;
2020-06-10 17:51:04 +03:00
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-07-20 11:00:49 +03:00
None
2020-06-10 17:51:04 +03:00
2021-06-01 15:43:22 +03:00
### `search/suggestionsOrderDatabaseUpdate`
Sent from server to the client to inform abouth the change in the suggestions
order database.
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
updates: [SuggestionsOrderDatabaseUpdate];
}
```
#### Errors
None
2020-06-10 17:51:04 +03:00
### `search/completion`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
Sent from client to the server to receive the autocomplete suggestion.
- **Type:** Request
- **Direction:** Client -> Server
2020-07-29 14:51:00 +03:00
- **Connection:** Protocol
2020-06-10 17:51:04 +03:00
- **Visibility:** Public
#### Parameters
2020-06-26 19:52:42 +03:00
```typescript
{
2020-06-10 17:51:04 +03:00
// The edited file
2020-06-26 19:52:42 +03:00
file: Path;
2020-06-10 17:51:04 +03:00
// The cursor position
2020-06-26 19:52:42 +03:00
position: Position;
2020-06-10 17:51:04 +03:00
// Filter by methods with the provided self type
2020-06-26 19:52:42 +03:00
selfType?: string;
2020-06-10 17:51:04 +03:00
// Filter by the return type
2020-06-26 19:52:42 +03:00
returnType?: string;
2020-06-10 17:51:04 +03:00
// Filter by the suggestion types
2020-06-26 19:52:42 +03:00
tags?: [SuggestionEntryType];
2023-09-19 18:12:23 +03:00
// Filter by `static` attribute of method suggestions
2023-03-23 18:02:25 +03:00
isStatic?: Boolean;
2020-06-10 17:51:04 +03:00
}
```
#### Result
2020-07-21 15:59:40 +03:00
2021-03-29 18:31:17 +03:00
The identifiers in `results` are guaranteed to be ordered by the specificity of
the type match.
2020-06-26 19:52:42 +03:00
```typescript
{
2020-08-11 15:17:39 +03:00
results: [SuggestionId];
2020-06-26 19:52:42 +03:00
currentVersion: number;
2020-06-10 17:51:04 +03:00
}
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-07-20 11:00:49 +03:00
- [`SuggestionsDatabaseError` ](#suggestionsdatabaseerror ) an error accessing the
suggestions database
- [`ProjectNotFoundError` ](#projectnotfounderror ) project is not found in the
root directory
- [`ModuleNameNotResolvedError` ](#modulenamenotresolvederror ) the module name
cannot be extracted from the provided file path parameter
2020-06-10 17:51:04 +03:00
2020-11-26 18:44:35 +03:00
#### Errors
- [`SuggestionsDatabaseError` ](#suggestionsdatabaseerror ) an error accessing the
suggestions database
- [`SuggestionNotFoundError` ](#suggestionnotfounderror ) the requested suggestion
was not found in the suggestions database
2020-05-20 21:23:36 +03:00
## Input/Output Operations
2020-07-21 15:59:40 +03:00
2020-05-20 21:23:36 +03:00
The input/output portion of the language server API deals with redirecting
2020-07-21 15:59:40 +03:00
stdin/stdout/stderr of Enso programs to the clients of the language server. This
is incredibly important for enabling the high levels of interactivity required
by Enso Studio.
2020-05-20 21:23:36 +03:00
### `io/redirectStandardOutput`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
This message allows a client to redirect the standard output of Enso programs.
Once the standard output is redirected, the Language server will notify the
2020-05-20 21:23:36 +03:00
client about new output data by emitting `io/standardOutputAppended` messages.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-20 21:23:36 +03:00
```
2020-07-21 15:59:40 +03:00
2020-05-20 21:23:36 +03:00
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-20 21:23:36 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-20 21:23:36 +03:00
N/A
### `io/suppressStandardOutput`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
This message allows a client to suppress the redirection of the standard output.
2020-05-20 21:23:36 +03:00
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-20 21:23:36 +03:00
```
2020-07-21 15:59:40 +03:00
2020-05-20 21:23:36 +03:00
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-20 21:23:36 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-20 21:23:36 +03:00
N/A
### `io/standardOutputAppended`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
Sent from the server to the client to inform that new output data are available
2020-05-20 21:23:36 +03:00
for the standard output.
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
2020-07-21 15:59:40 +03:00
2020-05-20 21:23:36 +03:00
```typescript
{
output: String;
}
```
### `io/redirectStandardError`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
This message allows a client to redirect the standard error of Enso programs.
Once the standard error is redirected, the Language server will notify the
2020-05-20 21:23:36 +03:00
client about new output data by emitting `io/standardErrorAppended` messages.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-20 21:23:36 +03:00
```
2020-07-21 15:59:40 +03:00
2020-05-20 21:23:36 +03:00
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-20 21:23:36 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-20 21:23:36 +03:00
N/A
### `io/suppressStandardError`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
This message allows a client to suppress the redirection of the standard error.
2020-05-20 21:23:36 +03:00
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-20 21:23:36 +03:00
```
2020-07-21 15:59:40 +03:00
2020-05-20 21:23:36 +03:00
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-20 21:23:36 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-20 21:23:36 +03:00
N/A
### `io/standardErrorAppended`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
Sent from the server to the client to inform that new output data are available
2020-05-20 21:23:36 +03:00
for the standard error.
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
2020-07-21 15:59:40 +03:00
2020-05-20 21:23:36 +03:00
```typescript
{
output: String;
}
```
### `io/feedStandardInput`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
This message allows a client to feed the standard input of Enso programs.
2020-05-20 21:23:36 +03:00
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
{
input: String;
isLineTerminated: Boolean;
}
```
2020-07-21 15:59:40 +03:00
2020-05-20 21:23:36 +03:00
#### Result
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-20 21:23:36 +03:00
```
#### Errors
2020-07-21 15:59:40 +03:00
2020-05-20 21:23:36 +03:00
N/A
### `io/waitingForStandardInput`
2020-07-21 15:59:40 +03:00
2020-06-10 17:51:04 +03:00
Sent from the server to the client to inform that an Enso program is suspended
2020-05-20 21:23:36 +03:00
by `IO.readln` . This message is used to notify a client that she should feed the
2020-06-10 17:51:04 +03:00
standard input.
2020-05-20 21:23:36 +03:00
- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
2020-07-21 15:59:40 +03:00
2020-05-20 21:23:36 +03:00
```typescript
2020-07-21 15:59:40 +03:00
null;
2020-05-20 21:23:36 +03:00
```
2021-07-13 17:00:55 +03:00
## Library-Related Operations
The library-related operations provide the Language Server with capabilities to
check and modify project's edition settings, list editions published in a given
edition, create local library projects which can be imported in the currently
opened project and publish them.
### `editions/listAvailable`
Lists editions available on the system.
Moreover, if `update` is set to `true` , it will download any new editions from
the repositories and include them in the result as well.
> Currently, if `update` was `true` but some downloads failed, the endpoint will
> still return a success, just containing the editions that were already
> available. In the future it should emit warnings using proper notification
> channels.
#### Parameters
```typescript
{
2021-07-17 17:49:51 +03:00
update: Boolean;
2021-07-13 17:00:55 +03:00
}
```
#### Result
```typescript
{
editionNames: [String];
}
```
### `editions/resolve`
Resolves settings implied by the edition.
> Currently, it only resolves the engine version, as only it is needed, but
> other settings may be added if necessary.
#### Parameters
```typescript
{
edition: EditionReference;
}
```
#### Result
```typescript
{
engineVersion: String;
}
```
#### Errors
- [`EditionNotFoundError` ](#editionnotfounderror ) indicates that the requested
edition, or some edition referenced in the ancestors of the edition being
resolved, could not be found.
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
### `editions/getProjectSettings`
Returns the currently set edition-related settings of the project.
Currently, it only returns the parent edition and local library preference. Once
more advanced edition settings are to be supported in the IDE, this endpoint
will be extended.
#### Parameters
```typescript
null;
```
#### Result
```typescript
{
parentEdition?: String;
preferLocalLibraries: Boolean;
}
```
The `parentEdition` may be missing if it is not set. It is possible to manually
edit the `pacakge.yaml` and generate a valid edition config that does not
specify a parent edition.
### `editions/setProjectParentEdition`
Sets the parent edition of the project to a specific edition.
This change may even change the version of the engine associated with the
project, so for the changes to take effect, the language server may need to be
restarted. The endpoint only modifies the `pacakge.yaml` file, which is
preloaded in the Language Server, so it is IDE's responsibility to re-open the
project.
It returns an optional field `needsRestart` which specifies whether the Language
Server needs to be restarted for the change to take effect. If the field is
missing, it should be treated as set to `false` . In the current version it is
always set to `true` .
#### Parameters
```typescript
{
newEditionName: String;
}
```
#### Result
```typescript
{
needsRestart?: Boolean;
}
```
#### Errors
- [`EditionNotFoundError` ](#editionnotfounderror ) indicates that the requested
edition could not be found.
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
### `editions/setProjectLocalLibrariesPreference`
Sets the `prefer-local-libraries` setting of the project, which specifies if
libraries from `ENSO_HOME/libraries` should take precedence over the ones
defined in the edition.
> This may change which libraries should be loaded in the project. In the future
> it may be possible that this reload could happen dynamically, however
> currently, the language server needs to be restarted (in the same way as for
> `editions/setProjectParentEdition`) for the changes to take effect.
It returns an optional field `needsRestart` which specifies whether the Language
Server needs to be restarted for the change to take effect. If the field is
missing, it should be treated as set to `false` . In the current version it is
always set to `true` .
#### Parameters
```typescript
{
preferLocalLibraries: Boolean;
}
```
#### Result
```typescript
{
needsRestart?: Boolean;
}
```
#### Errors
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
### `editions/listDefinedLibraries`
Lists all libraries defined in an edition (or all of its parents).
This can be used to display which libraries can be downloaded / added to the
project.
This does not include local libraries not defined explicitly in the project's
edition, even if they can be resolved as per `prefer-local-libraries` setting.
To get local libraries that are not directly referenced in the edition, use
[`library/listLocal` ](#librarylistlocal ) instead.
#### Parameters
```typescript
{
edition: EditionReference;
}
```
#### Result
```typescript
{
availableLibraries: [LibraryEntry];
}
```
#### Errors
2022-02-24 15:41:14 +03:00
- [`EditionNotFoundError` ](#editionnotfounderror ) indicates that the requested
edition, or an edition referenced in one of its parents, could not be found.
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
### `editions/listDefinedComponents`
Lists all the component groups defined in an edition.
#### Parameters
```typescript
{
edition: EditionReference;
}
```
#### Result
```typescript
{
availableComponents: LibraryComponentGroup[];
}
```
#### Errors
2021-07-13 17:00:55 +03:00
- [`EditionNotFoundError` ](#editionnotfounderror ) indicates that the requested
edition, or an edition referenced in one of its parents, could not be found.
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
### `library/listLocal`
Lists all local libraries available in the system.
#### Parameters
```typescript
null;
```
#### Result
```typescript
{
localLibraries: [LibraryEntry];
}
```
#### Errors
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
### `library/create`
Creates a new project package, but placed not in the projects directory, but in
the local libraries directory, so that other projects (including the current
one) that can resolve local libraries will be able to import it.
The created library package inherits all edition settings from the current
project.
The endpoint just returns an empty message at success. Once this operation
finishes, the IDE can add the import `import <namespace>.<name>` to the open
file which will import the newly created library (the IDE must also ensure that
`prefer-local-libraries` is set to `true` or otherwise, it must add a proper
override to its own edition file to see this local library). Once the import is
added, the library will be loaded and its content root will be sent in a
[`file/rootAdded` ](#filerootadded ) notification.
#### Parameters
```typescript
{
namespace: String;
name: String;
2021-08-20 11:23:05 +03:00
authors: [Contact];
maintainers: [Contact];
2021-07-13 17:00:55 +03:00
license: String;
}
```
#### Result
```typescript
null;
```
#### Errors
2021-08-09 17:00:04 +03:00
- [`InvalidLibraryName` ](#invalidlibraryname ) to signal that the selected
library name is not valid.
2021-07-13 17:00:55 +03:00
- [`LibraryAlreadyExists` ](#libraryalreadyexists ) to signal that a library with
the given namespace and name already exists.
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
### `library/getMetadata`
2021-08-20 11:23:05 +03:00
Gets metadata associated with a specific library version.
If the version is `LocalLibraryVersion` , it will try to read the manifest file
of the local library and return an empty result if the manifest does not exist.
If the version is `PublishedLibraryVersion` , it will fetch the manifest from the
library repository. A cached manifest may also be used, if it is available.
2021-07-13 17:00:55 +03:00
All returned fields are optional, as they may be missing.
#### Parameters
```typescript
{
namespace: String;
name: String;
2021-08-20 11:23:05 +03:00
version: LibraryVersion;
2021-07-13 17:00:55 +03:00
}
```
#### Results
```typescript
{
description?: String;
tagLine?: String;
}
```
#### Errors
- [`LocalLibraryNotFound` ](#locallibrarynotfound ) to signal that a local library
with the given name does not exist on the local libraries path.
2022-02-24 15:41:14 +03:00
- [`InvalidSemverVersion` ](#invalidsemverversion ) to signal that the provided
version string is not a valid semver version.
2021-07-13 17:00:55 +03:00
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
### `library/setMetadata`
Sets metadata associated with a local library that will be used for publishing.
All metadata fields are optional. If a field is not set in the parameters, it
will be removed from the metadata (if it was present before).
#### Parameters
```typescript
{
namespace: String;
name: String;
description?: String;
tagLine?: String;
}
```
#### Results
```typescript
null;
```
#### Errors
- [`LocalLibraryNotFound` ](#locallibrarynotfound ) to signal that a local library
with the given name does not exist on the local libraries path.
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
2022-02-24 15:41:14 +03:00
### `library/getPackage`
Gets the package config associated with a specific library version.
If the version is `LocalLibraryVersion` , it will try to read the package file of
the local library and return an empty result if the manifest does not exist.
If the version is `PublishedLibraryVersion` , it will fetch the package config
from the library repository. A cached package config may also be used, if it is
available.
All returned fields are optional, as they may be missing.
#### Parameters
```typescript
{
namespace: String;
name: String;
version: LibraryVersion;
}
```
#### Results
```typescript
{
license?: String;
2022-03-03 16:28:04 +03:00
componentGroups?: LibraryComponentGroups;
2022-02-24 15:41:14 +03:00
}
```
#### Errors
- [`LocalLibraryNotFound` ](#locallibrarynotfound ) to signal that a local library
with the given name does not exist on the local libraries path.
- [`InvalidSemverVersion` ](#invalidsemverversion ) to signal that the provided
version string is not a valid semver version.
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
2021-07-13 17:00:55 +03:00
### `library/publish`
Publishes a library located in the local libraries directory to the main Enso
library repository.
If `bumpVersionAfterPublish` is set to true, after publishing the library, its
version is bumped automatically, so that future publications will not clash
versions. This is a temporary solution and in the longer-term it should be
replaced with separate settings allowing to arbitrarily modify the library
version from the IDE.
2021-08-09 17:00:04 +03:00
The `uploadUrl` is the URL of the library repository that accepts library
uploads.
2021-07-13 17:00:55 +03:00
The metadata for publishing the library can be set with
[`library/setMetadata` ](#librarysetmetadata ). If it was not set, the publish
operation will still proceed, but that metadata will be missing.
#### Parameters
```typescript
{
namespace: String;
name: String;
authToken: String;
2021-08-09 17:00:04 +03:00
uploadUrl: String;
2021-07-13 17:00:55 +03:00
bumpVersionAfterPublish?: Boolean;
}
```
#### Result
```typescript
null;
```
#### Errors
2021-08-09 17:00:04 +03:00
- [`LocalLibraryNotFound` ](#locallibrarynotfound ) to signal that a local library
with the given name does not exist on the local libraries path.
2021-07-13 17:00:55 +03:00
- [`LibraryPublishError` ](#librarypublisherror ) to signal that the server did
not accept to publish the library (for example because a library with the same
version already exists).
- [`LibraryRepositoryAuthenticationError` ](#libraryrepositoryauthenticationerror )
to signal an authentication failure.
- [`LibraryUploadError` ](#libraryuploaderror ) to signal that the upload
operation has failed, for network-related reasons.
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
### `library/preinstall`
Ensures that the requested library and all of its (transitive) dependencies, at
versions as resolved by the current project's edition, are downloaded.
Once this operation completes, the library import can be added to the project
and it is guaranteed that (unless there were unexpected changes to the system,
like files being manually deleted) no further downloads will be needed, so that
the import should load quickly.
This can be used by the IDE to predownload the library that is about to be added
to a project, to avoid freezing the compiler for the time the dependencies are
being downloaded.
While this operation is in progress, multiple series of `task/*` notifications
may be sent, indicating progress of particular components being downloaded and
installed.
#### Parameters
```typescript
{
namespace: String;
name: String;
}
```
#### Result
```typescript
null;
```
#### Errors
- [`LibraryNotResolved` ](#librarynotresolved ) to signal that the requested
library or one of its dependencies could not be resolved.
2021-11-23 11:51:17 +03:00
- [`DependencyDiscoveryError` ](#dependencydiscoveryerror ) to signal that
dependencies of the library could not be established.
2021-07-13 17:00:55 +03:00
- [`LibraryDownloadError` ](#librarydownloaderror ) to signal that the download
operation has failed, for network-related reasons, or because the library was
missing in the repository. The error includes the name and version of the
library that failed to download - as when preinstalling a specific library the
failure may be tied not to that library itself but also one of its
dependencies.
- [`FileSystemError` ](#filesystemerror ) to signal a generic, unrecoverable
file-system error.
2023-08-14 19:49:16 +03:00
## Runtime Operations
### `runtime/getComponentGroups`
Sent from the client to the server to get the list of component groups available
in runtime.
The engine is started with an empty list of libraries loaded. It means that the
request should be sent after the first
[`executionContext/executionComplete` ](#executioncontextexecutioncomplete )
notification indicating that all the libraries are loaded, and the component
group list is populated. If the request is sent before the first notification,
the response may be empty or not contain all available components.
- **Type:** Request
- **Direction:** Client -> Server
- **Connection:** Protocol
- **Visibility:** Public
#### Parameters
```typescript
null;
```
#### Result
```typescript
{
componentGroups: LibraryComponentGroup[];
}
```
#### Errors
None
2020-05-15 13:41:26 +03:00
## Errors
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
The language server component also has its own set of errors. This section is
not a complete specification and will be updated as new errors are added.
2021-04-21 16:32:22 +03:00
Besides the required `code` and `message` fields, the errors may have a `data`
field which can store additional error-specific payload.
2021-05-26 17:08:41 +03:00
### `Error`
An error container for the binary connection that contains a code, message and
payload.
```idl
namespace org.enso.languageserver.protocol.binary;
table Error {
// A unique error code identifying error type.
2021-05-28 15:27:41 +03:00
code: int;
2021-05-26 17:08:41 +03:00
// An error message.
message: string (required);
// Additional payloads for the error.
2021-05-28 15:27:41 +03:00
data : ErrorPayload;
2021-05-26 17:08:41 +03:00
}
union ErrorPayload {
...
}
```
Note:
- The union `ErrorPayload` will be extended with additional payloads as
necessary.
- All textual-protocol errors can be represented using this structure.
2020-05-15 13:41:26 +03:00
### `AccessDeniedError`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
It signals that a user doesn't have access to a resource.
```typescript
"error" : {
"code" : 100,
"message" : "Access denied"
}
```
### `FileSystemError`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
This error signals generic file system errors.
```typescript
"error" : {
"code" : 1000,
"message" : String
}
```
### `ContentRootNotFoundError`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
The error informs that the requested content root cannot be found.
```typescript
"error" : {
"code" : 1001,
"message" : "Content root not found"
}
```
### `FileNotFound`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
It signals that requested file doesn't exist.
```typescript
"error" : {
"code" : 1003,
"message" : "File not found"
}
```
### `FileExists`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
It signals that file already exists.
```typescript
"error" : {
"code" : 1004,
"message" : "File already exists"
}
```
### `OperationTimeoutError`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
It signals that IO operation timed out.
```typescript
"error" : {
"code" : 1005,
"message" : "IO operation timeout"
}
```
### `NotDirectory`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
It signals that provided path is not a directory.
```typescript
"error" : {
"code" : 1006,
"message" : "Path is not a directory"
}
```
2021-05-26 17:08:41 +03:00
### `NotFile`
It signals that the provided path is not a file.
```typescript
"error" : {
"code" : 1007,
"message" : "Path is not a file"
}
```
### `CannotOverwrite`
Signals that a streaming file write cannot overwrite a portion of the requested
file.
```typescript
"error" : {
"code" : 1008,
"message" : "Cannot overwrite the file without `overwriteExisting` set"
}
```
### `ReadOutOfBounds`
Signals that the requested file read was out of bounds for the file's size.
```typescript
"error" : {
"code" : 1009
"message" : "Read is out of bounds for the file"
2022-03-04 11:57:49 +03:00
"payload" : {
2021-06-11 16:48:28 +03:00
"fileLength" : 0
2021-05-26 17:08:41 +03:00
}
}
```
2021-05-27 18:13:52 +03:00
### `CannotDecode`
Signals that the project configuration cannot be decoded.
```typescript
"error" : {
"code" : 1010
"message" : "Cannot decode the project configuration"
}
```
2021-05-26 17:08:41 +03:00
```idl
namespace org.enso.languageserver.protocol.binary;
table ReadOutOfBoundsError {
// The actual length of the file.
fileLength : ulong (required);
}
```
2020-05-15 13:41:26 +03:00
### `StackItemNotFoundError`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
It signals that provided stack item was not found.
```typescript
"error" : {
"code" : 2001,
"message" : "Stack item not found"
}
```
### `ContextNotFoundError`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
It signals that provided context was not found.
```typescript
"error" : {
"code" : 2002,
"message" : "Context not found"
}
```
### `EmptyStackError`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
It signals that stack is empty.
```typescript
"error" : {
"code" : 2003,
"message" : "Stack is empty"
}
```
### `InvalidStackItemError`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
It signals that stack is invalid in this context.
```typescript
"error" : {
"code" : 2004,
"message" : "Invalid stack item"
}
```
### `ModuleNotFoundError`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
It signals that the given module cannot be found.
```typescript
"error" : {
"code" : 2005,
"message" : "Module not found [Foo.Bar.Baz]"
}
```
2023-06-26 20:04:35 +03:00
### `VisualizationNotFoundError`
2020-07-21 15:59:40 +03:00
2023-06-26 20:04:35 +03:00
It signals that the visualization cannot be found.
2020-05-15 13:41:26 +03:00
```typescript
"error" : {
"code" : 2006,
2023-06-26 20:04:35 +03:00
"message" : "Visualization not found"
2020-05-15 13:41:26 +03:00
}
```
2023-06-26 20:04:35 +03:00
### `VisualizationExpressionError`
2020-07-21 15:59:40 +03:00
2023-06-26 20:04:35 +03:00
It signals that the expression specified in the `VisualizationConfiguration`
2021-04-21 16:32:22 +03:00
cannot be evaluated. The error contains an optional `data` field of type
[`Diagnostic` ](#diagnostic ) providing error details.
2020-05-15 13:41:26 +03:00
```typescript
"error" : {
"code" : 2007,
2023-06-26 20:04:35 +03:00
"message" : "Evaluation of the visualization expression failed [i is not defined]"
2022-03-04 11:57:49 +03:00
"payload" : {
2021-04-21 16:32:22 +03:00
"kind" : "Error",
"message" : "i is not defined",
"path" : null,
"location" : {
"start" : {
"line" : 0,
"character" : 8
},
"end" : {
"line" : 0,
"character" : 9
}
},
"expressionId" : "aa1f75c4-8c4d-493d-a6a7-72123a52f084",
"stack" : []
}
2020-05-15 13:41:26 +03:00
}
```
### `FileNotOpenedError`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
Signals that a file wasn't opened.
```typescript
"error" : {
"code" : 3001,
"message" : "File not opened"
}
```
### `TextEditValidationError`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
Signals that validation has failed for a series of edits.
```typescript
"error" : {
"code" : 3002,
"message" : "The start position is after the end position"
}
```
### `InvalidVersionError`
2020-07-21 15:59:40 +03:00
Signals that version provided by a client doesn't match to the version computed
by the server.
2020-05-15 13:41:26 +03:00
```typescript
"error" : {
"code" : 3003,
"message" : "Invalid version [client version: ade2967cab172183d1a67ea40cb8e92e23218764bc9934c3795fcea5, server version: 7602967cab172183d1a67ea40cb8e92e23218764bc9934c3795fcea5]"
}
```
### `WriteDeniedError`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
Signals that the client doesn't hold write lock to the buffer.
```typescript
"error" : {
"code" : 3004,
"message" : "Write denied"
}
```
### `CapabilityNotAcquired`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
Signals that requested capability is not acquired.
```typescript
"error" : {
"code" : 5001,
"message" : "Capability not acquired"
}
```
### `SessionNotInitialisedError`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
Signals that requested cannot be proccessed, beacuse session is not initialised.
```typescript
"error" : {
"code" : 6001,
"message" : "Session not initialised"
}
```
### `SessionAlreadyInitialisedError`
2020-07-21 15:59:40 +03:00
2020-05-15 13:41:26 +03:00
Signals that session is already initialised.
```typescript
"error" : {
"code" : 6002,
"message" : "Session already initialised"
}
```
2020-07-06 16:55:21 +03:00
2021-03-04 19:59:05 +03:00
### `ResourcesInitializationError`
Signals about the failure in the Language Server initialization process.
```typescript
"error" : {
"code" : 6003,
"message" : "Failed to initialize the Language Server resources"
}
```
2020-07-06 16:55:21 +03:00
### `SuggestionsDatabaseError`
2020-07-21 15:59:40 +03:00
2020-07-06 16:55:21 +03:00
Signals about an error accessing the suggestions database.
```typescript
"error" : {
"code" : 7001,
"message" : "Suggestions database error"
}
```
2020-07-20 11:00:49 +03:00
### `ProjectNotFoundError`
2020-07-21 15:59:40 +03:00
2020-07-20 11:00:49 +03:00
Signals that the project not found in the root directory.
```typescript
"error" : {
"code" : 7002,
"message" : "Project not found in the root directory"
}
```
### `ModuleNameNotResolvedError`
2020-07-21 15:59:40 +03:00
2020-07-20 11:00:49 +03:00
Signals that the module name can not be resolved for the given file.
```typescript
"error" : {
"code" : 7003,
"message" : "Module name can't be resolved for the given file"
}
```
2020-11-26 18:44:35 +03:00
### `SuggestionNotFoundError`
Signals that the requested suggestion was not found.
```typescript
"error" : {
"code" : 7004,
"message" : "Requested suggestion was not found"
}
```
2021-07-13 17:00:55 +03:00
### `EditionNotFoundError`
Signals that an edition could not be found.
Its payload includes the name of the edition that could not be found.
```typescript
"error" : {
"code" : 8001,
"message" : "Edition [< name > ] could not be found.",
"payload" : {
"editionName": "< name > "
}
}
```
### `LibraryAlreadyExists`
Signals that a local library with the specified namespace and name combination
already exists, so it cannot be created again.
```typescript
"error" : {
"code" : 8002,
"message" : "Library [< namespace > .< name > ] already exists."
}
```
### `LibraryRepositoryAuthenticationError`
Signals that authentication to the library repository was declined.
```typescript
"error" : {
"code" : 8003,
"message" : "Authentication failed: [message]"
}
```
### `LibraryPublishError`
Signals that a request to the library repository failed.
```typescript
"error" : {
"code" : 8004,
"message" : "Could not publish the library: [message]"
}
```
### `LibraryUploadError`
Signals that uploading the library failed for network-related reasons.
```typescript
"error" : {
"code" : 8005,
"message" : "Could not upload the library: [message]"
}
```
### `LibraryDownloadError`
Signals that downloading the library failed for network-related reasons or that
it was not available in the repository.
```typescript
"error" : {
"code" : 8006,
"message" : "Could not download the library: [message]",
"payload" : {
"namespace" : "< namespace > ",
"name" : "< name > ",
"version": "< version > "
}
}
```
### `LocalLibraryNotFound`
Signals that a local library with the specified namespace and name combination
was not found on the local libraries path.
```typescript
"error" : {
"code" : 8007,
"message" : "Local library [< namespace > .< name > ] has not been found."
}
```
### `LibraryNotResolved`
Signals that a library could not be resolved - it was not defined in the edition
and the settings did not allow to resolve local libraries or it did not exist
there either.
```typescript
"error" : {
"code" : 8008,
"message" : "Could not resolve [< namespace > .< name > ].",
"payload" : {
"namespace" : "< namespace > ",
"name" : "< name > "
}
}
```
2021-08-09 17:00:04 +03:00
### `InvalidLibraryName`
Signals that the chosen library name is invalid.
It contains a suggestion of a similar name that is valid.
For example for `FooBar` it will suggest `Foo_Bar` .
```typescript
"error" : {
"code" : 8009,
"message" : "[< name > ] is not a valid name: < reason > .",
"payload" : {
"suggestedName" : "< fixed-name > "
}
}
```
2021-11-23 11:51:17 +03:00
### `DependencyDiscoveryError`
Signals that the library preinstall endpoint could not properly find
dependencies of the requested library.
```typescript
"error" : {
"code" : 8010,
"message" : "Error occurred while discovering dependencies: < reason > ."
}
```
2022-02-24 15:41:14 +03:00
### `InvalidSemverVersion`
Signals that the provided version string is not a valid semver version. The
message contains the invalid version in the payload.
```typescript
"error" : {
"code" : 8011,
"message" : "[< invalid-version > ] is not a valid semver version.",
"payload" : {
"version" : "< invalid-version > "
}
}
```
2023-08-11 00:16:33 +03:00
### `ExpressionNotFoundError`
Signals that the expression cannot be found by the provided id.
```typescript
"error" : {
"code" : 9001,
"message" : "Expression not found by id [< expression-id > ]"
}
```
### `FailedToApplyEdits`
Signals that the refactoring operation was not able to apply generated edits.
```typescript
"error" : {
"code" : 9002,
"message" : "Failed to apply edits to module [< module-name > ]"
}
```
### `RefactoringNotSupported`
Signals that the refactoring of the given expression is not supported.
```typescript
"error" : {
"code" : 9003,
"message" : "Refactoring not supported for expression [< expression-id > ]"
}
```