#include <MooseServer.h>
Classes | |
struct | CheckState |
Helper for storing the state for a single document. More... | |
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 |
const hit::Node * | queryRoot () const |
const std::string * | queryDocumentText () const |
MooseApp & | getCheckApp () |
const hit::Node & | getRoot () const |
const std::string & | getDocumentText () const |
const CheckState * | queryCheckState () const |
CheckState * | queryCheckState () |
const MooseApp * | queryCheckApp () const |
MooseApp * | queryCheckApp () |
const Parser * | queryCheckParser () const |
Parser * | queryCheckParser () |
Private Attributes | |
MooseApp & | _moose_app |
_moose_app - reference to parent application that owns this server More... | |
std::map< std::string, CheckState > | _check_state |
_check_state - map from document paths to state (parser, app, text) 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 35 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 1081 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 545 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 655 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 757 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 1357 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 258 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 930 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 1311 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 1192 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 1416 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 447 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 435 of file MooseServer.C.
Referenced by gatherDocumentCompletionItems(), gatherDocumentDefinitionLocations(), getHoverDisplayText(), getNodesByValueAndTypes(), and getRequiredParamsText().
|
private |
Definition at line 1691 of file MooseServer.C.
Referenced by parseDocumentForDiagnostics().
|
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 1524 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 1555 of file MooseServer.C.
Referenced by gatherDocumentSymbols(), and traverseParseTreeAndFillSymbols().
|
private |
Definition at line 1712 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 918 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 417 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 1108 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 1035 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 1266 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 492 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 1593 of file MooseServer.C.
Referenced by addSubblocksToList(), and addValuesToList().
|
private |
Definition at line 1704 of file MooseServer.C.
Referenced by addValuesToList(), and getInputLookupDefinitionNodes().
|
private |
Parse document for diagnostics - specific to this server implemention.
diagnosticsList | - data array of diagnostics data objects to fill |
Definition at line 56 of file MooseServer.C.
|
private |
Definition at line 1665 of file MooseServer.C.
Referenced by getCheckApp(), and queryRoot().
|
private |
Definition at line 1673 of file MooseServer.C.
|
private |
Definition at line 1652 of file MooseServer.C.
Referenced by getCheckApp(), queryDocumentText(), and queryRoot().
|
private |
Definition at line 1659 of file MooseServer.C.
|
private |
Definition at line 1639 of file MooseServer.C.
Referenced by queryCheckApp(), and queryCheckParser().
|
private |
Definition at line 1646 of file MooseServer.C.
|
private |
Definition at line 1679 of file MooseServer.C.
Referenced by getDocumentText().
|
private |
Definition at line 1623 of file MooseServer.C.
Referenced by gatherDocumentCompletionItems(), gatherDocumentDefinitionLocations(), gatherDocumentReferencesLocations(), gatherDocumentSymbols(), getHoverDisplayText(), and getRoot().
|
private |
Will be true if the app is valid, the root is not nullptr, and the root node view is not null
|
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 1472 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 244 of file MooseServer.C.
|
private |
_check_state - map from document paths to state (parser, app, text)
Definition at line 421 of file MooseServer.h.
Referenced by parseDocumentForDiagnostics(), and queryCheckState().
|
private |
_connection - shared pointer to this server's read / write iostream
Definition at line 426 of file MooseServer.h.
Referenced by connectionRead(), connectionWrite(), and getConnection().
|
private |
_formatting_tab_size - number of indent spaces for formatting
Definition at line 446 of file MooseServer.h.
Referenced by formatDocument(), and gatherDocumentFormattingTextEdits().
|
private |
_type_to_input_paths - map of lookup paths to parameter types
Definition at line 441 of file MooseServer.h.
Referenced by gatherDocumentReferencesLocations().
|
private |
_moose_app - reference to parent application that owns this server
Definition at line 416 of file MooseServer.h.
Referenced by addSubblocksToList(), addValuesToList(), gatherDocumentDefinitionLocations(), gatherDocumentReferencesLocations(), getActionParameters(), getCompletionItemKind(), getHoverDisplayText(), getInputLookupDefinitionNodes(), getObjectParameters(), and parseDocumentForDiagnostics().
|
private |
_syntax_to_subblocks - map of syntax paths to valid subblocks
Definition at line 431 of file MooseServer.h.
Referenced by addSubblocksToList().
|
private |
_type_to_input_paths - map of parameter types to lookup paths
Definition at line 436 of file MooseServer.h.
Referenced by addValuesToList(), and getInputLookupDefinitionNodes().