13 #include "wasplsp/LSP.h" 14 #include "wasplsp/ServerImpl.h" 15 #include "wasplsp/Connection.h" 16 #include "libmesh/ignore_warnings.h" 17 #include "wasplsp/IOStreamConnection.h" 18 #include "libmesh/restore_warnings.h" 19 #include "waspcore/Object.h" 20 #include "wasphit/HITNodeView.h" 21 #include "waspsiren/SIRENInterpreter.h" 22 #include "waspsiren/SIRENResultSet.h" 23 #include "waspplot/CustomPlotFile.h" 47 std::set<wasp::HITNodeView,
48 std::function<bool(const wasp::HITNodeView &, const wasp::HITNodeView &)>>;
89 std::set<std::string> & existing_params,
90 std::set<std::string> & existing_subblocks);
100 const std::string & object_path,
101 const std::string & object_type,
102 std::set<std::string> & obj_act_tasks);
111 const std::string & object_path,
112 std::set<std::string> & obj_act_tasks);
121 std::string object_type,
122 const std::set<std::string> & obj_act_tasks);
138 const std::set<std::string> & existing_params,
139 int replace_line_beg,
140 int replace_char_beg,
141 int replace_line_end,
142 int replace_char_end,
143 const std::string & filtering_prefix);
157 const std::string & object_path,
158 int replace_line_beg,
159 int replace_char_beg,
160 int replace_line_end,
161 int replace_char_end,
162 const std::string & filtering_prefix,
163 bool request_on_block_decl);
182 const std::set<std::string> & existing_params,
183 const std::set<std::string> & existing_subblocks,
184 const std::string & param_name,
185 const std::set<std::string> & obj_act_tasks,
186 const std::string & object_path,
187 int replace_line_beg,
188 int replace_char_beg,
189 int replace_line_end,
190 int replace_char_end);
197 template <
typename MooseEnumType>
199 std::map<std::string, std::string> & options_and_descs);
218 const std::string & clean_type,
219 const std::string & val_string);
250 bool include_declaration);
260 wasp::HITNodeView view_parent,
261 const std::string & target_value,
262 const std::set<std::string> & target_types);
282 std::string
formatDocument(wasp::HITNodeView parent, std::size_t & prev_line, std::size_t level);
298 wasp::DataObject & data_parent);
309 const std::string & param_name,
310 const std::string & clean_type,
329 const std::string & subblock_type,
330 const std::set<std::string> & existing_params,
331 const std::string & indent_spaces);
342 const std::string & extensionMethod,
363 const std::string & plot_title,
364 const std::vector<double> & graph_keys,
365 const std::vector<double> & graph_vals);
395 std::unique_ptr<MooseApp>
app;
432 const hit::Node &
getRoot()
const;
int getDocumentSymbolKind(wasp::HITNodeView symbol_node)
Get document symbol kind value that client may use for outline icon.
std::map< std::string, std::set< std::string > > _type_to_input_paths
_type_to_input_paths - map of parameter types to lookup paths
void addResourcesForDocument()
Add paths from includes and FileName parameters for client to watch.
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.
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.
std::map< std::string, std::set< std::string > > _input_path_to_types
_type_to_input_paths - map of lookup paths to parameter types
MooseServer(MooseApp &moose_app)
void buildLineGraphPlot(wasp::CustomPlot &plot_object, const std::string &plot_title, const std::vector< double > &graph_keys, const std::vector< double > &graph_vals)
Build CustomPlot graph with provided keys, values, and plot title.
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.
bool gatherDocumentSymbols(wasp::DataArray &documentSymbols)
Gather document symbols - specific to this server implemention.
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.
std::shared_ptr< Parser > parser
Base class for MOOSE-based applications.
const hit::Node & getRoot() const
bool getHoverDisplayText(std::string &display_text, int line, int character)
Get hover display text - logic specific to this server implemention.
const CheckState * queryCheckState() const
std::set< wasp::HITNodeView, std::function< bool(const wasp::HITNodeView &, const wasp::HITNodeView &)> > SortedLocationNodes
SortedLocationNodes - type alias for set of nodes sorted by location.
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.
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.
std::shared_ptr< wasp::lsp::Connection > getConnection()
Get read / write connection - specific to this server implemention.
std::shared_ptr< wasp::lsp::IOStreamConnection > _connection
_connection - shared pointer to this server's read / write iostream
CheckState(std::shared_ptr< Parser > &parser)
const Parser * queryCheckParser() const
const MooseApp * queryCheckApp() const
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.
Helper for storing the state for a single document.
bool gatherDocumentFormattingTextEdits(wasp::DataArray &formattingTextEdits, int tab_size, bool insert_spaces)
Gather formatting text edits - specific to this server implemention.
void getFileNameTypeValues(std::set< std::string > &filename_vals, wasp::HITNodeView parent)
Recursively walk input to gather all FileName type parameter values.
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.
bool traverseParseTreeAndFillSymbols(wasp::HITNodeView view_parent, wasp::DataObject &data_parent)
Recursively fill document symbols from the given node.
bool gatherExtensionResponses(wasp::DataArray &extensionResponses, const std::string &extensionMethod, int line, int character)
Gather extension responses - specific to this server implemention.
MooseApp & _moose_app
_moose_app - reference to parent application that owns this server
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.
bool gatherDocumentCompletionItems(wasp::DataArray &completionItems, bool &is_incomplete, int line, int character)
Gather document completion items - specific to this server implemention.
std::unique_ptr< MooseApp > app
bool gatherDocumentReferencesLocations(wasp::DataArray &referencesLocations, int line, int character, bool include_declaration)
Gather references locations - specific to this server implemention.
std::size_t _formatting_tab_size
_formatting_tab_size - number of indent spaces for formatting
bool gatherPlottingResponses(wasp::DataArray &plottingResponses, int line, int character)
Build CustomPlot extension responses when method name is plotting.
bool connectionRead(wasp::DataObject &object)
Read from connection into object - specific to this server's connection.
bool parseDocumentForDiagnostics(wasp::DataArray &diagnosticsList)
Parse document for diagnostics - specific to this server implemention.
bool gatherDocumentDefinitionLocations(wasp::DataArray &definitionLocations, int line, int character)
Gather definition locations - specific to this server implemention.
bool addLocationNodesToList(wasp::DataArray &defsOrRefsLocations, const SortedLocationNodes &location_nodes)
Add set of nodes sorted by location to definition or reference list.
bool connectionWrite(wasp::DataObject &object)
Write object json to connection - specific to this server's connection.
std::map< std::string, std::set< std::string > > _syntax_to_subblocks
_syntax_to_subblocks - map of syntax paths to valid subblocks
virtual ~MooseServer()=default
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.
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.
Class for parsing input files.
std::map< std::string, CheckState > _check_state
_check_state - map from document paths to state (parser, app, text)
const hit::Node * queryRoot() const
std::string formatDocument(wasp::HITNodeView parent, std::size_t &prev_line, std::size_t level)
Recursively walk down whole nodeview tree while formatting document.
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.