#include <MooseServer.h>
Public Member Functions | |
MooseServer (MooseApp &moose_app) | |
virtual | ~MooseServer ()=default |
std::shared_ptr< wasp::lsp::Connection > | getConnection () |
Get read / write connection - specific to this server implemention. More... | |
Private Types | |
using | SortedLocationNodes = std::set< wasp::HITNodeView, std::function< bool(const wasp::HITNodeView &, const wasp::HITNodeView &)> > |
SortedLocationNodes - type alias for set of nodes sorted by location. More... | |
Private Member Functions | |
bool | parseDocumentForDiagnostics (wasp::DataArray &diagnosticsList) |
Parse document for diagnostics - specific to this server implemention. More... | |
bool | updateDocumentTextChanges (const std::string &replacement_text, int start_line, int start_character, int end_line, int end_character, int range_length) |
Update document text changes - specific to this server implemention. More... | |
bool | gatherDocumentCompletionItems (wasp::DataArray &completionItems, bool &is_incomplete, int line, int character) |
Gather document completion items - specific to this server implemention. More... | |
void | getExistingInput (wasp::HITNodeView parent_node, std::set< std::string > &existing_params, std::set< std::string > &existing_subblocks) |
Get names of parameters and subblocks specified in given input node. More... | |
void | getAllValidParameters (InputParameters &valid_params, const std::string &object_path, const std::string &object_type, std::set< std::string > &obj_act_tasks) |
Get all global parameters, action parameters, and object parameters. More... | |
void | getActionParameters (InputParameters &valid_params, const std::string &object_path, std::set< std::string > &obj_act_tasks) |
Get all action parameters using requested object path to collection. More... | |
void | getObjectParameters (InputParameters &valid_params, std::string object_type, const std::set< std::string > &obj_act_tasks) |
Get all object parameters using requested object path to collection. More... | |
bool | addParametersToList (wasp::DataArray &completionItems, const InputParameters &valid_params, const std::set< std::string > &existing_params, int replace_line_beg, int replace_char_beg, int replace_line_end, int replace_char_end, const std::string &filtering_prefix) |
Add parameters that were previously gathered to list for completion. More... | |
bool | addSubblocksToList (wasp::DataArray &completionItems, const std::string &object_path, int replace_line_beg, int replace_char_beg, int replace_line_end, int replace_char_end, const std::string &filtering_prefix, bool request_on_block_decl) |
Add subblocks to completion list for request path, line, and column. More... | |
bool | addValuesToList (wasp::DataArray &completionItems, const InputParameters &valid_params, const std::set< std::string > &existing_params, const std::set< std::string > &existing_subblocks, const std::string ¶m_name, const std::set< std::string > &obj_act_tasks, const std::string &object_path, int replace_line_beg, int replace_char_beg, int replace_line_end, int replace_char_end) |
Add parameter values to completion list for request line and column. More... | |
template<typename MooseEnumType > | |
void | getEnumsAndDocs (MooseEnumType &moose_enum_param, std::map< std::string, std::string > &options_and_descs) |
Fill map of all options and descriptions if parameter is moose enum. More... | |
bool | gatherDocumentDefinitionLocations (wasp::DataArray &definitionLocations, int line, int character) |
Gather definition locations - specific to this server implemention. More... | |
void | getInputLookupDefinitionNodes (SortedLocationNodes &location_nodes, const std::string &clean_type, const std::string &val_string) |
Get set of nodes from associated path lookups matching value string. More... | |
bool | addLocationNodesToList (wasp::DataArray &defsOrRefsLocations, const SortedLocationNodes &location_nodes) |
Add set of nodes sorted by location to definition or reference list. More... | |
bool | getHoverDisplayText (std::string &display_text, int line, int character) |
Get hover display text - logic specific to this server implemention. More... | |
bool | gatherDocumentReferencesLocations (wasp::DataArray &referencesLocations, int line, int character, bool include_declaration) |
Gather references locations - specific to this server implemention. More... | |
void | getNodesByValueAndTypes (SortedLocationNodes &match_nodes, wasp::HITNodeView view_parent, const std::string &target_value, const std::set< std::string > &target_types) |
Recursively walk input to gather all nodes matching value and types. More... | |
bool | gatherDocumentFormattingTextEdits (wasp::DataArray &formattingTextEdits, int tab_size, bool insert_spaces) |
Gather formatting text edits - specific to this server implemention. More... | |
std::string | formatDocument (wasp::HITNodeView parent, std::size_t &prev_line, std::size_t level) |
Recursively walk down whole nodeview tree while formatting document. More... | |
bool | gatherDocumentSymbols (wasp::DataArray &documentSymbols) |
Gather document symbols - specific to this server implemention. More... | |
bool | traverseParseTreeAndFillSymbols (wasp::HITNodeView view_parent, wasp::DataObject &data_parent) |
Recursively fill document symbols from the given node. More... | |
int | getCompletionItemKind (const InputParameters &valid_params, const std::string ¶m_name, const std::string &clean_type, bool is_param) |
Get completion item kind value that client may use for icon in list. More... | |
int | getDocumentSymbolKind (wasp::HITNodeView symbol_node) |
Get document symbol kind value that client may use for outline icon. More... | |
std::string | getRequiredParamsText (const std::string &subblock_path, const std::string &subblock_type, const std::set< std::string > &existing_params, const std::string &indent_spaces) |
Get required parameter completion text list for given subblock path. More... | |
bool | connectionRead (wasp::DataObject &object) |
Read from connection into object - specific to this server's connection. More... | |
bool | connectionWrite (wasp::DataObject &object) |
Write object json to connection - specific to this server's connection. More... | |
bool | rootIsValid () const |
hit::Node & | getRoot () |
std::shared_ptr< MooseApp > | getCheckApp () const |
const std::string & | getDocumentText () const |
Private Attributes | |
MooseApp & | _moose_app |
_moose_app - reference to parent application that owns this server More... | |
std::map< std::string, std::shared_ptr< MooseApp > > | _check_apps |
_check_apps - map from document paths to input check applications More... | |
std::map< std::string, std::string > | _path_to_text |
_path_to_text - map of document paths to current text strings More... | |
std::shared_ptr< wasp::lsp::IOStreamConnection > | _connection |
_connection - shared pointer to this server's read / write iostream More... | |
std::map< std::string, std::set< std::string > > | _syntax_to_subblocks |
_syntax_to_subblocks - map of syntax paths to valid subblocks More... | |
std::map< std::string, std::set< std::string > > | _type_to_input_paths |
_type_to_input_paths - map of parameter types to lookup paths More... | |
std::map< std::string, std::set< std::string > > | _input_path_to_types |
_type_to_input_paths - map of lookup paths to parameter types More... | |
std::size_t | _formatting_tab_size |
_formatting_tab_size - number of indent spaces for formatting More... | |
Definition at line 28 of file MooseServer.h.
|
private |
SortedLocationNodes - type alias for set of nodes sorted by location.
Definition at line 47 of file MooseServer.h.
MooseServer::MooseServer | ( | MooseApp & | moose_app | ) |
Definition at line 34 of file MooseServer.C.
|
virtualdefault |
|
private |
Add set of nodes sorted by location to definition or reference list.
defsOrRefsLocations | - data array of locations objects to fill |
location_nodes | - set of nodes that have locations to be added |
Definition at line 989 of file MooseServer.C.
Referenced by gatherDocumentDefinitionLocations(), and gatherDocumentReferencesLocations().
|
private |
Add parameters that were previously gathered to list for completion.
completionItems | - list of completion objects to be filled out |
valid_params | - all valid parameters to add to completion list |
existing_params | - set of parameters already existing in input |
replace_line_beg | - start line of autocompletion replace range |
replace_char_beg | - start column of autocomplete replace range |
replace_line_end | - end line of autocomplete replacement range |
replace_char_end | - end column of autocompletion replace range |
filtering_prefix | - beginning text to filter list if not empty |
Definition at line 459 of file MooseServer.C.
Referenced by gatherDocumentCompletionItems().
|
private |
Add subblocks to completion list for request path, line, and column.
completionItems | - list of completion objects to be filled out |
object_path | - full node path where autocomplete was requested |
replace_line_beg | - start line of autocompletion replace range |
replace_char_beg | - start column of autocomplete replace range |
replace_line_end | - end line of autocomplete replacement range |
replace_char_end | - end column of autocompletion replace range |
filtering_prefix | - beginning text to filter list if not empty |
Definition at line 569 of file MooseServer.C.
Referenced by gatherDocumentCompletionItems().
|
private |
Add parameter values to completion list for request line and column.
completionItems | - list of completion objects to be filled out |
valid_params | - all valid parameters used for value completion |
existing_params | - set of parameters already existing in input |
existing_subblocks | - active and inactive subblock name values |
param_name | - name of input parameter for value autocompletion |
obj_act_tasks | - tasks to verify object type with valid syntax |
object_path | - full node path where autocomplete was requested |
replace_line_beg | - start line of autocompletion replace range |
replace_char_beg | - start column of autocomplete replace range |
replace_line_end | - end line of autocomplete replacement range |
replace_char_end | - end column of autocompletion replace range |
Definition at line 671 of file MooseServer.C.
Referenced by gatherDocumentCompletionItems().
|
inlineprivate |
Read from connection into object - specific to this server's connection.
object | - reference to object to be read into |
Definition at line 342 of file MooseServer.h.
|
inlineprivate |
Write object json to connection - specific to this server's connection.
object | - reference to object with contents to write to connection |
Definition at line 349 of file MooseServer.h.
|
private |
Recursively walk down whole nodeview tree while formatting document.
parent | - nodeview for recursive tree traversal starting point |
prev_line | - line of last print for blanks and inline comments |
level | - current level in document tree to use for indentation |
Definition at line 1261 of file MooseServer.C.
Referenced by gatherDocumentFormattingTextEdits().
|
private |
Gather document completion items - specific to this server implemention.
completionItems | - data array of completion item objects to fill |
is_incomplete | - flag indicating if the completions are complete |
line | - line to be used for completions gathering logic |
character | - column to be used for completions gathering logic |
Definition at line 175 of file MooseServer.C.
|
private |
Gather definition locations - specific to this server implemention.
definitionLocations | - data array of locations objects to fill |
line | - line to be used for locations gathering logic |
character | - column to be used for locations gathering logic |
Definition at line 840 of file MooseServer.C.
|
private |
Gather formatting text edits - specific to this server implemention.
formattingTextEdits | - data array of text edit objects to fill |
tab_size | - value of the size of a tab in spaces for formatting |
insert_spaces | - flag indicating whether to use spaces for tabs |
Definition at line 1215 of file MooseServer.C.
|
private |
Gather references locations - specific to this server implemention.
referencesLocations | - data array of locations objects to fill |
line | - line to be used for locations gathering logic |
character | - column to be used for locations gathering logic |
include_declaration | - flag indicating declaration inclusion |
Definition at line 1098 of file MooseServer.C.
|
private |
Gather document symbols - specific to this server implemention.
documentSymbols | - data array of symbols data objects to fill |
Definition at line 1320 of file MooseServer.C.
|
private |
Get all action parameters using requested object path to collection.
valid_params | - collection for filling action input parameters |
object_path | - full node path where autocomplete was requested |
obj_act_tasks | - set for adding in all MooseObjectAction tasks |
Definition at line 361 of file MooseServer.C.
Referenced by getAllValidParameters().
|
private |
Get all global parameters, action parameters, and object parameters.
valid_params | - collection to fill with valid input parameters |
object_path | - full node path where autocomplete was requested |
object_type | - type of object where autocomplete was requested |
obj_act_tasks | - set for adding in all MooseObjectAction tasks |
Definition at line 349 of file MooseServer.C.
Referenced by gatherDocumentCompletionItems(), gatherDocumentDefinitionLocations(), getHoverDisplayText(), getNodesByValueAndTypes(), and getRequiredParamsText().
|
private |
Definition at line 1535 of file MooseServer.C.
Referenced by addSubblocksToList(), addValuesToList(), gatherDocumentDefinitionLocations(), gatherDocumentReferencesLocations(), getActionParameters(), getCompletionItemKind(), getHoverDisplayText(), getInputLookupDefinitionNodes(), getObjectParameters(), getRoot(), parseDocumentForDiagnostics(), and rootIsValid().
|
private |
Get completion item kind value that client may use for icon in list.
valid_params | - valid parameters used for completion item kind |
param_name | - name of input parameter for completion item kind |
clean_type | - type to decide if reference completion item kind |
is_param | - boolean denoting if kind is for parameter or value |
Definition at line 1426 of file MooseServer.C.
Referenced by addParametersToList(), and addValuesToList().
|
inline |
Get read / write connection - specific to this server implemention.
Definition at line 39 of file MooseServer.h.
|
private |
Get document symbol kind value that client may use for outline icon.
symbol_node | - node that will be added to symbol tree for kind |
Definition at line 1457 of file MooseServer.C.
Referenced by gatherDocumentSymbols(), and traverseParseTreeAndFillSymbols().
|
private |
Definition at line 1542 of file MooseServer.C.
Referenced by gatherDocumentFormattingTextEdits().
|
private |
Fill map of all options and descriptions if parameter is moose enum.
moose_enum_param | - parameter to get documentation and options |
options_and_descs | - map to fill with options and descriptions |
Definition at line 828 of file MooseServer.C.
Referenced by addValuesToList(), and getHoverDisplayText().
|
private |
Get names of parameters and subblocks specified in given input node.
parent_node | - object node context under which to gather input |
existing_params | - set to fill with parameter names from input |
existing_subblocks | - set to fill with subblock names in input |
Definition at line 331 of file MooseServer.C.
Referenced by gatherDocumentCompletionItems().
|
private |
Get hover display text - logic specific to this server implemention.
display_text | - string reference to add hover text for display |
line | - zero-based line to use for finding node and hover text |
character | - zero-based column for finding node and hover text |
Definition at line 1016 of file MooseServer.C.
|
private |
Get set of nodes from associated path lookups matching value string.
location_nodes | - set to fill with lookup nodes matching value |
clean_type | - cpp type string used for key finding input paths |
val_string | - specified value used for gathering input lookups |
Definition at line 943 of file MooseServer.C.
Referenced by gatherDocumentDefinitionLocations().
|
private |
Recursively walk input to gather all nodes matching value and types.
match_nodes | - set to fill with nodes matching value and types |
view_parent | - nodeview used to start recursive tree traversal |
target_value | - |
target_types | - |
Definition at line 1170 of file MooseServer.C.
Referenced by gatherDocumentReferencesLocations().
|
private |
Get all object parameters using requested object path to collection.
valid_params | - collection for filling object input parameters |
object_type | - type of object where autocomplete was requested |
obj_act_tasks | - tasks to verify object type with valid syntax |
Definition at line 406 of file MooseServer.C.
Referenced by getAllValidParameters().
|
private |
Get required parameter completion text list for given subblock path.
subblock_path | - subblock path for finding required parameters |
subblock_type | - subblock type for finding required parameters |
existing_params | - set of parameters already existing in input |
indent_spaces | - indentation to be added before each parameter |
Definition at line 1495 of file MooseServer.C.
Referenced by addSubblocksToList(), and addValuesToList().
|
private |
Definition at line 1528 of file MooseServer.C.
Referenced by addValuesToList(), gatherDocumentCompletionItems(), gatherDocumentDefinitionLocations(), gatherDocumentReferencesLocations(), gatherDocumentSymbols(), getHoverDisplayText(), and getInputLookupDefinitionNodes().
|
private |
Parse document for diagnostics - specific to this server implemention.
diagnosticsList | - data array of diagnostics data objects to fill |
Definition at line 55 of file MooseServer.C.
|
private |
Will be true if the app is valid, the root is not nullptr, and the root node view is not null
Definition at line 1521 of file MooseServer.C.
Referenced by gatherDocumentCompletionItems(), gatherDocumentDefinitionLocations(), gatherDocumentReferencesLocations(), gatherDocumentSymbols(), getHoverDisplayText(), and getRoot().
|
private |
Recursively fill document symbols from the given node.
view_parent | - nodeview used in recursive tree traversal |
data_parent | - data object with array of symbol children |
Definition at line 1374 of file MooseServer.C.
Referenced by gatherDocumentSymbols().
|
private |
Update document text changes - specific to this server implemention.
replacement_text | - text to be replaced over the provided range |
start_line | - starting replace line number ( zero-based ) |
start_character | - starting replace column number ( zero-based ) |
end_line | - ending replace line number ( zero-based ) |
end_character | - ending replace column number ( zero-based ) |
range_length | - length of replace range - server specific |
Definition at line 161 of file MooseServer.C.
|
private |
_check_apps - map from document paths to input check applications
Definition at line 381 of file MooseServer.h.
Referenced by getCheckApp(), and parseDocumentForDiagnostics().
|
private |
_connection - shared pointer to this server's read / write iostream
Definition at line 391 of file MooseServer.h.
Referenced by connectionRead(), connectionWrite(), and getConnection().
|
private |
_formatting_tab_size - number of indent spaces for formatting
Definition at line 411 of file MooseServer.h.
Referenced by formatDocument(), and gatherDocumentFormattingTextEdits().
|
private |
_type_to_input_paths - map of lookup paths to parameter types
Definition at line 406 of file MooseServer.h.
Referenced by gatherDocumentReferencesLocations().
|
private |
_moose_app - reference to parent application that owns this server
Definition at line 376 of file MooseServer.h.
Referenced by parseDocumentForDiagnostics().
|
private |
_path_to_text - map of document paths to current text strings
Definition at line 386 of file MooseServer.h.
Referenced by getDocumentText(), and parseDocumentForDiagnostics().
|
private |
_syntax_to_subblocks - map of syntax paths to valid subblocks
Definition at line 396 of file MooseServer.h.
Referenced by addSubblocksToList().
|
private |
_type_to_input_paths - map of parameter types to lookup paths
Definition at line 401 of file MooseServer.h.
Referenced by addValuesToList(), and getInputLookupDefinitionNodes().