diff --git a/src/Rscript.vb b/src/Rscript.vb index c4d24b3..98b6359 100644 --- a/src/Rscript.vb +++ b/src/Rscript.vb @@ -116,7 +116,7 @@ Public Module RscriptEngine ''' ''' - Public Sub listen(Optional port As Integer = 321) + Public Sub listen(Optional port As Integer = 321, Optional vscode_clr As String = Nothing) Call New LanguageServer(port).Listen() End Sub diff --git a/src/lsp/LanguageServer.vb b/src/lsp/LanguageServer.vb index 6d9b4af..edd1a96 100644 --- a/src/lsp/LanguageServer.vb +++ b/src/lsp/LanguageServer.vb @@ -1,12 +1,32 @@ -Public Class LanguageServer +Imports System.Reflection +Imports Flute.Http +Imports Flute.Http.Core +Imports Flute.Http.Core.Message +Imports Flute.Http.FileSystem +Imports Microsoft.VisualBasic.ApplicationServices +Public Class LanguageServer : Implements IAppHandler + ReadOnly vscode As FileSystem + ReadOnly http As HttpSocket - Sub New(port As Integer) + Sub New(port As Integer, Optional vscode_clr As String = Nothing) + If vscode_clr.FileExists(ZERO_Nonexists:=True) Then + vscode = New FileSystem(FindResource(Assembly.LoadFrom(vscode_clr.GetFullPath))) + End If + http = New HttpDriver().HttpMethod("get", Me).GetSocket(port) End Sub - Public Sub Listen() + Private Shared Function FindResource(asm As Assembly) As IFileSystemEnvironment + + End Function + + Private Sub AppHandler(request As HttpRequest, response As HttpResponse) Implements IAppHandler.AppHandler End Sub + + Public Sub Listen() + Call http.Run() + End Sub End Class