Package dk.gtz.graphedit.spi
Interface ILanguageServer
- All Known Implementing Classes:
GrpcLanguageServer
public interface ILanguageServer
Interface and specification of a language server.
Language servers provide the language smarts that help developers create better, safer and valid models.
A server provides diagnostics, lints, optimizations, suggestions and notifications.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDiagnosticsCallback
(dk.yalibs.yafunc.IRunnable1<Collection<ModelLint>> callback) Add a callback function to call when diagnostics are updated.void
addNotificationCallback
(dk.yalibs.yafunc.IRunnable1<ModelNotification> callback) Add a callback function to call when a notification is presented.void
addProgressCallback
(dk.yalibs.yafunc.IRunnable1<ModelLanguageServerProgress> callback) Add a callback function to call when language server progress notification happens.Get all the diagnostics that are currently known to the server.Get the name of the language that the server supports.Get the name of the language server (not to be confused withgetLanguageName()
)Get the version string of the language server.void
initialize
(File projectFile, IBufferContainer bufferContainer) Function to initialize (not start) the language server This will be called right before any callback functions are addedvoid
start()
Start the language server.
-
Method Details
-
getLanguageName
String getLanguageName()Get the name of the language that the server supports. Expected to match whatISyntaxFactory.getSyntaxName()
provides- Returns:
- A string with the name of the supported language.
-
getServerName
String getServerName()Get the name of the language server (not to be confused withgetLanguageName()
)- Returns:
- A string representing the name of the language server
-
getServerVersion
String getServerVersion()Get the version string of the language server. i.e. "v1.0.0"- Returns:
- A string representing the version of the language server
-
initialize
Function to initialize (not start) the language server This will be called right before any callback functions are added- Parameters:
projectFile
- The Graphedit project file. Note that this can also just be a temporary directorybufferContainer
- The collection of buffers, likely (but not guaranteed) to be empty at initialization
-
start
void start()Start the language server. This will be called from a seperate thread and will be interrupted viaThread.interrupt()
when it's time to close. This means that this function should be a blocking call -
getDiagnostics
Collection<ModelLint> getDiagnostics()Get all the diagnostics that are currently known to the server.- Returns:
- A collection of lints.
-
addDiagnosticsCallback
Add a callback function to call when diagnostics are updated. Note that the callback expects a complete collection of lints.- Parameters:
callback
- The function to call when the diagnostics collections change.
-
addNotificationCallback
Add a callback function to call when a notification is presented.- Parameters:
callback
- The function to call when a notification should be shown.
-
addProgressCallback
Add a callback function to call when language server progress notification happens.- Parameters:
callback
- The function to call when a progress notification should be shown.
-