public class SnippetRegistry extends Object
| Constructor and Description |
|---|
SnippetRegistry() |
SnippetRegistry(String languageId,
boolean loadDefault)
Snippet registry for a given language id.
|
| Modifier and Type | Method and Description |
|---|---|
List<org.eclipse.lsp4j.CompletionItem> |
getCompletionItems(org.eclipse.lsp4j.Range replaceRange,
String lineDelimiter,
boolean canSupportMarkdown,
boolean snippetsSupported,
BiPredicate<ISnippetContext<?>,Map<String,String>> contextFilter,
ISuffixPositionProvider suffixProvider)
Returns the snippet completion items according to the context filter.
|
List<Snippet> |
getSnippets()
Returns all snippets.
|
void |
registerSnippet(Snippet snippet)
Register the given snippet.
|
void |
registerSnippets(InputStream in)
Register the snippets from the given JSON input stream.
|
void |
registerSnippets(InputStream in,
ISnippetContext<?> defaultContext)
Register the snippets from the given JSON stream with a context.
|
void |
registerSnippets(InputStream in,
ISnippetContext<?> defaultContext,
com.google.gson.TypeAdapter<? extends ISnippetContext<?>> contextDeserializer)
Register the snippets from the given JSON stream with a context.
|
void |
registerSnippets(InputStream in,
com.google.gson.TypeAdapter<? extends ISnippetContext<?>> contextDeserializer)
Register the snippets from the given JSON stream with a context.
|
void |
registerSnippets(Reader in)
Register the snippets from the given JSON reader.
|
void |
registerSnippets(Reader in,
ISnippetContext<?> defaultContext)
Register the snippets from the given JSON stream with a context.
|
void |
registerSnippets(Reader in,
ISnippetContext<?> defaultContext,
com.google.gson.TypeAdapter<? extends ISnippetContext<?>> contextDeserializer)
Register the snippets from the given JSON stream with a context.
|
void |
registerSnippets(Reader in,
com.google.gson.TypeAdapter<? extends ISnippetContext<?>> contextDeserializer)
Register the snippets from the given JSON reader with a context.
|
public SnippetRegistry()
public SnippetRegistry(String languageId, boolean loadDefault)
languageId - the language id and null otherwise.loadDefault - true if default snippets from SPI must be loaded and false
otherwise.public void registerSnippet(Snippet snippet)
snippet - the snippet to register.public void registerSnippets(InputStream in) throws IOException
in - the JSON input stream which declares snippets with vscode snippet
format.IOExceptionpublic void registerSnippets(InputStream in, com.google.gson.TypeAdapter<? extends ISnippetContext<?>> contextDeserializer) throws IOException
in - the JSON input stream which declares snippets with
vscode snippet format.contextDeserializer - the GSON context deserializer used to create Java
context.IOExceptionpublic void registerSnippets(InputStream in, ISnippetContext<?> defaultContext) throws IOException
in - the JSON input stream which declares snippets with
vscode snippet format.defaultContext - the default context.IOExceptionpublic void registerSnippets(InputStream in, ISnippetContext<?> defaultContext, com.google.gson.TypeAdapter<? extends ISnippetContext<?>> contextDeserializer) throws IOException
in - the JSON input stream which declares snippets with
vscode snippet format.defaultContext - the default context.contextDeserializer - the GSON context deserializer used to create Java
context.IOExceptionpublic void registerSnippets(Reader in) throws IOException
in - the JSON reader which declares snippets with vscode snippet format.IOExceptionpublic void registerSnippets(Reader in, com.google.gson.TypeAdapter<? extends ISnippetContext<?>> contextDeserializer) throws IOException
in - the JSON reader which declares snippets with
vscode snippet format.contextDeserializer - the GSON context deserializer used to create Java
context.IOExceptionpublic void registerSnippets(Reader in, ISnippetContext<?> defaultContext) throws IOException
in - the JSON reader which declares snippets with vscode
snippet format.defaultContext - the default context.IOExceptionpublic void registerSnippets(Reader in, ISnippetContext<?> defaultContext, com.google.gson.TypeAdapter<? extends ISnippetContext<?>> contextDeserializer) throws IOException
in - the JSON reader which declares snippets with
vscode snippet format.defaultContext - the default context.contextDeserializer - the GSON context deserializer used to create Java
context.IOExceptionpublic List<org.eclipse.lsp4j.CompletionItem> getCompletionItems(org.eclipse.lsp4j.Range replaceRange, String lineDelimiter, boolean canSupportMarkdown, boolean snippetsSupported, BiPredicate<ISnippetContext<?>,Map<String,String>> contextFilter, ISuffixPositionProvider suffixProvider)
replaceRange - the replace range.lineDelimiter - the line delimiter.canSupportMarkdown - true if markdown is supported to generate
documentation and false otherwise.contextFilter - the context filter.Copyright © 2020. All rights reserved.