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 Details

    • getLanguageName

      String getLanguageName()
      Get the name of the language that the server supports. Expected to match what ISyntaxFactory.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 with getLanguageName())
      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

      void initialize(File projectFile, IBufferContainer bufferContainer)
      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 directory
      bufferContainer - 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 via Thread.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

      void addDiagnosticsCallback(dk.yalibs.yafunc.IRunnable1<Collection<ModelLint>> callback)
      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

      void addNotificationCallback(dk.yalibs.yafunc.IRunnable1<ModelNotification> callback)
      Add a callback function to call when a notification is presented.
      Parameters:
      callback - The function to call when a notification should be shown.
    • addProgressCallback

      void addProgressCallback(dk.yalibs.yafunc.IRunnable1<ModelLanguageServerProgress> callback)
      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.