Package org.graalvm.tools.lsp.server
Class TruffleAdapter
java.lang.Object
org.graalvm.tools.lsp.server.TruffleAdapter
- All Implemented Interfaces:
VirtualLanguageServerFileProvider
This class delegates LSP requests of
LanguageServerImpl to specific implementations of
AbstractRequestHandler. It is responsible for wrapping requests into tasks for an
instance of ContextAwareExecutor, so that these tasks are executed by a Thread which has
entered a Context.-
Constructor Summary
ConstructorsConstructorDescriptionTruffleAdapter(com.oracle.truffle.api.instrumentation.TruffleInstrument.Env mainEnv, boolean developerMode) -
Method Summary
Modifier and TypeMethodDescriptioncompletion(URI uri, int line, int column, CompletionContext completionContext) Provides completions for a specific position in the document.Future<?> voidFuture<List<? extends DocumentHighlight>> documentHighlight(URI uri, int line, int character) getCoverage(URI uri) com.oracle.truffle.api.TruffleLoggercom.oracle.truffle.api.source.SourcegetSourceText(Path path) booleanhasCoverageData(URI uri) voidinitializeLSPServer(org.graalvm.tools.api.lsp.LSPServerAccessor server) booleanisVirtualFile(Path path) Future<com.oracle.truffle.api.CallTarget> protected com.oracle.truffle.api.CallTargetparseWithEnteredContext(String text, String langId, URI uri) processChangesAndParse(List<? extends TextDocumentContentChangeEvent> list, URI uri) protected TextDocumentSurrogateprocessChangesAndParseWithContextEntered(List<? extends TextDocumentContentChangeEvent> list, URI uri) voidregister(com.oracle.truffle.api.instrumentation.TruffleInstrument.Env environment, ContextAwareExecutor executor) Future<?> runCoverageAnalysis(URI uri) voidsetServerCapabilities(String languageId, ServerCapabilities capabilities) signatureHelp(URI uri, int line, int character) surrogateGetter(com.oracle.truffle.api.nodes.LanguageInfo languageInfo)
-
Constructor Details
-
TruffleAdapter
public TruffleAdapter(com.oracle.truffle.api.instrumentation.TruffleInstrument.Env mainEnv, boolean developerMode)
-
-
Method Details
-
register
public void register(com.oracle.truffle.api.instrumentation.TruffleInstrument.Env environment, ContextAwareExecutor executor) -
getLogger
public com.oracle.truffle.api.TruffleLogger getLogger() -
didClose
-
parse
-
parseWithEnteredContext
protected com.oracle.truffle.api.CallTarget parseWithEnteredContext(String text, String langId, URI uri) throws DiagnosticsNotification - Throws:
DiagnosticsNotification
-
reparse
-
processChangesAndParse
public Future<TextDocumentSurrogate> processChangesAndParse(List<? extends TextDocumentContentChangeEvent> list, URI uri) -
processChangesAndParseWithContextEntered
protected TextDocumentSurrogate processChangesAndParseWithContextEntered(List<? extends TextDocumentContentChangeEvent> list, URI uri) throws DiagnosticsNotification - Throws:
DiagnosticsNotification
-
setServerCapabilities
-
completion
public Future<CompletionList> completion(URI uri, int line, int column, CompletionContext completionContext) Provides completions for a specific position in the document. If line or column are out of range, items of global scope (top scope) are provided.- Parameters:
uri-line- 0-based line numbercolumn- 0-based column number (character offset)completionContext- has kind and completion character if client supports it- Returns:
- a
FutureofCompletionListcontaining all completions for the cursor position
-
hover
-
signatureHelp
-
runCoverageAnalysis
-
getCoverage
-
documentHighlight
public Future<List<? extends DocumentHighlight>> documentHighlight(URI uri, int line, int character) -
hasCoverageData
-
getSourceText
- Specified by:
getSourceTextin interfaceVirtualLanguageServerFileProvider- Parameters:
path- A path to a file in the file system.- Returns:
- The source code of the file as seen/edited by the user in the source code editor.
-
getSource
-
isVirtualFile
- Specified by:
isVirtualFilein interfaceVirtualLanguageServerFileProvider- Parameters:
path- A path to a file in the file system.- Returns:
- true if the file has been marked as "opened" in our LSP server.
-
surrogateGetter
public Function<URI,TextDocumentSurrogate> surrogateGetter(com.oracle.truffle.api.nodes.LanguageInfo languageInfo) -
initializeLSPServer
public void initializeLSPServer(org.graalvm.tools.api.lsp.LSPServerAccessor server) -
getExtensionCommandNames
-
createExtensionCommand
-