diff options
Diffstat (limited to 'graphics/asymptote/LspCpp')
214 files changed, 13684 insertions, 12922 deletions
diff --git a/graphics/asymptote/LspCpp/CMakeLists.txt b/graphics/asymptote/LspCpp/CMakeLists.txt index 7b11cd2978..6b12b045c1 100644 --- a/graphics/asymptote/LspCpp/CMakeLists.txt +++ b/graphics/asymptote/LspCpp/CMakeLists.txt @@ -11,7 +11,8 @@ endif() set(LIB_MAJOR_VERSION "1") set(LIB_MINOR_VERSION "0") set(LIB_PATCH_VERSION "0") -set(LIB_VERSION_STRING "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_PATCH_VERSION}") +set(LIB_TWEAK_VERSION "0") +set(LIB_VERSION_STRING "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_PATCH_VERSION}.${LIB_TWEAK_VERSION}") # Without this, paths are not relative in the sources list cmake_policy(SET CMP0076 NEW) @@ -25,6 +26,39 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) endif() +set(LSPCPP_DEBUG_POSTFIX d CACHE STRING "Debug library postfix.") +# Set LSPCPP_LIB_NAME for pkg-config lspcpp.pc. We cannot use the OUTPUT_NAME target +# property because it's not set by default. +set(LSPCPP_LIB_NAME lspcpp) +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(LSPCPP_LIB_NAME ${LSPCPP_LIB_NAME}${LSPCPP_DEBUG_POSTFIX}) +endif () + +include(CMakeParseArguments) +# Joins arguments and places the results in ${result_var}. +function(join result_var) + set(result "") + foreach (arg ${ARGN}) + set(result "${result}${arg}") + endforeach () + set(${result_var} "${result}" PARENT_SCOPE) +endfunction() +# Sets a cache variable with a docstring joined from multiple arguments: +# set(<variable> <value>... CACHE <type> <docstring>...) +# This allows splitting a long docstring for readability. +function(set_verbose) + # cmake_parse_arguments is broken in CMake 3.4 (cannot parse CACHE) so use + # list instead. + list(GET ARGN 0 var) + list(REMOVE_AT ARGN 0) + list(GET ARGN 0 val) + list(REMOVE_AT ARGN 0) + list(REMOVE_AT ARGN 0) + list(GET ARGN 0 type) + list(REMOVE_AT ARGN 0) + join(doc ${ARGN}) + set(${var} ${val} CACHE ${type} ${doc}) +endfunction() ########################################################### # Options ########################################################### @@ -54,6 +88,11 @@ where the tar.gz file is extracted to. This directory must be an absolute path. If this setting is set, LspCpp will use downloaded GC regardless of whether GC from find_package or pkg_config is available or not. ") +option_if_not_defined(LSPCPP_GC_STATIC "Compiling with static gc library. Only used if a custom GC root is given" OFF) +set(LSPCPP_WIN32_WINNT_VALUE "0x0A00" CACHE STRING + "Value to specify for _WIN32_WINNT macro when compiling on windows. See +https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-170" +) ########################################################### # Boehm GC @@ -187,6 +226,10 @@ function(lspcpp_set_target_options target) if (LSPCPP_GC_DOWNLOADED_ROOT) message(STATUS "Using manually downloaded GC") target_include_directories(${target} PUBLIC ${LSPCPP_GC_DOWNLOADED_ROOT}/include) + + if (LSPCPP_GC_STATIC) + target_compile_definitions(${target} PUBLIC GC_NOT_DLL) + endif() else() if (NOT GC_USE_PKGCONFIG) message(STATUS "Using cmake config for locating gc") @@ -208,6 +251,9 @@ function(lspcpp_set_target_options target) target_compile_definitions(${target} PUBLIC LSPCPP_USEGC) endif() + if (WIN32) + target_compile_definitions(${target} PRIVATE _WIN32_WINNT=${LSPCPP_WIN32_WINNT_VALUE}) + endif() endfunction() @@ -232,12 +278,14 @@ if (CMAKE_GENERATOR MATCHES "Visual Studio.*") INSTALL_NUGET(boost_thread-vc141 1.76.0.0) else() - find_package(Boost COMPONENTS date_time chrono filesystem system thread program_options) + find_package(Boost CONFIG COMPONENTS date_time chrono filesystem system thread program_options) if(NOT Boost_FOUND) if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") message(FATAL_ERROR "Can't find boost,lease build boost and install it or install boost with : brew install boost") elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") message(FATAL_ERROR "Can't find boost,please build boost and install it. or install boost with : sudo apt-get install libboost-dev") + else() + message(FATAL_ERROR "Boost not found. Please ensure boost is available for CMake.") endif() endif() endif() @@ -271,15 +319,17 @@ endif() # lsp add_library(lspcpp STATIC) - +set (LSP_INCLUDE_LIST ${LSPCPP_INCLUDE_DIR} + ${Boost_INCLUDE_DIRS} + ${RapidJSON_INCLUDE_DIRS} + ${Uri_SOURCE_DIR}/include) ### Includes -target_include_directories(lspcpp - PUBLIC - ${LSPCPP_INCLUDE_DIR} - ${Boost_INCLUDE_DIRS} - ${RapidJSON_INCLUDE_DIRS} - ${Uri_SOURCE_DIR}/include - ) + +if (LSPCPP_INSTALL) + target_include_directories(lspcpp PRIVATE ${LSP_INCLUDE_LIST}) +else() + target_include_directories(lspcpp PUBLIC ${LSP_INCLUDE_LIST}) +endif() target_link_libraries(lspcpp PUBLIC network-uri ${Boost_LIBRARIES}) @@ -338,10 +388,67 @@ target_sources(lspcpp PRIVATE lspcpp_set_target_options(lspcpp) set_target_properties(lspcpp PROPERTIES POSITION_INDEPENDENT_CODE 1) +set_target_properties(lspcpp PROPERTIES + DEBUG_POSTFIX "${LSPCPP_DEBUG_POSTFIX}" + + # Workaround for Visual Studio 2017: + # Ensure the .pdb is created with the same name and in the same directory + # as the .lib. Newer VS versions already do this by default, but there is no + # harm in setting it for those too. Ignored by other generators. + COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" + COMPILE_PDB_NAME "lspcpp" + COMPILE_PDB_NAME_DEBUG "lspcpp${LSPCPP_DEBUG_POSTFIX}") # install if(LSPCPP_INSTALL) + include(${CMAKE_CURRENT_SOURCE_DIR}/support/cmake/JoinPaths.cmake) include(GNUInstallDirs) + include(CMakePackageConfigHelpers) + set(targets_export_name lspcpp-targets) + set(project_config ${PROJECT_BINARY_DIR}/lspcpp-config.cmake) + set(version_config ${PROJECT_BINARY_DIR}/lspcpp-config-version.cmake) + set(pkgconfig ${PROJECT_BINARY_DIR}/lspcpp.pc) + + set_verbose(LSPCPP_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING + "Installation directory for libraries, a relative path that " + "will be joined to ${CMAKE_INSTALL_PREFIX} or an absolute path.") + + set_verbose(LSPCPP_PKGCONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig CACHE STRING + "Installation directory for pkgconfig (.pc) files, a relative " + "path that will be joined with ${CMAKE_INSTALL_PREFIX} or an " + "absolute path.") + + set_verbose(LSPCPP_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/lspcpp CACHE STRING + "Installation directory for cmake files, a relative path that " + "will be joined with ${CMAKE_INSTALL_PREFIX} or an absolute " + "path.") + + configure_package_config_file( + ${PROJECT_SOURCE_DIR}/support/cmake/lspcpp-config.cmake.in + ${project_config} + INSTALL_DESTINATION ${LSPCPP_CMAKE_DIR} ) + write_basic_package_version_file( + ${version_config} + VERSION ${LIB_VERSION_STRING} + COMPATIBILITY SameMajorVersion + ) + join_paths(libdir_for_pc_file "\${exec_prefix}" "${LSPCPP_LIB_DIR}") + join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") + + configure_file( + "${PROJECT_SOURCE_DIR}/support/cmake/lspcpp.pc.in" + "${pkgconfig}" + @ONLY) + + install(TARGETS network-uri + EXPORT NetworkURITargets + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + install(EXPORT NetworkURITargets + FILE NetworkURITargets.cmake + DESTINATION lib/cmake/NetworkURI) install(DIRECTORY ${LSPCPP_INCLUDE_DIR}/LibLsp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} @@ -349,18 +456,22 @@ if(LSPCPP_INSTALL) ) install(TARGETS lspcpp - EXPORT lspcpp-targets + EXPORT ${targets_export_name} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) - install(EXPORT lspcpp-targets - FILE lspcpp-config.cmake + install(EXPORT ${targets_export_name} NAMESPACE lspcpp:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lspcpp + DESTINATION ${LSPCPP_CMAKE_DIR} ) + install( + FILES ${project_config} ${version_config} + DESTINATION ${LSPCPP_CMAKE_DIR} + ) + install(FILES "${pkgconfig}" DESTINATION "${LSPCPP_PKGCONFIG_DIR}") endif() # examples @@ -379,7 +490,7 @@ if(LSPCPP_BUILD_EXAMPLES) function(build_example target) add_executable(${target} "${CMAKE_CURRENT_SOURCE_DIR}/examples/${target}.cpp") - target_include_directories(${target} PRIVATE ${Uri_SOURCE_DIR}/include) + target_include_directories(${target} PRIVATE ${LSP_INCLUDE_LIST}) set_target_properties(${target} PROPERTIES FOLDER "Examples" ) @@ -400,4 +511,4 @@ if(LSPCPP_BUILD_EXAMPLES) endif() # Add a distclean target to the Makefile -ADD_CUSTOM_TARGET(distclean COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/distclean.cmake) +ADD_CUSTOM_TARGET(distclean COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/support/cmake/distclean.cmake) diff --git a/graphics/asymptote/LspCpp/CMakePresets.json b/graphics/asymptote/LspCpp/CMakePresets.json new file mode 100644 index 0000000000..19764fb87e --- /dev/null +++ b/graphics/asymptote/LspCpp/CMakePresets.json @@ -0,0 +1,30 @@ +{ + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 25, + "patch": 0 + }, + "configurePresets": [ + { + "name": "ci/default", + "description": "Default profile for CI to build. uses vcpkg, C++17 and vcpkg rapidjson", + "generator": "Ninja", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "release", + "USE_SYSTEM_RAPIDJSON": "true", + "LSPCPP_USE_CPP17": "true", + "LSPCPP_SUPPORT_BOEHM_GC": "$env{LSPCPP_SUPPORT_BOEHM_GC}", + "VCPKG_MANIFEST_FEATURES": "$env{LSPCPP_CI_VCPKG_FEATURES}", + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + }, + "binaryDir": "${sourceDir}/cmake-build-ci" + } + ], + "buildPresets": [ + { + "name": "ci/default", + "configurePreset": "ci/default" + } + ] +} diff --git a/graphics/asymptote/LspCpp/README.md b/graphics/asymptote/LspCpp/README.md index afdd8814cf..6425aa64b8 100644 --- a/graphics/asymptote/LspCpp/README.md +++ b/graphics/asymptote/LspCpp/README.md @@ -38,8 +38,10 @@ Some code from :[cquery][1] ## Projects using LspCpp: -* [JCIDE](https://www.javacardos.com/tools) +* [JCIDE](https://www.javacardos.com/javacardforum/viewtopic.php?f=5&t=3569&sid=e01238adf55cd08696fbf495dfa6c8e5) * [LPG-language-server](https://github.com/kuafuwang/LPG-language-server) +* [Asymptote](https://github.com/vectorgraphics) +* [chemical](https://github.com/chemicallang/chemical) ## License MIT @@ -47,7 +49,18 @@ [It's here](https://github.com/kuafuwang/LspCpp/tree/master/examples) +## Development guide + +For any merges into the master branch, ensure the C++ code complies with the clang-format standard. +As of currently, the latest clang-format version offered in ubuntu 24.04 (18) is used, but this +may change in the future as newer versions of clang-format is available for Ubuntu. + +To check the current version of clang-format used, see the check-format-cpp workflow. It prints out +the version used. Ensure the C++ code is compliant with that version of clang-format. + +`vcpkg.json` is optionally provided for convenience. It is not required for compiling LspCpp. + + [1]: https://github.com/cquery-project/cquery "cquery:" [2]: https://www.javacardos.com/tools "JcKit:" [3]: https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore "Package Restore" - diff --git a/graphics/asymptote/LspCpp/cmake_install.cmake b/graphics/asymptote/LspCpp/cmake_install.cmake new file mode 100644 index 0000000000..c346f7a641 --- /dev/null +++ b/graphics/asymptote/LspCpp/cmake_install.cmake @@ -0,0 +1,67 @@ +# Install script for directory: /usr/local/src/asymptote-2.96/LspCpp + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "0") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set path to fallback-tool for dependency-resolution. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/bin/objdump") +endif() + +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + # Include the install script for the subdirectory. + include("/usr/local/src/asymptote-2.96/LspCpp/third_party/uri/cmake_install.cmake") +endif() + +if(CMAKE_INSTALL_COMPONENT) + if(CMAKE_INSTALL_COMPONENT MATCHES "^[a-zA-Z0-9_.+-]+$") + set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") + else() + string(MD5 CMAKE_INST_COMP_HASH "${CMAKE_INSTALL_COMPONENT}") + set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INST_COMP_HASH}.txt") + unset(CMAKE_INST_COMP_HASH) + endif() +else() + set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") +endif() + +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT + "${CMAKE_INSTALL_MANIFEST_FILES}") + file(WRITE "/usr/local/src/asymptote-2.96/LspCpp/${CMAKE_INSTALL_MANIFEST}" + "${CMAKE_INSTALL_MANIFEST_CONTENT}") +endif() diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/Cancellation.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/Cancellation.h index 496be29844..1fcd0a0097 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/Cancellation.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/Cancellation.h @@ -6,18 +6,17 @@ using CancelMonitor = std::function<int()>; namespace Cancellation { - struct Params { - /** +struct Params +{ + /** * The request id to cancel. */ - lsRequestId id; - - MAKE_SWAP_METHOD(Cancellation::Params, id); - }; + lsRequestId id; + MAKE_SWAP_METHOD(Cancellation::Params, id); }; -MAKE_REFLECT_STRUCT(Cancellation::Params, id); - -DEFINE_NOTIFICATION_TYPE(Notify_Cancellation, Cancellation::Params,"$/cancelRequest"); +}; // namespace Cancellation +MAKE_REFLECT_STRUCT(Cancellation::Params, id); +DEFINE_NOTIFICATION_TYPE(Notify_Cancellation, Cancellation::Params, "$/cancelRequest"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/Condition.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/Condition.h index 6a8cf7a2a6..074f78296c 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/Condition.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/Condition.h @@ -1,48 +1,56 @@ #pragma once #include <condition_variable> -template <class T> +template<class T> class Condition { public: - - std::mutex m_mutex; - std::condition_variable m_condition; - ~Condition() { - m_condition.notify_all(); + std::mutex m_mutex; + std::condition_variable m_condition; + ~Condition() + { + m_condition.notify_all(); + } + void notify(std::unique_ptr<T> data) noexcept + { + { + std::lock_guard<std::mutex> eventLock(m_mutex); + any.swap(data); } - void notify(std::unique_ptr<T> data) noexcept + // wake up one waiter + m_condition.notify_one(); + }; + + std::unique_ptr<T> wait(unsigned timeout = 0) + { + std::unique_lock<std::mutex> ul(m_mutex); + if (!timeout) { + m_condition.wait( + ul, + [&]() { - std::lock_guard<std::mutex> eventLock(m_mutex); - any.swap(data); + if (!any) + { + return false; + } + return true; } - // wake up one waiter - m_condition.notify_one(); - }; - - - std::unique_ptr<T> wait(unsigned timeout=0) + ); + } + else { - std::unique_lock<std::mutex> ul(m_mutex); - if (!timeout) { - m_condition.wait(ul,[&]() { - if (!any) - return false; - return true; - }); - } - else{ - if(!any){ - std::cv_status status = m_condition.wait_for(ul, std::chrono::milliseconds(timeout)); - if (status == std::cv_status::timeout) - { - return {}; - } - } + if (!any) + { + std::cv_status status = m_condition.wait_for(ul, std::chrono::milliseconds(timeout)); + if (status == std::cv_status::timeout) + { + return {}; } - return std::unique_ptr<T>(any.release()); - + } } + return std::unique_ptr<T>(any.release()); + } + private: - std::unique_ptr<T> any; + std::unique_ptr<T> any; }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/Context.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/Context.h index 20edf71b1c..a562327b06 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/Context.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/Context.h @@ -16,8 +16,8 @@ #include <memory> #include <type_traits> -namespace lsp { - +namespace lsp +{ /// Values in a Context are indexed by typed keys. /// Key<T> serves two purposes: @@ -34,17 +34,18 @@ namespace lsp { /// /// Keys are typically used across multiple functions, so most of the time you /// would want to make them static class members or global variables. -template <class Type> class Key { +template<class Type> +class Key +{ public: - static_assert(!std::is_reference<Type>::value, - "Reference arguments to Key<> are not allowed"); + static_assert(!std::is_reference<Type>::value, "Reference arguments to Key<> are not allowed"); - constexpr Key() = default; + constexpr Key() = default; - Key(Key const &) = delete; - Key &operator=(Key const &) = delete; - Key(Key &&) = delete; - Key &operator=(Key &&) = delete; + Key(Key const&) = delete; + Key& operator=(Key const&) = delete; + Key(Key&&) = delete; + Key& operator=(Key&&) = delete; }; /// A context is an immutable container for per-request data that must be @@ -63,154 +64,182 @@ public: /// You can't add data to an existing context, instead you create a new /// immutable context derived from it with extra data added. When you retrieve /// data, the context will walk up the parent chain until the key is found. -class Context { +class Context +{ public: - /// Returns an empty root context that contains no data. - static Context empty(); - /// Returns the context for the current thread, creating it if needed. - static const Context ¤t(); - // Sets the current() context to Replacement, and returns the old context. - // Prefer to use WithContext or WithContextValue to do this safely. - static Context swapCurrent(Context Replacement); + /// Returns an empty root context that contains no data. + static Context empty(); + /// Returns the context for the current thread, creating it if needed. + static Context const& current(); + // Sets the current() context to Replacement, and returns the old context. + // Prefer to use WithContext or WithContextValue to do this safely. + static Context swapCurrent(Context Replacement); private: - struct Data; - Context(std::shared_ptr<const Data> DataPtr); + struct Data; + Context(std::shared_ptr<Data const> DataPtr); public: - /// Same as Context::empty(), please use Context::empty() instead. - Context() = default; - - /// Copy operations for this class are deleted, use an explicit clone() method - /// when you need a copy of the context instead. - Context(Context const &) = delete; - Context &operator=(const Context &) = delete; - - Context(Context &&) = default; - Context &operator=(Context &&) = default; - - /// Get data stored for a typed \p Key. If values are not found - /// \returns Pointer to the data associated with \p Key. If no data is - /// specified for \p Key, return null. - template <class Type> const Type *get(const Key<Type> &Key) const { - for (const Data *DataPtr = this->dataPtr.get(); DataPtr != nullptr; - DataPtr = DataPtr->parent.get()) { - if (DataPtr->KeyPtr == &Key) - return static_cast<const Type *>(DataPtr->value->getValuePtr()); + /// Same as Context::empty(), please use Context::empty() instead. + Context() = default; + + /// Copy operations for this class are deleted, use an explicit clone() method + /// when you need a copy of the context instead. + Context(Context const&) = delete; + Context& operator=(Context const&) = delete; + + Context(Context&&) = default; + Context& operator=(Context&&) = default; + + /// Get data stored for a typed \p Key. If values are not found + /// \returns Pointer to the data associated with \p Key. If no data is + /// specified for \p Key, return null. + template<class Type> + Type const* get(Key<Type> const& Key) const + { + for (Data const* DataPtr = this->dataPtr.get(); DataPtr != nullptr; DataPtr = DataPtr->parent.get()) + { + if (DataPtr->KeyPtr == &Key) + { + return static_cast<Type const*>(DataPtr->value->getValuePtr()); + } + } + return nullptr; + } + + /// A helper to get a reference to a \p Key that must exist in the map. + /// Must not be called for keys that are not in the map. + template<class Type> + Type const& getExisting(Key<Type> const& Key) const + { + auto Val = get(Key); + assert(Val && "Key does not exist"); + return *Val; + } + + /// Derives a child context + /// It is safe to move or destroy a parent context after calling derive(). + /// The child will keep its parent alive, and its data remains accessible. + template<class Type> + Context derive(Key<Type> const& Key, typename std::decay<Type>::type Value) const& + { + return Context(std::make_shared<Data>(Data { + /*parent=*/dataPtr, &Key, + std::make_unique<TypedAnyStorage<typename std::decay<Type>::type>>(std::move(Value)) + })); + } + + template<class Type> + Context derive(Key<Type> const& Key, typename std::decay<Type>::type Value) && /* takes ownership */ + { + return Context(std::make_shared<Data>(Data { + /*parent=*/std::move(dataPtr), &Key, + std::make_unique<TypedAnyStorage<typename std::decay<Type>::type>>(std::move(Value)) + })); + } + + /// Derives a child context, using an anonymous key. + /// Intended for objects stored only for their destructor's side-effect. + template<class Type> + Context derive(Type&& Value) const& + { + static Key<typename std::decay<Type>::type> Private; + return derive(Private, std::forward<Type>(Value)); } - return nullptr; - } - - /// A helper to get a reference to a \p Key that must exist in the map. - /// Must not be called for keys that are not in the map. - template <class Type> const Type &getExisting(const Key<Type> &Key) const { - auto Val = get(Key); - assert(Val && "Key does not exist"); - return *Val; - } - - /// Derives a child context - /// It is safe to move or destroy a parent context after calling derive(). - /// The child will keep its parent alive, and its data remains accessible. - template <class Type> - Context derive(const Key<Type> &Key, - typename std::decay<Type>::type Value) const & { - return Context(std::make_shared<Data>( - Data{/*parent=*/dataPtr, &Key, - std::make_unique<TypedAnyStorage<typename std::decay<Type>::type>>( - std::move(Value))})); - } - - template <class Type> - Context - derive(const Key<Type> &Key, - typename std::decay<Type>::type Value) && /* takes ownership */ { - return Context(std::make_shared<Data>( - Data{/*parent=*/std::move(dataPtr), &Key, - std::make_unique<TypedAnyStorage<typename std::decay<Type>::type>>( - std::move(Value))})); - } - - /// Derives a child context, using an anonymous key. - /// Intended for objects stored only for their destructor's side-effect. - template <class Type> Context derive(Type &&Value) const & { - static Key<typename std::decay<Type>::type> Private; - return derive(Private, std::forward<Type>(Value)); - } - - template <class Type> Context derive(Type &&Value) && { - static Key<typename std::decay<Type>::type> Private; - return std::move(*this).derive(Private, std::forward<Type>(Value)); - } - - /// Clone this context object. - Context clone() const; + + template<class Type> + Context derive(Type&& Value) && + { + static Key<typename std::decay<Type>::type> Private; + return std::move(*this).derive(Private, std::forward<Type>(Value)); + } + + /// Clone this context object. + Context clone() const; private: - class AnyStorage { - public: - virtual ~AnyStorage() = default; - virtual void *getValuePtr() = 0; - }; - - template <class T> class TypedAnyStorage : public Context::AnyStorage { - static_assert(std::is_same<typename std::decay<T>::type, T>::value, - "Argument to TypedAnyStorage must be decayed"); - - public: - TypedAnyStorage(T &&Value) : value(std::move(Value)) {} - - void *getValuePtr() override { return &value; } - - private: - T value; - }; - - struct Data { - // We need to make sure parent outlives the value, so the order of members - // is important. We do that to allow classes stored in Context's child - // layers to store references to the data in the parent layers. - std::shared_ptr<const Data> parent; - const void *KeyPtr; - std::unique_ptr<AnyStorage> value; - }; - - std::shared_ptr<const Data> dataPtr; + class AnyStorage + { + public: + virtual ~AnyStorage() = default; + virtual void* getValuePtr() = 0; + }; + + template<class T> + class TypedAnyStorage : public Context::AnyStorage + { + static_assert( + std::is_same<typename std::decay<T>::type, T>::value, "Argument to TypedAnyStorage must be decayed" + ); + + public: + TypedAnyStorage(T&& Value) : value(std::move(Value)) + { + } + + void* getValuePtr() override + { + return &value; + } + + private: + T value; + }; + + struct Data + { + // We need to make sure parent outlives the value, so the order of members + // is important. We do that to allow classes stored in Context's child + // layers to store references to the data in the parent layers. + std::shared_ptr<Data const> parent; + void const* KeyPtr; + std::unique_ptr<AnyStorage> value; + }; + + std::shared_ptr<Data const> dataPtr; }; /// WithContext replaces Context::current() with a provided scope. /// When the WithContext is destroyed, the original scope is restored. /// For extending the current context with new value, prefer WithContextValue. -class WithContext { +class WithContext +{ public: - WithContext(Context C) : restore(Context::swapCurrent(std::move(C))) {} - ~WithContext() { Context::swapCurrent(std::move(restore)); } - WithContext(const WithContext &) = delete; - WithContext &operator=(const WithContext &) = delete; - WithContext(WithContext &&) = delete; - WithContext &operator=(WithContext &&) = delete; + WithContext(Context C) : restore(Context::swapCurrent(std::move(C))) + { + } + ~WithContext() + { + Context::swapCurrent(std::move(restore)); + } + WithContext(WithContext const&) = delete; + WithContext& operator=(WithContext const&) = delete; + WithContext(WithContext&&) = delete; + WithContext& operator=(WithContext&&) = delete; private: - Context restore; + Context restore; }; /// WithContextValue extends Context::current() with a single value. /// When the WithContextValue is destroyed, the original scope is restored. -class WithContextValue { +class WithContextValue +{ public: - template <typename T> - WithContextValue(const Key<T> &K, typename std::decay<T>::type V) - : restore(Context::current().derive(K, std::move(V))) {} + template<typename T> + WithContextValue(Key<T> const& K, typename std::decay<T>::type V) + : restore(Context::current().derive(K, std::move(V))) + { + } - // Anonymous values can be used for the destructor side-effect. - template <typename T> - WithContextValue(T &&V) - : restore(Context::current().derive(std::forward<T>(V))) {} + // Anonymous values can be used for the destructor side-effect. + template<typename T> + WithContextValue(T&& V) : restore(Context::current().derive(std::forward<T>(V))) + { + } private: - WithContext restore; + WithContext restore; }; - } // namespace lsp - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/Endpoint.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/Endpoint.h index d752711a3a..6b3eadcf55 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/Endpoint.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/Endpoint.h @@ -6,48 +6,47 @@ struct LspMessage; struct NotificationInMessage; struct lsBaseOutMessage; -struct RequestInMessage; +struct RequestInMessage; -using GenericResponseHandler = std::function< bool(std::unique_ptr<LspMessage>) >; -using GenericRequestHandler = std::function< bool(std::unique_ptr<LspMessage>) >; -using GenericNotificationHandler = std::function< bool(std::unique_ptr<LspMessage>) >; +using GenericResponseHandler = std::function<bool(std::unique_ptr<LspMessage>)>; +using GenericRequestHandler = std::function<bool(std::unique_ptr<LspMessage>)>; +using GenericNotificationHandler = std::function<bool(std::unique_ptr<LspMessage>)>; class Endpoint { public: - virtual ~Endpoint() = default; - virtual bool onRequest(std::unique_ptr<LspMessage>) = 0; - virtual bool notify(std::unique_ptr<LspMessage>) = 0; + virtual ~Endpoint() = default; + virtual bool onRequest(std::unique_ptr<LspMessage>) = 0; + virtual bool notify(std::unique_ptr<LspMessage>) = 0; - virtual bool onResponse(const std::string&, std::unique_ptr<LspMessage>) = 0; - virtual void registerRequestHandler(const std::string&, GenericResponseHandler ) = 0; - virtual void registerNotifyHandler(const std::string&, GenericNotificationHandler ) = 0; + virtual bool onResponse(std::string const&, std::unique_ptr<LspMessage>) = 0; + virtual void registerRequestHandler(std::string const&, GenericResponseHandler) = 0; + virtual void registerNotifyHandler(std::string const&, GenericNotificationHandler) = 0; }; -class GenericEndpoint :public Endpoint +class GenericEndpoint : public Endpoint { public: - GenericEndpoint(lsp::Log& l):log(l){} - bool notify(std::unique_ptr<LspMessage>) override; - bool onResponse(const std::string&, std::unique_ptr<LspMessage>) override; - - bool onRequest(std::unique_ptr<LspMessage>) override; - std::map< std::string, GenericRequestHandler > method2request; - std::map< std::string, GenericResponseHandler > method2response; - std::map< std::string, GenericNotificationHandler > method2notification; - - void registerRequestHandler(const std::string& method, GenericResponseHandler cb) override - { - method2request[method] = cb; - } - - void registerNotifyHandler(const std::string& method, GenericNotificationHandler cb) override - { - method2notification[method] = cb; - } - lsp::Log& log; - - - + GenericEndpoint(lsp::Log& l) : log(l) + { + } + bool notify(std::unique_ptr<LspMessage>) override; + bool onResponse(std::string const&, std::unique_ptr<LspMessage>) override; + + bool onRequest(std::unique_ptr<LspMessage>) override; + std::map<std::string, GenericRequestHandler> method2request; + std::map<std::string, GenericResponseHandler> method2response; + std::map<std::string, GenericNotificationHandler> method2notification; + + void registerRequestHandler(std::string const& method, GenericResponseHandler cb) override + { + method2request[method] = cb; + } + + void registerNotifyHandler(std::string const& method, GenericNotificationHandler cb) override + { + method2notification[method] = cb; + } + lsp::Log& log; }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/GCThreadContext.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/GCThreadContext.h index 6c9f9c1cbb..a7cf469592 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/GCThreadContext.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/GCThreadContext.h @@ -15,5 +15,4 @@ private: #if defined(LSPCPP_USEGC) GC_stack_base gsb; #endif - -};
\ No newline at end of file +}; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageIssue.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageIssue.h index 6c29ee8f0e..8bf5c0a0f3 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageIssue.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageIssue.h @@ -4,20 +4,20 @@ #include <vector> namespace lsp { - class Log - { - public: - virtual ~Log() = default; - - enum class Level - { - /** +class Log +{ +public: + virtual ~Log() = default; + + enum class Level + { + /** * OFF is a special level that can be used to turn off logging. */ - OFF = 1, + OFF = 0, - /** + /** * SEVERE is a message level indicating a serious failure. * <p> * In general SEVERE messages should describe events that are @@ -26,9 +26,9 @@ namespace lsp * to end users and to system administrators. */ - SEVERE = 2, + SEVERE = 1, - /** + /** * WARNING is a message level indicating a potential problem. * <p> * In general WARNING messages should describe events that will @@ -37,8 +37,8 @@ namespace lsp * */ - WARNING = 3, - /** + WARNING = 2, + /** * INFO is a message level for informational messages. * <p> * Typically INFO messages will be written to the console @@ -47,8 +47,8 @@ namespace lsp * make sense to end users and system administrators. */ - INFO = 3, - /** + INFO = 3, + /** * CONFIG is a message level for static configuration messages. * <p> * CONFIG messages are intended to provide a variety of static @@ -59,11 +59,9 @@ namespace lsp * This level is initialized to <CODE>4</CODE>. */ - CONFIG = 4, + CONFIG = 4, - - - /** + /** * FINE is a message level providing tracing information. * <p> * All of FINE, FINER, and FINEST are intended for relatively @@ -82,101 +80,98 @@ namespace lsp * are also worth logging as FINE. * This level is initialized to <CODE>5</CODE>. */ - FINE = 5, + FINE = 5, - /** + /** * FINER indicates a fairly detailed tracing message. * By default logging calls for entering, returning, or throwing * an exception are traced at this level. * This level is initialized to <CODE>400</CODE>. */ - FINER = 6, + FINER = 6, - /** + /** * FINEST indicates a highly detailed tracing message. * This level is initialized to <CODE>300</CODE>. */ - FINEST = 7, + FINEST = 7, - /** + /** * ALL indicates that all messages should be logged. * This level is initialized to <CODE>Integer.MIN_VALUE</CODE>. */ - ALL, - }; - virtual void log(Level level, std::wstring&& msg) = 0; - virtual void log(Level level, const std::wstring& msg) = 0; - virtual void log(Level level, std::string&& msg) = 0; - virtual void log(Level level, const std::string& msg) = 0; - - void info(const std::string& msg) - { - log(Level::INFO, msg); - } - void info(const std::wstring& msg) - { - log(Level::INFO, msg); - } - void error(const std::string& msg) - { - log(Level::SEVERE, msg); - } - void error(const std::wstring& msg) - { - log(Level::SEVERE, msg); - } - void warning(const std::string& msg) - { - log(Level::WARNING, msg); - } - void warning(const std::wstring& msg) - { - log(Level::WARNING, msg); - } - }; -} - -class MessageIssue { - -public: - std::string text; - - lsp::Log::Level code; - - MessageIssue(const std::string& text, lsp::Log::Level code) :text(text), code(code) - { - - - } - MessageIssue(std::string&& text, lsp::Log::Level code) :text(text), code(code) - { - - - } - - - std::string getText() { - return text; - } - - lsp::Log::Level getIssueCode() { - return code; - } - + ALL, + }; + virtual void log(Level level, std::wstring&& msg) = 0; + virtual void log(Level level, std::wstring const& msg) = 0; + virtual void log(Level level, std::string&& msg) = 0; + virtual void log(Level level, std::string const& msg) = 0; + + void info(std::string const& msg) + { + log(Level::INFO, msg); + } + void info(std::wstring const& msg) + { + log(Level::INFO, msg); + } + void error(std::string const& msg) + { + log(Level::SEVERE, msg); + } + void error(std::wstring const& msg) + { + log(Level::SEVERE, msg); + } + void warning(std::string const& msg) + { + log(Level::WARNING, msg); + } + void warning(std::wstring const& msg) + { + log(Level::WARNING, msg); + } +}; +} // namespace lsp - std::string toString() { - return getText(); - } +class MessageIssue +{ +public: + std::string text; + + lsp::Log::Level code; + + MessageIssue(std::string const& text, lsp::Log::Level code) : text(text), code(code) + { + } + MessageIssue(std::string&& text, lsp::Log::Level code) : text(text), code(code) + { + } + + std::string getText() + { + return text; + } + + lsp::Log::Level getIssueCode() + { + return code; + } + + std::string toString() + { + return getText(); + } }; -class MessageIssueHandler +class MessageIssueHandler { public: - /** + /** * Handle issues found while parsing or validating a message. The list of issues must not be empty. */ - virtual ~MessageIssueHandler() = default; + virtual ~MessageIssueHandler() = default; - virtual void handle(std::vector<MessageIssue>&&) = 0; - virtual void handle( MessageIssue&&) = 0; + virtual void handle(std::vector<MessageIssue>&&) = 0; + virtual void handle(MessageIssue&&) = 0; }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageJsonHandler.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageJsonHandler.h index f019fbf121..2c039a4313 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageJsonHandler.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageJsonHandler.h @@ -5,57 +5,52 @@ #include <LibLsp/JsonRpc/message.h> class Reader; - -using GenericRequestJsonHandler = std::function< std::unique_ptr<LspMessage>(Reader&) >; -using GenericResponseJsonHandler = std::function< std::unique_ptr<LspMessage>(Reader&) >; -using GenericNotificationJsonHandler = std::function< std::unique_ptr<LspMessage>(Reader&) >; +using GenericRequestJsonHandler = std::function<std::unique_ptr<LspMessage>(Reader&)>; +using GenericResponseJsonHandler = std::function<std::unique_ptr<LspMessage>(Reader&)>; +using GenericNotificationJsonHandler = std::function<std::unique_ptr<LspMessage>(Reader&)>; class MessageJsonHandler { public: - std::map< std::string, GenericRequestJsonHandler > method2request; - std::map< std::string, GenericResponseJsonHandler > method2response; - std::map< std::string, GenericNotificationJsonHandler > method2notification; - - - const GenericRequestJsonHandler* GetRequestJsonHandler(const char* methodInfo) const - { - const auto findIt = method2request.find(methodInfo); - return findIt == method2request.end() ? nullptr : &findIt->second; - } - - void SetRequestJsonHandler(const std::string& methodInfo, GenericRequestJsonHandler handler) - { - method2request[methodInfo] = handler; - } - - const GenericResponseJsonHandler* GetResponseJsonHandler(const char* methodInfo) const - { - const auto findIt = method2response.find(methodInfo); - return findIt == method2response.end() ? nullptr : &findIt->second; - } - - void SetResponseJsonHandler(const std::string& methodInfo,GenericResponseJsonHandler handler) - { - method2response[methodInfo] = handler; - } - - const GenericNotificationJsonHandler* GetNotificationJsonHandler(const char* methodInfo) const - { - const auto findIt = method2notification.find(methodInfo); - return findIt == method2notification.end() ? nullptr : &findIt->second; - } - - void SetNotificationJsonHandler(const std::string& methodInfo, GenericNotificationJsonHandler handler) - { - method2notification[methodInfo] = handler; - } - - - - std::unique_ptr<LspMessage> parseResponseMessage(const std::string&, Reader&); - std::unique_ptr<LspMessage> parseRequstMessage(const std::string&, Reader&); - bool resovleResponseMessage(Reader&, std::pair<std::string, std::unique_ptr<LspMessage>>& result); - std::unique_ptr<LspMessage> parseNotificationMessage(const std::string&, Reader&); + std::map<std::string, GenericRequestJsonHandler> method2request; + std::map<std::string, GenericResponseJsonHandler> method2response; + std::map<std::string, GenericNotificationJsonHandler> method2notification; + + GenericRequestJsonHandler const* GetRequestJsonHandler(char const* methodInfo) const + { + auto const findIt = method2request.find(methodInfo); + return findIt == method2request.end() ? nullptr : &findIt->second; + } + + void SetRequestJsonHandler(std::string const& methodInfo, GenericRequestJsonHandler handler) + { + method2request[methodInfo] = handler; + } + + GenericResponseJsonHandler const* GetResponseJsonHandler(char const* methodInfo) const + { + auto const findIt = method2response.find(methodInfo); + return findIt == method2response.end() ? nullptr : &findIt->second; + } + + void SetResponseJsonHandler(std::string const& methodInfo, GenericResponseJsonHandler handler) + { + method2response[methodInfo] = handler; + } + + GenericNotificationJsonHandler const* GetNotificationJsonHandler(char const* methodInfo) const + { + auto const findIt = method2notification.find(methodInfo); + return findIt == method2notification.end() ? nullptr : &findIt->second; + } + + void SetNotificationJsonHandler(std::string const& methodInfo, GenericNotificationJsonHandler handler) + { + method2notification[methodInfo] = handler; + } + + std::unique_ptr<LspMessage> parseResponseMessage(std::string const&, Reader&); + std::unique_ptr<LspMessage> parseRequstMessage(std::string const&, Reader&); + bool resovleResponseMessage(Reader&, std::pair<std::string, std::unique_ptr<LspMessage>>& result); + std::unique_ptr<LspMessage> parseNotificationMessage(std::string const&, Reader&); }; - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageProducer.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageProducer.h index 4f3799555a..211761abba 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageProducer.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageProducer.h @@ -2,19 +2,21 @@ #include <string> #include <functional> -namespace lsp { - /// The encoding style of the JSON-RPC messages (both input and output). - enum JSONStreamStyle { - /// Encoding per the LSP specification, with mandatory Content-Length header. - Standard, - /// Messages are delimited by a '// -----' line. Comment lines start with //. - Delimited - }; -} +namespace lsp +{ +/// The encoding style of the JSON-RPC messages (both input and output). +enum JSONStreamStyle +{ + /// Encoding per the LSP specification, with mandatory Content-Length header. + Standard, + /// Messages are delimited by a '// -----' line. Comment lines start with //. + Delimited +}; +} // namespace lsp class MessageProducer { public: - typedef std::function< void(std::string&&) > MessageConsumer; - virtual ~MessageProducer() = default; - virtual void listen(MessageConsumer) = 0; + typedef std::function<void(std::string&&)> MessageConsumer; + virtual ~MessageProducer() = default; + virtual void listen(MessageConsumer) = 0; }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/NotificationInMessage.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/NotificationInMessage.h index cdee9e572e..4b1a017c24 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/NotificationInMessage.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/NotificationInMessage.h @@ -1,62 +1,66 @@ #pragma once - #include "lsRequestId.h" #include "LibLsp/JsonRpc/message.h" - - // NotificationInMessage does not have |id|. -struct NotificationInMessage : public LspMessage { - - Kind GetKid() override - { - return NOTIFICATION_MESSAGE; - } - MethodType GetMethodType() const override - { - return method.c_str(); - } - void SetMethodType(MethodType _t) override - { - method = _t; - } - std::string method; +struct NotificationInMessage : public LspMessage +{ + + Kind GetKid() override + { + return NOTIFICATION_MESSAGE; + } + MethodType GetMethodType() const override + { + return method.c_str(); + } + void SetMethodType(MethodType _t) override + { + method = _t; + } + std::string method; }; -template <class T, class TDerived > -struct lsNotificationInMessage : NotificationInMessage { - - void ReflectWriter(Writer& writer) override { - Reflect(writer, static_cast<TDerived&>(*this)); - } - lsNotificationInMessage(MethodType _method) - { - method = _method; - } - - static std::unique_ptr<LspMessage> ReflectReader(Reader& visitor) { - - TDerived* temp = new TDerived(); - - std::unique_ptr<TDerived> message = std::unique_ptr<TDerived>(temp); - // Reflect may throw and *message will be partially deserialized. - Reflect(visitor, static_cast<TDerived&>(*temp)); - return message; - - } - void swap(lsNotificationInMessage& arg) noexcept - { - method.swap(method); - std::swap(params, arg.params); - } - T params; +template<class T, class TDerived> +struct lsNotificationInMessage : NotificationInMessage +{ + + void ReflectWriter(Writer& writer) override + { + Reflect(writer, static_cast<TDerived&>(*this)); + } + lsNotificationInMessage(MethodType _method) + { + method = _method; + } + + static std::unique_ptr<LspMessage> ReflectReader(Reader& visitor) + { + + TDerived* temp = new TDerived(); + + std::unique_ptr<TDerived> message = std::unique_ptr<TDerived>(temp); + // Reflect may throw and *message will be partially deserialized. + Reflect(visitor, static_cast<TDerived&>(*temp)); + return message; + } + void swap(lsNotificationInMessage& arg) noexcept + { + method.swap(method); + std::swap(params, arg.params); + } + T params; }; -#define DEFINE_NOTIFICATION_TYPE(MSG,paramType,methodInfo)\ -namespace MSG {\ - struct notify : public lsNotificationInMessage< paramType , notify >{\ - static constexpr MethodType kMethodInfo = methodInfo;\ - notify():lsNotificationInMessage(kMethodInfo){} \ - };\ -};\ -MAKE_REFLECT_STRUCT(MSG::notify, jsonrpc,method, params) +#define DEFINE_NOTIFICATION_TYPE(MSG, paramType, methodInfo) \ + namespace MSG \ + { \ + struct notify : public lsNotificationInMessage<paramType, notify> \ + { \ + static constexpr MethodType kMethodInfo = methodInfo; \ + notify() : lsNotificationInMessage(kMethodInfo) \ + { \ + } \ + }; \ + }; \ + MAKE_REFLECT_STRUCT(MSG::notify, jsonrpc, method, params) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/RemoteEndPoint.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/RemoteEndPoint.h index 8d013bd889..3e57fa0bb5 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/RemoteEndPoint.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/RemoteEndPoint.h @@ -15,274 +15,307 @@ #include "future.h" #include "MessageProducer.h" - class MessageJsonHandler; -class Endpoint; +class Endpoint; struct LspMessage; class RemoteEndPoint; -namespace lsp { - class ostream; - class istream; - - //////////////////////////////////////////////////////////////////////////////// - // ResponseOrError<T> - //////////////////////////////////////////////////////////////////////////////// - - // ResponseOrError holds either the response to a request or an error - // message. - template <typename T> - struct ResponseOrError { - using Request = T; - ResponseOrError(); - ResponseOrError(const T& response); - ResponseOrError(T&& response); - ResponseOrError(const Rsp_Error& error); - ResponseOrError(Rsp_Error&& error); - ResponseOrError(const ResponseOrError& other); - ResponseOrError(ResponseOrError&& other) noexcept; - - ResponseOrError& operator=(const ResponseOrError& other); - ResponseOrError& operator=(ResponseOrError&& other) noexcept; - bool IsError() const { return is_error; } - std::string ToJson() - { - if (is_error) return error.ToJson(); - return response.ToJson(); - } - T response; - Rsp_Error error; // empty represents success. - bool is_error; - }; +namespace lsp +{ +class ostream; +class istream; - template <typename T> - ResponseOrError<T>::ResponseOrError(): is_error(false) - { - } +//////////////////////////////////////////////////////////////////////////////// +// ResponseOrError<T> +//////////////////////////////////////////////////////////////////////////////// - template <typename T> - ResponseOrError<T>::ResponseOrError(const T& resp) : response(resp), is_error(false) {} - template <typename T> - ResponseOrError<T>::ResponseOrError(T&& resp) : response(std::move(resp)), is_error(false) {} - template <typename T> - ResponseOrError<T>::ResponseOrError(const Rsp_Error& err) : error(err), is_error(true) {} - template <typename T> - ResponseOrError<T>::ResponseOrError(Rsp_Error&& err) : error(std::move(err)), is_error(true) {} - template <typename T> - ResponseOrError<T>::ResponseOrError(const ResponseOrError& other) - : response(other.response), error(other.error), is_error(other.is_error) {} - template <typename T> - ResponseOrError<T>::ResponseOrError(ResponseOrError&& other) noexcept - : response(std::move(other.response)), error(std::move(other.error)), is_error(other.is_error) {} - template <typename T> - ResponseOrError<T>& ResponseOrError<T>::operator=( - const ResponseOrError& other) { - response = other.response; - error = other.error; - is_error = other.is_error; - return *this; - } - template <typename T> - ResponseOrError<T>& ResponseOrError<T>::operator=(ResponseOrError&& other) noexcept +// ResponseOrError holds either the response to a request or an error +// message. +template<typename T> +struct ResponseOrError +{ + using Request = T; + ResponseOrError(); + ResponseOrError(T const& response); + ResponseOrError(T&& response); + ResponseOrError(Rsp_Error const& error); + ResponseOrError(Rsp_Error&& error); + ResponseOrError(ResponseOrError const& other); + ResponseOrError(ResponseOrError&& other) noexcept; + + ResponseOrError& operator=(ResponseOrError const& other); + ResponseOrError& operator=(ResponseOrError&& other) noexcept; + bool IsError() const + { + return is_error; + } + std::string ToJson() + { + if (is_error) { - response = std::move(other.response); - error = std::move(other.error); - is_error = other.is_error; - return *this; + return error.ToJson(); } + return response.ToJson(); + } + T response; + Rsp_Error error; // empty represents success. + bool is_error; +}; +template<typename T> +ResponseOrError<T>::ResponseOrError() : is_error(false) +{ } - -class RemoteEndPoint :MessageIssueHandler +template<typename T> +ResponseOrError<T>::ResponseOrError(T const& resp) : response(resp), is_error(false) { +} +template<typename T> +ResponseOrError<T>::ResponseOrError(T&& resp) : response(std::move(resp)), is_error(false) +{ +} +template<typename T> +ResponseOrError<T>::ResponseOrError(Rsp_Error const& err) : error(err), is_error(true) +{ +} +template<typename T> +ResponseOrError<T>::ResponseOrError(Rsp_Error&& err) : error(std::move(err)), is_error(true) +{ +} +template<typename T> +ResponseOrError<T>::ResponseOrError(ResponseOrError const& other) + : response(other.response), error(other.error), is_error(other.is_error) +{ +} +template<typename T> +ResponseOrError<T>::ResponseOrError(ResponseOrError&& other) noexcept + : response(std::move(other.response)), error(std::move(other.error)), is_error(other.is_error) +{ +} +template<typename T> +ResponseOrError<T>& ResponseOrError<T>::operator=(ResponseOrError const& other) +{ + response = other.response; + error = other.error; + is_error = other.is_error; + return *this; +} +template<typename T> +ResponseOrError<T>& ResponseOrError<T>::operator=(ResponseOrError&& other) noexcept +{ + response = std::move(other.response); + error = std::move(other.error); + is_error = other.is_error; + return *this; +} - template <typename F, int N> - using ParamType = lsp::traits::ParameterType<F, N>; - - template <typename T> - using IsRequest = lsp::traits::EnableIfIsType<RequestInMessage, T>; - - template <typename T> - using IsResponse = lsp::traits::EnableIfIsType<ResponseInMessage, T>; - - template <typename T> - using IsNotify = lsp::traits::EnableIfIsType<NotificationInMessage, T>; +} // namespace lsp +class RemoteEndPoint : MessageIssueHandler +{ - template <typename F, typename ReturnType> - using IsRequestHandler = lsp::traits::EnableIf<lsp::traits::CompatibleWith< - F, - std::function<ReturnType(const RequestInMessage&)>>:: - value>; + template<typename F, int N> + using ParamType = lsp::traits::ParameterType<F, N>; - template <typename F, typename ReturnType> - using IsRequestHandlerWithMonitor = lsp::traits::EnableIf<lsp::traits::CompatibleWith< - F, - std::function<ReturnType(const RequestInMessage&,const CancelMonitor&)>>:: - value>; + template<typename T> + using IsRequest = lsp::traits::EnableIfIsType<RequestInMessage, T>; -public: + template<typename T> + using IsResponse = lsp::traits::EnableIfIsType<ResponseInMessage, T>; + template<typename T> + using IsNotify = lsp::traits::EnableIfIsType<NotificationInMessage, T>; - RemoteEndPoint(const std::shared_ptr <MessageJsonHandler>& json_handler, - const std::shared_ptr < Endpoint >& localEndPoint, - lsp::Log& _log, - lsp::JSONStreamStyle style = lsp::JSONStreamStyle::Standard, - uint8_t max_workers = 2); + template<typename F, typename ReturnType> + using IsRequestHandler = lsp::traits::EnableIf< + lsp::traits::CompatibleWith<F, std::function<ReturnType(RequestInMessage const&)>>::value>; - ~RemoteEndPoint() override; - template <typename F, typename RequestType = ParamType<F, 0>, typename ResponseType = typename RequestType::Response> - IsRequestHandler< F, lsp::ResponseOrError<ResponseType> > registerHandler(F&& handler) - { - processRequestJsonHandler(handler); - local_endpoint->registerRequestHandler(RequestType::kMethodInfo, [=](std::unique_ptr<LspMessage> msg) { - auto req = reinterpret_cast<const RequestType*>(msg.get()); - lsp::ResponseOrError<ResponseType> res(handler(*req)); - if (res.is_error) { - res.error.id = req->id; - send(res.error); - } - else - { - res.response.id = req->id; - send(res.response); - } - return true; - }); - } - template <typename F, typename RequestType = ParamType<F, 0>, typename ResponseType = typename RequestType::Response> - IsRequestHandlerWithMonitor< F, lsp::ResponseOrError<ResponseType> > registerHandler(F&& handler) { - processRequestJsonHandler(handler); - local_endpoint->registerRequestHandler(RequestType::kMethodInfo, [=](std::unique_ptr<LspMessage> msg) { - auto req = static_cast<const RequestType*>(msg.get()); - lsp::ResponseOrError<ResponseType> res(handler(*req , getCancelMonitor(req->id))); - if (res.is_error) { - res.error.id = req->id; - send(res.error); - } - else - { - res.response.id = req->id; - send(res.response); - } - return true; - }); - } - using RequestErrorCallback = std::function<void(const Rsp_Error&)>; + template<typename F, typename ReturnType> + using IsRequestHandlerWithMonitor = lsp::traits::EnableIf<lsp::traits::CompatibleWith< + F, std::function<ReturnType(RequestInMessage const&, CancelMonitor const&)>>::value>; - template <typename T, typename F, typename ResponseType = ParamType<F, 0> > - void send(T& request, F&& handler, RequestErrorCallback onError) - { - processRequestJsonHandler(handler); - auto cb = [=](std::unique_ptr<LspMessage> msg) { - if (!msg) - return true; - const auto result = msg.get(); - - if (static_cast<ResponseInMessage*>(result)->IsErrorType()) { - const auto rsp_error = static_cast<const Rsp_Error*>(result); - onError(*rsp_error); - } - else { - handler(*static_cast<ResponseType*>(result)); - } - - return true; - }; - internalSendRequest(request, cb); - } - - - template <typename F, typename NotifyType = ParamType<F, 0> > - IsNotify<NotifyType> registerHandler(F&& handler) { +public: + RemoteEndPoint( + std::shared_ptr<MessageJsonHandler> const& json_handler, std::shared_ptr<Endpoint> const& localEndPoint, + lsp::Log& _log, lsp::JSONStreamStyle style = lsp::JSONStreamStyle::Standard, uint8_t max_workers = 2 + ); + + ~RemoteEndPoint() override; + template<typename F, typename RequestType = ParamType<F, 0>, typename ResponseType = typename RequestType::Response> + IsRequestHandler<F, lsp::ResponseOrError<ResponseType>> registerHandler(F&& handler) + { + processRequestJsonHandler(handler); + local_endpoint->registerRequestHandler( + RequestType::kMethodInfo, + [=](std::unique_ptr<LspMessage> msg) + { + auto req = reinterpret_cast<RequestType const*>(msg.get()); + lsp::ResponseOrError<ResponseType> res(handler(*req)); + if (res.is_error) { - std::lock_guard<std::mutex> lock(m_sendMutex); - if (!jsonHandler->GetNotificationJsonHandler(NotifyType::kMethodInfo)) - { - jsonHandler->SetNotificationJsonHandler(NotifyType::kMethodInfo, - [](Reader& visitor) - { - return NotifyType::ReflectReader(visitor); - }); - } + res.error.id = req->id; + send(res.error); } - local_endpoint->registerNotifyHandler(NotifyType::kMethodInfo, [=](std::unique_ptr<LspMessage> msg) { - handler(*static_cast<NotifyType*>(msg.get())); - return true; - }); - } - - template <typename T, typename = IsRequest<T>> - lsp::future< lsp::ResponseOrError<typename T::Response> > send(T& request) { - - processResponseJsonHandler(request); - using Response = typename T::Response; - auto promise = std::make_shared< lsp::promise<lsp::ResponseOrError<Response>>>(); - auto cb = [=](std::unique_ptr<LspMessage> msg) { - if (!msg) - return true; - auto result = msg.get(); - - if (reinterpret_cast<ResponseInMessage*>(result)->IsErrorType()) - { - Rsp_Error* rsp_error = static_cast<Rsp_Error*>(result); - Rsp_Error temp; - std::swap(temp, *rsp_error); - promise->set_value(std::move(lsp::ResponseOrError<Response>(std::move(temp)))); - } - else - { - Response temp; - std::swap(temp, *static_cast<Response*>(result)); - promise->set_value(std::move(lsp::ResponseOrError<Response>(std::move(temp)))); - } - return true; - }; - internalSendRequest(request, cb); - return promise->get_future(); - } - - template <typename T, typename = IsRequest<T>> - std::unique_ptr<lsp::ResponseOrError<typename T::Response>> waitResponse(T& request, const unsigned time_out = 0) - { - auto future_rsp = send(request); - if (time_out == 0) + else { - future_rsp.wait(); + res.response.id = req->id; + send(res.response); + } + return true; + } + ); + } + template<typename F, typename RequestType = ParamType<F, 0>, typename ResponseType = typename RequestType::Response> + IsRequestHandlerWithMonitor<F, lsp::ResponseOrError<ResponseType>> registerHandler(F&& handler) + { + processRequestJsonHandler(handler); + local_endpoint->registerRequestHandler( + RequestType::kMethodInfo, + [=](std::unique_ptr<LspMessage> msg) + { + auto req = static_cast<RequestType const*>(msg.get()); + lsp::ResponseOrError<ResponseType> res(handler(*req, getCancelMonitor(req->id))); + if (res.is_error) + { + res.error.id = req->id; + send(res.error); } else { - auto state = future_rsp.wait_for(std::chrono::milliseconds(time_out)); - if (lsp::future_status::timeout == state) - { - return {}; - } + res.response.id = req->id; + send(res.response); } + return true; + } + ); + } + using RequestErrorCallback = std::function<void(Rsp_Error const&)>; - using Response = typename T::Response; - return std::make_unique<lsp::ResponseOrError<Response>>(std::move(future_rsp.get())); - } + template<typename T, typename F, typename ResponseType = ParamType<F, 0>> + void send(T& request, F&& handler, RequestErrorCallback onError) + { + processRequestJsonHandler(handler); + auto cb = [=](std::unique_ptr<LspMessage> msg) + { + if (!msg) + { + return true; + } + auto const result = msg.get(); + + if (static_cast<ResponseInMessage*>(result)->IsErrorType()) + { + auto const rsp_error = static_cast<Rsp_Error const*>(result); + onError(*rsp_error); + } + else + { + handler(*static_cast<ResponseType*>(result)); + } + + return true; + }; + internalSendRequest(request, cb); + } - void send(NotificationInMessage& msg) + template<typename F, typename NotifyType = ParamType<F, 0>> + IsNotify<NotifyType> registerHandler(F&& handler) + { { - sendMsg(msg); + std::lock_guard<std::mutex> lock(m_sendMutex); + if (!jsonHandler->GetNotificationJsonHandler(NotifyType::kMethodInfo)) + { + jsonHandler->SetNotificationJsonHandler( + NotifyType::kMethodInfo, [](Reader& visitor) { return NotifyType::ReflectReader(visitor); } + ); + } } + local_endpoint->registerNotifyHandler( + NotifyType::kMethodInfo, + [=](std::unique_ptr<LspMessage> msg) + { + handler(*static_cast<NotifyType*>(msg.get())); + return true; + } + ); + } + + template<typename T, typename = IsRequest<T>> + lsp::future<lsp::ResponseOrError<typename T::Response>> send(T& request) + { - void send(ResponseInMessage& msg) + processResponseJsonHandler(request); + using Response = typename T::Response; + auto promise = std::make_shared<lsp::promise<lsp::ResponseOrError<Response>>>(); + auto cb = [=](std::unique_ptr<LspMessage> msg) { - sendMsg(msg); - } + if (!msg) + { + return true; + } + auto result = msg.get(); + + if (reinterpret_cast<ResponseInMessage*>(result)->IsErrorType()) + { + Rsp_Error* rsp_error = static_cast<Rsp_Error*>(result); + Rsp_Error temp; + std::swap(temp, *rsp_error); + promise->set_value(std::move(lsp::ResponseOrError<Response>(std::move(temp)))); + } + else + { + Response temp; + std::swap(temp, *static_cast<Response*>(result)); + promise->set_value(std::move(lsp::ResponseOrError<Response>(std::move(temp)))); + } + return true; + }; + internalSendRequest(request, cb); + return promise->get_future(); + } - void sendNotification(NotificationInMessage& msg) + template<typename T, typename = IsRequest<T>> + std::unique_ptr<lsp::ResponseOrError<typename T::Response>> waitResponse(T& request, unsigned const time_out = 0) + { + auto future_rsp = send(request); + if (time_out == 0) { - send(msg); + future_rsp.wait(); } - void sendResponse(ResponseInMessage& msg) + else { - send(msg); + auto state = future_rsp.wait_for(std::chrono::milliseconds(time_out)); + if (lsp::future_status::timeout == state) + { + return {}; + } } - template <typename T> - T createRequest() { + + using Response = typename T::Response; + return std::make_unique<lsp::ResponseOrError<Response>>(std::move(future_rsp.get())); + } + + void send(NotificationInMessage& msg) + { + sendMsg(msg); + } + + void send(ResponseInMessage& msg) + { + sendMsg(msg); + } + + void sendNotification(NotificationInMessage& msg) + { + send(msg); + } + void sendResponse(ResponseInMessage& msg) + { + send(msg); + } + template<typename T> + T createRequest() + { auto req = T(); req.id.set(getNextRequestId()); return req; @@ -290,61 +323,66 @@ public: int getNextRequestId(); - bool cancelRequest(const lsRequestId&); + bool cancelRequest(lsRequestId const&); + + void startProcessingMessages(std::shared_ptr<lsp::istream> r, std::shared_ptr<lsp::ostream> w); - void startProcessingMessages(std::shared_ptr<lsp::istream> r, - std::shared_ptr<lsp::ostream> w); + bool isWorking() const; + void stop(); - bool isWorking() const; - void stop(); + std::unique_ptr<LspMessage> internalWaitResponse(RequestInMessage&, unsigned time_out = 0); - std::unique_ptr<LspMessage> internalWaitResponse(RequestInMessage&, unsigned time_out = 0); + bool internalSendRequest(RequestInMessage& info, GenericResponseHandler handler); - bool internalSendRequest(RequestInMessage &info, GenericResponseHandler handler); + void handle(std::vector<MessageIssue>&&) override; + void handle(MessageIssue&&) override; - void handle(std::vector<MessageIssue>&&) override; - void handle(MessageIssue&&) override; private: - CancelMonitor getCancelMonitor(const lsRequestId&); - void sendMsg(LspMessage& msg); - void mainLoop(std::unique_ptr<LspMessage>); - bool dispatch(const std::string&); - template <typename F, typename RequestType = ParamType<F, 0>> - IsRequest<RequestType> processRequestJsonHandler(const F& handler) { - std::lock_guard<std::mutex> lock(m_sendMutex); - if (!jsonHandler->GetRequestJsonHandler(RequestType::kMethodInfo)) - { - jsonHandler->SetRequestJsonHandler(RequestType::kMethodInfo, - [](Reader& visitor) - { - return RequestType::ReflectReader(visitor); - }); - } + CancelMonitor getCancelMonitor(lsRequestId const&); + void sendMsg(LspMessage& msg); + void mainLoop(std::unique_ptr<LspMessage>); + bool dispatch(std::string const&); + template<typename F, typename RequestType = ParamType<F, 0>> + IsRequest<RequestType> processRequestJsonHandler(F const& handler) + { + std::lock_guard<std::mutex> lock(m_sendMutex); + if (!jsonHandler->GetRequestJsonHandler(RequestType::kMethodInfo)) + { + jsonHandler->SetRequestJsonHandler( + RequestType::kMethodInfo, [](Reader& visitor) { return RequestType::ReflectReader(visitor); } + ); } - template <typename T, typename = IsRequest<T>> - void processResponseJsonHandler(T& request) + } + template<typename T, typename = IsRequest<T>> + void processResponseJsonHandler(T& request) + { + using Response = typename T::Response; + std::lock_guard<std::mutex> lock(m_sendMutex); + if (!jsonHandler->GetResponseJsonHandler(T::kMethodInfo)) { - using Response = typename T::Response; - std::lock_guard<std::mutex> lock(m_sendMutex); - if (!jsonHandler->GetResponseJsonHandler(T::kMethodInfo)) + jsonHandler->SetResponseJsonHandler( + T::kMethodInfo, + [](Reader& visitor) { - jsonHandler->SetResponseJsonHandler(T::kMethodInfo, [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return Response::ReflectReader(visitor); - }); + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return Response::ReflectReader(visitor); } + ); } + } + + struct Data; - struct Data; + Data* d_ptr; - Data* d_ptr; + std::shared_ptr<MessageJsonHandler> jsonHandler; + std::mutex m_sendMutex; - std::shared_ptr < MessageJsonHandler> jsonHandler; - std::mutex m_sendMutex; + std::shared_ptr<Endpoint> local_endpoint; - std::shared_ptr < Endpoint > local_endpoint; public: - std::shared_ptr < std::thread > message_producer_thread_; + std::shared_ptr<std::thread> message_producer_thread_; }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/RequestInMessage.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/RequestInMessage.h index 0775b36dba..b445173cf0 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/RequestInMessage.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/RequestInMessage.h @@ -1,6 +1,5 @@ #pragma once - #include "serializer.h" #include <atomic> #include <mutex> @@ -9,62 +8,69 @@ #include "LibLsp/lsp/method_type.h" #include "lsResponseMessage.h" -struct RequestInMessage : public LspMessage { - // number or string, actually no null - lsRequestId id; - std::string method; - Kind GetKid() override - { - return REQUEST_MESSAGE; - } - +struct RequestInMessage : public LspMessage +{ + // number or string, actually no null + lsRequestId id; + std::string method; + Kind GetKid() override + { + return REQUEST_MESSAGE; + } }; - - -template <class T, class TDerived > +template<class T, class TDerived> struct lsRequest : public RequestInMessage { - lsRequest(MethodType _method) - { - method = _method; - } - MethodType GetMethodType() const override { return method.c_str(); } - void SetMethodType(MethodType _method) override - { - method = _method; - } \ - void ReflectWriter(Writer& writer) override { - Reflect(writer, static_cast<TDerived&>(*this)); - } + lsRequest(MethodType _method) + { + method = _method; + } + MethodType GetMethodType() const override + { + return method.c_str(); + } + void SetMethodType(MethodType _method) override + { + method = _method; + } + void ReflectWriter(Writer& writer) override + { + Reflect(writer, static_cast<TDerived&>(*this)); + } - static std::unique_ptr<LspMessage> ReflectReader(Reader& visitor) { + static std::unique_ptr<LspMessage> ReflectReader(Reader& visitor) + { - TDerived* temp = new TDerived(); - std::unique_ptr<TDerived> message = std::unique_ptr<TDerived>(temp); - // Reflect may throw and *message will be partially deserialized. - Reflect(visitor, static_cast<TDerived&>(*temp)); - return message; - } - void swap(lsRequest& arg) noexcept - { - id.swap(arg.id); - method.swap(method); - std::swap(params, arg.params); - } - T params; + TDerived* temp = new TDerived(); + std::unique_ptr<TDerived> message = std::unique_ptr<TDerived>(temp); + // Reflect may throw and *message will be partially deserialized. + Reflect(visitor, static_cast<TDerived&>(*temp)); + return message; + } + void swap(lsRequest& arg) noexcept + { + id.swap(arg.id); + method.swap(method); + std::swap(params, arg.params); + } + T params; }; - -#define DEFINE_REQUEST_RESPONSE_TYPE(MSG,request_param,response_result,methodInfo)\ -namespace MSG {\ - struct response :public ResponseMessage< response_result, response> {}; \ - struct request : public lsRequest< request_param , request >{\ - static constexpr MethodType kMethodInfo = methodInfo;\ - request():lsRequest(kMethodInfo){} \ - using Response = response;\ - };\ -};\ -MAKE_REFLECT_STRUCT(MSG::request, jsonrpc, id, method, params);\ -MAKE_REFLECT_STRUCT(MSG::response, jsonrpc, id, result); - +#define DEFINE_REQUEST_RESPONSE_TYPE(MSG, request_param, response_result, methodInfo) \ + namespace MSG \ + { \ + struct response : public ResponseMessage<response_result, response> \ + { \ + }; \ + struct request : public lsRequest<request_param, request> \ + { \ + static constexpr MethodType kMethodInfo = methodInfo; \ + request() : lsRequest(kMethodInfo) \ + { \ + } \ + using Response = response; \ + }; \ + }; \ + MAKE_REFLECT_STRUCT(MSG::request, jsonrpc, id, method, params); \ + MAKE_REFLECT_STRUCT(MSG::response, jsonrpc, id, result); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/ScopeExit.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/ScopeExit.h index 024b700b4a..9af5e17107 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/ScopeExit.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/ScopeExit.h @@ -14,32 +14,44 @@ #include <type_traits> #include <utility> -namespace lsp { -namespace detail { +namespace lsp +{ +namespace detail +{ -template <typename Callable> class scope_exit { - Callable ExitFunction; - bool Engaged = true; // False once moved-from or release()d. + template<typename Callable> + class scope_exit + { + Callable ExitFunction; + bool Engaged = true; // False once moved-from or release()d. -public: - template <typename Fp> - explicit scope_exit(Fp &&F) : ExitFunction(std::forward<Fp>(F)) {} + public: + template<typename Fp> + explicit scope_exit(Fp&& F) : ExitFunction(std::forward<Fp>(F)) + { + } - scope_exit(scope_exit &&Rhs) - : ExitFunction(std::move(Rhs.ExitFunction)), Engaged(Rhs.Engaged) { - Rhs.release(); - } - scope_exit(const scope_exit &) = delete; - scope_exit &operator=(scope_exit &&) = delete; - scope_exit &operator=(const scope_exit &) = delete; + scope_exit(scope_exit&& Rhs) : ExitFunction(std::move(Rhs.ExitFunction)), Engaged(Rhs.Engaged) + { + Rhs.release(); + } + scope_exit(scope_exit const&) = delete; + scope_exit& operator=(scope_exit&&) = delete; + scope_exit& operator=(scope_exit const&) = delete; - void release() { Engaged = false; } + void release() + { + Engaged = false; + } - ~scope_exit() { - if (Engaged) - ExitFunction(); - } -}; + ~scope_exit() + { + if (Engaged) + { + ExitFunction(); + } + } + }; } // end namespace detail @@ -48,12 +60,10 @@ public: // returned object is kept). // // Interface is specified by p0052r2. -template <typename Callable> - detail::scope_exit<typename std::decay<Callable>::type> -make_scope_exit(Callable &&F) { - return detail::scope_exit<typename std::decay<Callable>::type>( - std::forward<Callable>(F)); +template<typename Callable> +detail::scope_exit<typename std::decay<Callable>::type> make_scope_exit(Callable&& F) +{ + return detail::scope_exit<typename std::decay<Callable>::type>(std::forward<Callable>(F)); } } // end namespace lsp - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/StreamMessageProducer.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/StreamMessageProducer.h index 9cd6aef37f..a16f58762e 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/StreamMessageProducer.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/StreamMessageProducer.h @@ -6,34 +6,29 @@ #include <memory> #include "MessageIssue.h" -namespace lsp { - class istream; +namespace lsp +{ +class istream; } class StreamMessageProducer : public MessageProducer { public: + StreamMessageProducer(MessageIssueHandler& message_issue_handler, std::shared_ptr<lsp::istream> _input) + : issueHandler(message_issue_handler), input(_input) + { + } + StreamMessageProducer(MessageIssueHandler& message_issue_handler) : issueHandler(message_issue_handler) + { + } - StreamMessageProducer( - MessageIssueHandler& message_issue_handler, std::shared_ptr < lsp::istream> _input) - : issueHandler(message_issue_handler), - input(_input) - { - } - StreamMessageProducer( - MessageIssueHandler& message_issue_handler) - : issueHandler(message_issue_handler) - { - } - - bool keepRunning = false; + bool keepRunning = false; - virtual void bind(std::shared_ptr<lsp::istream>) = 0 ; + virtual void bind(std::shared_ptr<lsp::istream>) = 0; protected: - MessageIssueHandler& issueHandler; - std::shared_ptr < lsp::istream> input; - + MessageIssueHandler& issueHandler; + std::shared_ptr<lsp::istream> input; }; class LSPStreamMessageProducer : public StreamMessageProducer @@ -51,41 +46,30 @@ public: }; bool handleMessage(Headers& headers, MessageConsumer callBack); - LSPStreamMessageProducer( - MessageIssueHandler& message_issue_handler, std::shared_ptr < lsp::istream> _input) - : StreamMessageProducer(message_issue_handler,_input) + LSPStreamMessageProducer(MessageIssueHandler& message_issue_handler, std::shared_ptr<lsp::istream> _input) + : StreamMessageProducer(message_issue_handler, _input) { } - LSPStreamMessageProducer( - MessageIssueHandler& message_issue_handler) - : StreamMessageProducer(message_issue_handler) + LSPStreamMessageProducer(MessageIssueHandler& message_issue_handler) : StreamMessageProducer(message_issue_handler) { } - void listen(MessageConsumer) override; void bind(std::shared_ptr<lsp::istream>) override; void parseHeader(std::string& line, Headers& headers); - - }; class DelimitedStreamMessageProducer : public StreamMessageProducer { public: - - DelimitedStreamMessageProducer( - MessageIssueHandler& message_issue_handler, std::shared_ptr <lsp::istream> _input) - : StreamMessageProducer(message_issue_handler,_input) + DelimitedStreamMessageProducer(MessageIssueHandler& message_issue_handler, std::shared_ptr<lsp::istream> _input) + : StreamMessageProducer(message_issue_handler, _input) { } - DelimitedStreamMessageProducer( - MessageIssueHandler& message_issue_handler) - : StreamMessageProducer(message_issue_handler) + DelimitedStreamMessageProducer(MessageIssueHandler& message_issue_handler) + : StreamMessageProducer(message_issue_handler) { } - void listen(MessageConsumer) override; - void bind(std::shared_ptr < lsp::istream>) override; - -};
\ No newline at end of file + void bind(std::shared_ptr<lsp::istream>) override; +}; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/TcpServer.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/TcpServer.h index a377be8c3e..9601eecd80 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/TcpServer.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/TcpServer.h @@ -4,37 +4,39 @@ #include <string> #include "RemoteEndPoint.h" -namespace lsp { - class Log; +namespace lsp +{ +class Log; } namespace lsp { - /// The top-level class of the HTTP server. - class TcpServer - { - public: - TcpServer(const TcpServer&) = delete; - TcpServer& operator=(const TcpServer&) = delete; - ~TcpServer(); - /// Construct the server to listen on the specified TCP address and port, and - /// serve up files from the given directory. - explicit TcpServer(const std::string& address, const std::string& port, - std::shared_ptr < MessageJsonHandler> json_handler, - std::shared_ptr < Endpoint> localEndPoint, lsp::Log& ,uint32_t _max_workers = 2); +/// The top-level class of the HTTP server. +class TcpServer +{ +public: + TcpServer(TcpServer const&) = delete; + TcpServer& operator=(TcpServer const&) = delete; + ~TcpServer(); + /// Construct the server to listen on the specified TCP address and port, and + /// serve up files from the given directory. + explicit TcpServer( + std::string const& address, std::string const& port, std::shared_ptr<MessageJsonHandler> json_handler, + std::shared_ptr<Endpoint> localEndPoint, lsp::Log&, uint32_t _max_workers = 2 + ); - /// Run the server's io_context loop. - void run(); - void stop(); + /// Run the server's io_context loop. + void run(); + void stop(); - RemoteEndPoint point; - private: - struct Data; - /// Perform an asynchronous accept operation. - void do_accept(); + RemoteEndPoint point; - /// Wait for a request to stop the server. - void do_stop(); - Data* d_ptr = nullptr; - }; -} // namespace +private: + struct Data; + /// Perform an asynchronous accept operation. + void do_accept(); + /// Wait for a request to stop the server. + void do_stop(); + Data* d_ptr = nullptr; +}; +} // namespace lsp diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/WebSocketServer.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/WebSocketServer.h index 5206525ceb..63a48125bb 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/WebSocketServer.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/WebSocketServer.h @@ -5,83 +5,80 @@ #include <boost/beast/core/tcp_stream.hpp> #include <boost/beast/websocket/stream.hpp> - #include "RemoteEndPoint.h" #include "stream.h" #include "threaded_queue.h" -namespace lsp { - class Log; +namespace lsp +{ +class Log; } - namespace lsp { +class websocket_stream_wrapper : public istream, public ostream +{ +public: + websocket_stream_wrapper(boost::beast::websocket::stream<boost::beast::tcp_stream>& _w); + boost::beast::websocket::stream<boost::beast::tcp_stream>& ws_; + std::atomic<bool> quit {}; + std::shared_ptr<MultiQueueWaiter> request_waiter; + ThreadedQueue<char> on_request; + std::string error_message; + bool fail() override; - class websocket_stream_wrapper :public istream, public ostream - { - public: - - websocket_stream_wrapper(boost::beast::websocket::stream<boost::beast::tcp_stream>& _w); - - boost::beast::websocket::stream<boost::beast::tcp_stream>& ws_; - std::atomic<bool> quit{}; - std::shared_ptr < MultiQueueWaiter> request_waiter; - ThreadedQueue< char > on_request; - std::string error_message; - bool fail() override; - - bool eof() override; - - bool good() override; - - websocket_stream_wrapper& read(char* str, std::streamsize count) override; - - int get() override; - - bool bad() override; - - websocket_stream_wrapper& write(const std::string& c) override; - - websocket_stream_wrapper& write(std::streamsize _s) override; + bool eof() override; - websocket_stream_wrapper& flush() override; + bool good() override; - void clear() override; + websocket_stream_wrapper& read(char* str, std::streamsize count) override; - std::string what() override; - }; + int get() override; - /// The top-level class of the HTTP server. - class WebSocketServer - { - public: - WebSocketServer(const WebSocketServer&) = delete; - WebSocketServer& operator=(const WebSocketServer&) = delete; - ~WebSocketServer(); - /// Construct the server to listen on the specified TCP address and port, and - /// serve up files from the given directory. - explicit WebSocketServer(const std::string& user_agent, const std::string& address, const std::string& port, - std::shared_ptr < MessageJsonHandler> json_handler, - std::shared_ptr < Endpoint> localEndPoint, lsp::Log& ,uint32_t _max_workers = 2); + bool bad() override; - /// Run the server's io_context loop. - void run(); - void stop(); + websocket_stream_wrapper& write(std::string const& c) override; - RemoteEndPoint point; - private: - struct Data; - /// Perform an asynchronous accept operation. - void do_accept(); + websocket_stream_wrapper& write(std::streamsize _s) override; - /// Wait for a request to stop the server. - void do_stop(); - Data* d_ptr = nullptr; + websocket_stream_wrapper& flush() override; + void clear() override; - }; + std::string what() override; +}; - } // namespace +/// The top-level class of the HTTP server. +class WebSocketServer +{ +public: + WebSocketServer(WebSocketServer const&) = delete; + WebSocketServer& operator=(WebSocketServer const&) = delete; + ~WebSocketServer(); + /// Construct the server to listen on the specified TCP address and port, and + /// serve up files from the given directory. + explicit WebSocketServer( + std::string const& user_agent, std::string const& address, std::string const& port, + std::shared_ptr<MessageJsonHandler> json_handler, std::shared_ptr<Endpoint> localEndPoint, lsp::Log&, + uint32_t _max_workers = 2 + ); + + /// Run the server's io_context loop. + void run(); + void stop(); + + RemoteEndPoint point; + +private: + struct Data; + /// Perform an asynchronous accept operation. + void do_accept(); + + /// Wait for a request to stop the server. + void do_stop(); + Data* d_ptr = nullptr; +}; + +} // namespace lsp diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/future.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/future.h index 8e241d96e9..863c597ac3 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/future.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/future.h @@ -18,161 +18,169 @@ #include <memory> #include <mutex> -namespace lsp { +namespace lsp +{ // internal functionality -namespace detail { -template <typename T> -struct promise_state { - T val; - std::mutex mutex; - std::condition_variable cv; - bool hasVal = false; -}; -} // namespace detail +namespace detail +{ + template<typename T> + struct promise_state + { + T val; + std::mutex mutex; + std::condition_variable cv; + bool hasVal = false; + }; +} // namespace detail // forward declaration -template <typename T> +template<typename T> class promise; // future_status is the enumeration returned by future::wait_for and // future::wait_until. -enum class future_status { - ready, - timeout, +enum class future_status +{ + ready, + timeout, }; // future is a minimal reimplementation of std::future, that does not suffer // from TSAN false positives. See: // https://gcc.gnu.org/bugzilla//show_bug.cgi?id=69204 -template <typename T> -class future { - public: - using State = detail::promise_state<T>; - - // constructors - inline future() = default; - inline future(future&&) = default; - - // valid() returns true if the future has an internal state. - bool valid() const; - - // get() blocks until the future has a valid result, and returns it. - // The future must have a valid internal state to call this method. - inline T get(); - - // wait() blocks until the future has a valid result. - // The future must have a valid internal state to call this method. - void wait() const; - - // wait_for() blocks until the future has a valid result, or the timeout is - // reached. - // The future must have a valid internal state to call this method. - template <class Rep, class Period> - future_status wait_for( - const std::chrono::duration<Rep, Period>& timeout) const; - - // wait_until() blocks until the future has a valid result, or the timeout is - // reached. - // The future must have a valid internal state to call this method. - template <class Clock, class Duration> - future_status wait_until( - const std::chrono::time_point<Clock, Duration>& timeout) const; - - private: - friend promise<T>; - future(const future&) = delete; - inline future(const std::shared_ptr<State>& state); - - std::shared_ptr<State> state = std::make_shared<State>(); +template<typename T> +class future +{ +public: + using State = detail::promise_state<T>; + + // constructors + inline future() = default; + inline future(future&&) = default; + + // valid() returns true if the future has an internal state. + bool valid() const; + + // get() blocks until the future has a valid result, and returns it. + // The future must have a valid internal state to call this method. + inline T get(); + + // wait() blocks until the future has a valid result. + // The future must have a valid internal state to call this method. + void wait() const; + + // wait_for() blocks until the future has a valid result, or the timeout is + // reached. + // The future must have a valid internal state to call this method. + template<class Rep, class Period> + future_status wait_for(std::chrono::duration<Rep, Period> const& timeout) const; + + // wait_until() blocks until the future has a valid result, or the timeout is + // reached. + // The future must have a valid internal state to call this method. + template<class Clock, class Duration> + future_status wait_until(std::chrono::time_point<Clock, Duration> const& timeout) const; + +private: + friend promise<T>; + future(future const&) = delete; + inline future(std::shared_ptr<State> const& state); + + std::shared_ptr<State> state = std::make_shared<State>(); }; -template <typename T> -future<T>::future(const std::shared_ptr<State>& s) : state(s) {} +template<typename T> +future<T>::future(std::shared_ptr<State> const& s) : state(s) +{ +} -template <typename T> -bool future<T>::valid() const { - return static_cast<bool>(state); +template<typename T> +bool future<T>::valid() const +{ + return static_cast<bool>(state); } -template <typename T> -T future<T>::get() { - std::unique_lock<std::mutex> lock(state->mutex); - state->cv.wait(lock, [&] { return state->hasVal; }); - return state->val; +template<typename T> +T future<T>::get() +{ + std::unique_lock<std::mutex> lock(state->mutex); + state->cv.wait(lock, [&] { return state->hasVal; }); + return state->val; } -template <typename T> -void future<T>::wait() const { - std::unique_lock<std::mutex> lock(state->mutex); - state->cv.wait(lock, [&] { return state->hasVal; }); +template<typename T> +void future<T>::wait() const +{ + std::unique_lock<std::mutex> lock(state->mutex); + state->cv.wait(lock, [&] { return state->hasVal; }); } -template <typename T> -template <class Rep, class Period> -future_status future<T>::wait_for( - const std::chrono::duration<Rep, Period>& timeout) const { - std::unique_lock<std::mutex> lock(state->mutex); - return state->cv.wait_for(lock, timeout, [&] { return state->hasVal; }) - ? future_status::ready - : future_status::timeout; +template<typename T> +template<class Rep, class Period> +future_status future<T>::wait_for(std::chrono::duration<Rep, Period> const& timeout) const +{ + std::unique_lock<std::mutex> lock(state->mutex); + return state->cv.wait_for(lock, timeout, [&] { return state->hasVal; }) ? future_status::ready + : future_status::timeout; } -template <typename T> -template <class Clock, class Duration> -future_status future<T>::wait_until( - const std::chrono::time_point<Clock, Duration>& timeout) const { - std::unique_lock<std::mutex> lock(state->mutex); - return state->cv.wait_until(lock, timeout, [&] { return state->hasVal; }) - ? future_status::ready - : future_status::timeout; +template<typename T> +template<class Clock, class Duration> +future_status future<T>::wait_until(std::chrono::time_point<Clock, Duration> const& timeout) const +{ + std::unique_lock<std::mutex> lock(state->mutex); + return state->cv.wait_until(lock, timeout, [&] { return state->hasVal; }) ? future_status::ready + : future_status::timeout; } // promise is a minimal reimplementation of std::promise, that does not suffer // from TSAN false positives. See: // https://gcc.gnu.org/bugzilla//show_bug.cgi?id=69204 -template <typename T> -class promise { - public: - // constructors - inline promise() = default; - inline promise(promise&& other) = default; - inline promise(const promise& other) = default; - - // set_value() stores value to the shared state. - // set_value() must only be called once. - inline void set_value(const T& value) const; - inline void set_value(T&& value) const; - - // get_future() returns a future sharing this promise's state. - future<T> get_future(); - - private: - using State = detail::promise_state<T>; - std::shared_ptr<State> state = std::make_shared<State>(); +template<typename T> +class promise +{ +public: + // constructors + inline promise() = default; + inline promise(promise&& other) = default; + inline promise(promise const& other) = default; + + // set_value() stores value to the shared state. + // set_value() must only be called once. + inline void set_value(T const& value) const; + inline void set_value(T&& value) const; + + // get_future() returns a future sharing this promise's state. + future<T> get_future(); + +private: + using State = detail::promise_state<T>; + std::shared_ptr<State> state = std::make_shared<State>(); }; -template <typename T> -future<T> promise<T>::get_future() { - return future<T>(state); +template<typename T> +future<T> promise<T>::get_future() +{ + return future<T>(state); } -template <typename T> -void promise<T>::set_value(const T& value) const { - std::unique_lock<std::mutex> lock(state->mutex); - state->val = value; - state->hasVal = true; - state->cv.notify_all(); +template<typename T> +void promise<T>::set_value(T const& value) const +{ + std::unique_lock<std::mutex> lock(state->mutex); + state->val = value; + state->hasVal = true; + state->cv.notify_all(); } -template <typename T> -void promise<T>::set_value(T&& value) const { - std::unique_lock<std::mutex> lock(state->mutex); - state->val = std::move(value); - state->hasVal = true; - state->cv.notify_all(); +template<typename T> +void promise<T>::set_value(T&& value) const +{ + std::unique_lock<std::mutex> lock(state->mutex); + state->val = std::move(value); + state->hasVal = true; + state->cv.notify_all(); } -} // namespace lsp - - +} // namespace lsp diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/json.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/json.h index 34e6232917..ff28200e59 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/json.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/json.h @@ -5,77 +5,186 @@ #include <rapidjson/document.h> #include <rapidjson/prettywriter.h> -class JsonReader : public Reader { - - std::vector<const char*> path_; - - public: - rapidjson::GenericValue<rapidjson::UTF8<>>* m_; - JsonReader(rapidjson::GenericValue<rapidjson::UTF8<>>* m) : m_(m) {} - SerializeFormat Format() const override { return SerializeFormat::Json; } - - bool IsBool() override { return m_->IsBool(); } - bool IsNull() override { return m_->IsNull(); } - bool IsArray() override { return m_->IsArray(); } - bool IsInt() override { return m_->IsInt(); } - bool IsInt64() override { return m_->IsInt64(); } - bool IsUint64() override { return m_->IsUint64(); } - bool IsDouble() override { return m_->IsDouble(); } - bool IsNumber() override { return m_->IsNumber(); } - bool IsString() override { return m_->IsString(); } - - void GetNull() override {} - bool GetBool() override { return m_->GetBool(); } - int GetInt() override { return m_->GetInt(); } - uint32_t GetUint32() override { return uint32_t(m_->GetUint64()); } - int64_t GetInt64() override { return m_->GetInt64(); } - uint64_t GetUint64() override { return m_->GetUint64(); } - double GetDouble() override { return m_->GetDouble(); } - std::string GetString() override { return m_->GetString(); } - - bool HasMember(const char* x) override - { - if (m_->IsObject()) - return m_->HasMember(x); - else - return false; - } - std::unique_ptr<Reader> operator[](const char* x) override { - auto& sub = (*m_)[x]; - return std::unique_ptr<JsonReader>(new JsonReader(&sub)); - } - - std::string ToString() const override; - - void IterMap(std::function<void(const char*, Reader&)> fn) override; - - void IterArray(std::function<void(Reader&)> fn) override; - - void DoMember(const char* name, std::function<void(Reader&)> fn) override; - - std::string GetPath() const; +class JsonReader : public Reader +{ + + std::vector<char const*> path_; + +public: + rapidjson::GenericValue<rapidjson::UTF8<>>* m_; + JsonReader(rapidjson::GenericValue<rapidjson::UTF8<>>* m) : m_(m) + { + } + SerializeFormat Format() const override + { + return SerializeFormat::Json; + } + + bool IsBool() override + { + return m_->IsBool(); + } + bool IsNull() override + { + return m_->IsNull(); + } + bool IsArray() override + { + return m_->IsArray(); + } + bool IsInt() override + { + return m_->IsInt(); + } + bool IsInt64() override + { + return m_->IsInt64(); + } + bool IsUint64() override + { + return m_->IsUint64(); + } + bool IsDouble() override + { + return m_->IsDouble(); + } + bool IsNumber() override + { + return m_->IsNumber(); + } + bool IsString() override + { + return m_->IsString(); + } + + void GetNull() override + { + } + bool GetBool() override + { + return m_->GetBool(); + } + int GetInt() override + { + return m_->GetInt(); + } + uint32_t GetUint32() override + { + return uint32_t(m_->GetUint64()); + } + int64_t GetInt64() override + { + return m_->GetInt64(); + } + uint64_t GetUint64() override + { + return m_->GetUint64(); + } + double GetDouble() override + { + return m_->GetDouble(); + } + std::string GetString() override + { + return m_->GetString(); + } + + bool HasMember(char const* x) override + { + if (m_->IsObject()) + { + return m_->HasMember(x); + } + else + { + return false; + } + } + std::unique_ptr<Reader> operator[](char const* x) override + { + auto& sub = (*m_)[x]; + return std::unique_ptr<JsonReader>(new JsonReader(&sub)); + } + + std::string ToString() const override; + + void IterMap(std::function<void(char const*, Reader&)> fn) override; + + void IterArray(std::function<void(Reader&)> fn) override; + + void DoMember(char const* name, std::function<void(Reader&)> fn) override; + + std::string GetPath() const; }; -class JsonWriter : public Writer { - - public: - rapidjson::Writer<rapidjson::StringBuffer>* m_; - - JsonWriter(rapidjson::Writer<rapidjson::StringBuffer>* m) : m_(m) {} - SerializeFormat Format() const override { return SerializeFormat::Json; } - - void Null() override { m_->Null(); } - void Bool(bool x) override { m_->Bool(x); } - void Int(int x) override { m_->Int(x); } - void Uint32(uint32_t x) override { m_->Uint64(x); } - void Int64(int64_t x) override { m_->Int64(x); } - void Uint64(uint64_t x) override { m_->Uint64(x); } - void Double(double x) override { m_->Double(x); } - void String(const char* x) override { m_->String(x); } - void String(const char* x, size_t len) override { m_->String(x, len); } - void StartArray(size_t) override { m_->StartArray(); } - void EndArray() override { m_->EndArray(); } - void StartObject() override { m_->StartObject(); } - void EndObject() override { m_->EndObject(); } - void Key(const char* name) override { m_->Key(name); } +class JsonWriter : public Writer +{ + +public: + rapidjson::Writer<rapidjson::StringBuffer>* m_; + + JsonWriter(rapidjson::Writer<rapidjson::StringBuffer>* m) : m_(m) + { + } + SerializeFormat Format() const override + { + return SerializeFormat::Json; + } + + void Null() override + { + m_->Null(); + } + void Bool(bool x) override + { + m_->Bool(x); + } + void Int(int x) override + { + m_->Int(x); + } + void Uint32(uint32_t x) override + { + m_->Uint64(x); + } + void Int64(int64_t x) override + { + m_->Int64(x); + } + void Uint64(uint64_t x) override + { + m_->Uint64(x); + } + void Double(double x) override + { + m_->Double(x); + } + void String(char const* x) override + { + m_->String(x); + } + void String(char const* x, size_t len) override + { + m_->String(x, len); + } + void StartArray(size_t) override + { + m_->StartArray(); + } + void EndArray() override + { + m_->EndArray(); + } + void StartObject() override + { + m_->StartObject(); + } + void EndObject() override + { + m_->EndObject(); + } + void Key(char const* name) override + { + m_->Key(name); + } }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/lsRequestId.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/lsRequestId.h index 2efc80b19a..0af5abc0c1 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/lsRequestId.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/lsRequestId.h @@ -2,50 +2,69 @@ #include "LibLsp/JsonRpc/serializer.h" -struct lsRequestId { - // The client can send the request id as an int or a string. We should output - // the same format we received. - enum Type { kNone, kInt, kString }; - Type type = kNone; +struct lsRequestId +{ + // The client can send the request id as an int or a string. We should output + // the same format we received. + enum Type + { + kNone, + kInt, + kString + }; + Type type = kNone; - int value = -1; - std::string k_string; - bool has_value() const { return type != kNone; } - void swap(lsRequestId& arg) noexcept + int value = -1; + std::string k_string; + bool has_value() const + { + return type != kNone; + } + void swap(lsRequestId& arg) noexcept + { + std::swap(arg, *this); + } + void set(int v) + { + value = v; + type = kInt; + } + void set(std::string const& v) + { + k_string = v; + type = kString; + } + bool operator==(lsRequestId const& rhs) const + { + if (type != rhs.type) { - std::swap(arg, *this); + return false; } - void set(int v) + if (type == kInt) { - value = v; - type = kInt; + return value == rhs.value; } - void set(const std::string& v) + return k_string == rhs.k_string; + } + bool operator!=(lsRequestId const& rhs) const + { + return !operator==(rhs); + } + bool operator<(lsRequestId const& rhs) const + { + if (type != rhs.type) { - k_string = v; - type = kString; + return false; } - bool operator==(const lsRequestId& rhs) const + if (type == kInt) { - if (type != rhs.type) return false; - if (type == kInt) - return value == rhs.value; - return k_string == rhs.k_string; - } - bool operator!=(const lsRequestId& rhs) const - { - return !operator==(rhs); - } - bool operator<(const lsRequestId& rhs) const - { - if (type != rhs.type) return false; - if (type == kInt) - return value < rhs.value; - return k_string < rhs.k_string; + return value < rhs.value; } + return k_string < rhs.k_string; + } }; void Reflect(Reader& visitor, lsRequestId& value); void Reflect(Writer& visitor, lsRequestId& value); // Debug method to convert an id to a string. -std::string ToString(const lsRequestId& id); +std::string ToString(lsRequestId const& id); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/lsResponseMessage.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/lsResponseMessage.h index 68ad502b0c..06d173c518 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/lsResponseMessage.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/lsResponseMessage.h @@ -4,68 +4,74 @@ #include "LibLsp/JsonRpc/message.h" #include "LibLsp/lsp/method_type.h" +struct ResponseInMessage : public LspMessage +{ -struct ResponseInMessage :public LspMessage { + lsRequestId id; + std::string m_methodType; - lsRequestId id; - std::string m_methodType; + virtual MethodType GetMethodType() const override + { + return m_methodType.data(); + }; + virtual void SetMethodType(MethodType _type) override + { + m_methodType = _type; + }; - virtual MethodType GetMethodType() const override - { - return m_methodType.data(); - }; - virtual void SetMethodType(MethodType _type) override - { - m_methodType = _type; - }; - - Kind GetKid() override - { - return RESPONCE_MESSAGE; - } - virtual bool IsErrorType() - { - return false; - } + Kind GetKid() override + { + return RESPONCE_MESSAGE; + } + virtual bool IsErrorType() + { + return false; + } }; -template <class TDerived > -struct BaseResponseMessage : ResponseInMessage { - - void ReflectWriter(Writer& writer) override { - Reflect(writer, static_cast<TDerived&>(*this)); - } - static std::unique_ptr<LspMessage> ReflectReader(Reader& visitor) { +template<class TDerived> +struct BaseResponseMessage : ResponseInMessage +{ - TDerived* temp = new TDerived(); - std::unique_ptr<TDerived> message = std::unique_ptr<TDerived>(temp); - // Reflect may throw and *message will be partially deserialized. - Reflect(visitor, static_cast<TDerived&>(*temp)); - return message; - } + void ReflectWriter(Writer& writer) override + { + Reflect(writer, static_cast<TDerived&>(*this)); + } + static std::unique_ptr<LspMessage> ReflectReader(Reader& visitor) + { + TDerived* temp = new TDerived(); + std::unique_ptr<TDerived> message = std::unique_ptr<TDerived>(temp); + // Reflect may throw and *message will be partially deserialized. + Reflect(visitor, static_cast<TDerived&>(*temp)); + return message; + } }; - -template <class T, class TDerived > -struct ResponseMessage : BaseResponseMessage<TDerived> { - T result; - void swap(ResponseMessage<T, TDerived>& arg) noexcept - { - std::swap(result, arg.result); - this->id.swap(arg.id); - this->m_methodType.swap(arg.m_methodType); - } +template<class T, class TDerived> +struct ResponseMessage : BaseResponseMessage<TDerived> +{ + T result; + void swap(ResponseMessage<T, TDerived>& arg) noexcept + { + std::swap(result, arg.result); + this->id.swap(arg.id); + this->m_methodType.swap(arg.m_methodType); + } }; -template <class T, class TDerived > -struct ResponseError : BaseResponseMessage<TDerived> { - T error; - bool IsErrorType() override { return true; } - void swap(ResponseError<T, TDerived>& arg) noexcept - { +template<class T, class TDerived> +struct ResponseError : BaseResponseMessage<TDerived> +{ + T error; + bool IsErrorType() override + { + return true; + } + void swap(ResponseError<T, TDerived>& arg) noexcept + { - this->id.swap(arg.id); - this->m_methodType.swap(arg.m_methodType); - std::swap(error, arg.error); - } + this->id.swap(arg.id); + this->m_methodType.swap(arg.m_methodType); + std::swap(error, arg.error); + } }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/macro_map.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/macro_map.h index 19a9634286..7ce6d14875 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/macro_map.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/macro_map.h @@ -35,100 +35,445 @@ DEALINGS IN THE SOFTWARE. #pragma once -static constexpr const int max_visitable_members = 69; +static constexpr int const max_visitable_members = 69; #define VISIT_STRUCT_EXPAND(x) x #define VISIT_STRUCT_PP_ARG_N( \ - _1, _2, _3, _4, _5, _6, _7, _8, _9, _10,\ - _11, _12, _13, _14, _15, _16, _17, _18, _19, _20,\ - _21, _22, _23, _24, _25, _26, _27, _28, _29, _30,\ - _31, _32, _33, _34, _35, _36, _37, _38, _39, _40,\ - _41, _42, _43, _44, _45, _46, _47, _48, _49, _50,\ - _51, _52, _53, _54, _55, _56, _57, _58, _59, _60,\ - _61, _62, _63, _64, _65, _66, _67, _68, _69, N, ...) N -#define VISIT_STRUCT_PP_NARG(...) VISIT_STRUCT_EXPAND(VISIT_STRUCT_PP_ARG_N(__VA_ARGS__, \ - 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, \ - 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, \ - 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, \ - 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, \ - 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, \ - 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, \ - 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)) + _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, N, \ + ... \ +) \ + N +#define VISIT_STRUCT_PP_NARG(...) \ + VISIT_STRUCT_EXPAND(VISIT_STRUCT_PP_ARG_N( \ + __VA_ARGS__, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, \ + 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, \ + 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 \ + )) /* need extra level to force extra eval */ -#define VISIT_STRUCT_CONCAT_(a,b) a ## b -#define VISIT_STRUCT_CONCAT(a,b) VISIT_STRUCT_CONCAT_(a,b) +#define VISIT_STRUCT_CONCAT_(a, b) a##b +#define VISIT_STRUCT_CONCAT(a, b) VISIT_STRUCT_CONCAT_(a, b) #define VISIT_STRUCT_APPLYF0(f) -#define VISIT_STRUCT_APPLYF1(f,_1) f(_1) -#define VISIT_STRUCT_APPLYF2(f,_1,_2) f(_1) f(_2) -#define VISIT_STRUCT_APPLYF3(f,_1,_2,_3) f(_1) f(_2) f(_3) -#define VISIT_STRUCT_APPLYF4(f,_1,_2,_3,_4) f(_1) f(_2) f(_3) f(_4) -#define VISIT_STRUCT_APPLYF5(f,_1,_2,_3,_4,_5) f(_1) f(_2) f(_3) f(_4) f(_5) -#define VISIT_STRUCT_APPLYF6(f,_1,_2,_3,_4,_5,_6) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) -#define VISIT_STRUCT_APPLYF7(f,_1,_2,_3,_4,_5,_6,_7) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) -#define VISIT_STRUCT_APPLYF8(f,_1,_2,_3,_4,_5,_6,_7,_8) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) -#define VISIT_STRUCT_APPLYF9(f,_1,_2,_3,_4,_5,_6,_7,_8,_9) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) -#define VISIT_STRUCT_APPLYF10(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) -#define VISIT_STRUCT_APPLYF11(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) -#define VISIT_STRUCT_APPLYF12(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) -#define VISIT_STRUCT_APPLYF13(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) -#define VISIT_STRUCT_APPLYF14(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) -#define VISIT_STRUCT_APPLYF15(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) -#define VISIT_STRUCT_APPLYF16(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) -#define VISIT_STRUCT_APPLYF17(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) -#define VISIT_STRUCT_APPLYF18(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) -#define VISIT_STRUCT_APPLYF19(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) -#define VISIT_STRUCT_APPLYF20(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) -#define VISIT_STRUCT_APPLYF21(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) -#define VISIT_STRUCT_APPLYF22(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) -#define VISIT_STRUCT_APPLYF23(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) -#define VISIT_STRUCT_APPLYF24(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) -#define VISIT_STRUCT_APPLYF25(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) -#define VISIT_STRUCT_APPLYF26(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) -#define VISIT_STRUCT_APPLYF27(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) -#define VISIT_STRUCT_APPLYF28(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) -#define VISIT_STRUCT_APPLYF29(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) -#define VISIT_STRUCT_APPLYF30(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) -#define VISIT_STRUCT_APPLYF31(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) -#define VISIT_STRUCT_APPLYF32(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) -#define VISIT_STRUCT_APPLYF33(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) -#define VISIT_STRUCT_APPLYF34(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) -#define VISIT_STRUCT_APPLYF35(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) -#define VISIT_STRUCT_APPLYF36(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) -#define VISIT_STRUCT_APPLYF37(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) -#define VISIT_STRUCT_APPLYF38(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) -#define VISIT_STRUCT_APPLYF39(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) -#define VISIT_STRUCT_APPLYF40(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) -#define VISIT_STRUCT_APPLYF41(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) -#define VISIT_STRUCT_APPLYF42(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) -#define VISIT_STRUCT_APPLYF43(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) -#define VISIT_STRUCT_APPLYF44(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) -#define VISIT_STRUCT_APPLYF45(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) -#define VISIT_STRUCT_APPLYF46(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) -#define VISIT_STRUCT_APPLYF47(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) -#define VISIT_STRUCT_APPLYF48(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) -#define VISIT_STRUCT_APPLYF49(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) -#define VISIT_STRUCT_APPLYF50(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) -#define VISIT_STRUCT_APPLYF51(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) -#define VISIT_STRUCT_APPLYF52(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) -#define VISIT_STRUCT_APPLYF53(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) -#define VISIT_STRUCT_APPLYF54(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) -#define VISIT_STRUCT_APPLYF55(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54,_55) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) -#define VISIT_STRUCT_APPLYF56(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54,_55,_56) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) -#define VISIT_STRUCT_APPLYF57(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54,_55,_56,_57) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) -#define VISIT_STRUCT_APPLYF58(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54,_55,_56,_57,_58) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) -#define VISIT_STRUCT_APPLYF59(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54,_55,_56,_57,_58,_59) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) -#define VISIT_STRUCT_APPLYF60(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54,_55,_56,_57,_58,_59,_60) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) -#define VISIT_STRUCT_APPLYF61(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54,_55,_56,_57,_58,_59,_60,_61) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) -#define VISIT_STRUCT_APPLYF62(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54,_55,_56,_57,_58,_59,_60,_61,_62) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) f(_62) -#define VISIT_STRUCT_APPLYF63(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54,_55,_56,_57,_58,_59,_60,_61,_62,_63) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) f(_62) f(_63) -#define VISIT_STRUCT_APPLYF64(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54,_55,_56,_57,_58,_59,_60,_61,_62,_63,_64) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) f(_62) f(_63) f(_64) -#define VISIT_STRUCT_APPLYF65(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54,_55,_56,_57,_58,_59,_60,_61,_62,_63,_64,_65) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) f(_62) f(_63) f(_64) f(_65) -#define VISIT_STRUCT_APPLYF66(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54,_55,_56,_57,_58,_59,_60,_61,_62,_63,_64,_65,_66) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) f(_62) f(_63) f(_64) f(_65) f(_66) -#define VISIT_STRUCT_APPLYF67(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54,_55,_56,_57,_58,_59,_60,_61,_62,_63,_64,_65,_66,_67) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) f(_62) f(_63) f(_64) f(_65) f(_66) f(_67) -#define VISIT_STRUCT_APPLYF68(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54,_55,_56,_57,_58,_59,_60,_61,_62,_63,_64,_65,_66,_67,_68) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) f(_62) f(_63) f(_64) f(_65) f(_66) f(_67) f(_68) -#define VISIT_STRUCT_APPLYF69(f,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,_32,_33,_34,_35,_36,_37,_38,_39,_40,_41,_42,_43,_44,_45,_46,_47,_48,_49,_50,_51,_52,_53,_54,_55,_56,_57,_58,_59,_60,_61,_62,_63,_64,_65,_66,_67,_68,_69) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) f(_62) f(_63) f(_64) f(_65) f(_66) f(_67) f(_68) f(_69) +#define VISIT_STRUCT_APPLYF1(f, _1) f(_1) +#define VISIT_STRUCT_APPLYF2(f, _1, _2) f(_1) f(_2) +#define VISIT_STRUCT_APPLYF3(f, _1, _2, _3) f(_1) f(_2) f(_3) +#define VISIT_STRUCT_APPLYF4(f, _1, _2, _3, _4) f(_1) f(_2) f(_3) f(_4) +#define VISIT_STRUCT_APPLYF5(f, _1, _2, _3, _4, _5) f(_1) f(_2) f(_3) f(_4) f(_5) +#define VISIT_STRUCT_APPLYF6(f, _1, _2, _3, _4, _5, _6) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) +#define VISIT_STRUCT_APPLYF7(f, _1, _2, _3, _4, _5, _6, _7) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) +#define VISIT_STRUCT_APPLYF8(f, _1, _2, _3, _4, _5, _6, _7, _8) f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) +#define VISIT_STRUCT_APPLYF9(f, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) +#define VISIT_STRUCT_APPLYF10(f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) +#define VISIT_STRUCT_APPLYF11(f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) +#define VISIT_STRUCT_APPLYF12(f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) +#define VISIT_STRUCT_APPLYF13(f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) +#define VISIT_STRUCT_APPLYF14(f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) +#define VISIT_STRUCT_APPLYF15(f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) +#define VISIT_STRUCT_APPLYF16(f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) +#define VISIT_STRUCT_APPLYF17(f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) +#define VISIT_STRUCT_APPLYF18(f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) f(_18) +#define VISIT_STRUCT_APPLYF19(f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) +#define VISIT_STRUCT_APPLYF20( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) +#define VISIT_STRUCT_APPLYF21( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) +#define VISIT_STRUCT_APPLYF22( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) +#define VISIT_STRUCT_APPLYF23( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) +#define VISIT_STRUCT_APPLYF24( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) +#define VISIT_STRUCT_APPLYF25( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) +#define VISIT_STRUCT_APPLYF26( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) +#define VISIT_STRUCT_APPLYF27( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) +#define VISIT_STRUCT_APPLYF28( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) +#define VISIT_STRUCT_APPLYF29( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) +#define VISIT_STRUCT_APPLYF30( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) +#define VISIT_STRUCT_APPLYF31( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) +#define VISIT_STRUCT_APPLYF32( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) +#define VISIT_STRUCT_APPLYF33( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17 \ + ) f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) f(_33) +#define VISIT_STRUCT_APPLYF34( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) +#define VISIT_STRUCT_APPLYF35( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) +#define VISIT_STRUCT_APPLYF36( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) +#define VISIT_STRUCT_APPLYF37( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) +#define VISIT_STRUCT_APPLYF38( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) +#define VISIT_STRUCT_APPLYF39( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) +#define VISIT_STRUCT_APPLYF40( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) +#define VISIT_STRUCT_APPLYF41( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) +#define VISIT_STRUCT_APPLYF42( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) +#define VISIT_STRUCT_APPLYF43( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) +#define VISIT_STRUCT_APPLYF44( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) +#define VISIT_STRUCT_APPLYF45( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) +#define VISIT_STRUCT_APPLYF46( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) +#define VISIT_STRUCT_APPLYF47( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) +#define VISIT_STRUCT_APPLYF48( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) +#define VISIT_STRUCT_APPLYF49( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) +#define VISIT_STRUCT_APPLYF50( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) +#define VISIT_STRUCT_APPLYF51( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) +#define VISIT_STRUCT_APPLYF52( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) +#define VISIT_STRUCT_APPLYF53( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) +#define VISIT_STRUCT_APPLYF54( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) +#define VISIT_STRUCT_APPLYF55( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54, _55 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) +#define VISIT_STRUCT_APPLYF56( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54, _55, _56 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) +#define VISIT_STRUCT_APPLYF57( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54, _55, _56, _57 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) +#define VISIT_STRUCT_APPLYF58( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) +#define VISIT_STRUCT_APPLYF59( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) +#define VISIT_STRUCT_APPLYF60( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) +#define VISIT_STRUCT_APPLYF61( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) +#define VISIT_STRUCT_APPLYF62( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) \ + f(_62) +#define VISIT_STRUCT_APPLYF63( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) \ + f(_62) f(_63) +#define VISIT_STRUCT_APPLYF64( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) \ + f(_62) f(_63) f(_64) +#define VISIT_STRUCT_APPLYF65( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) \ + f(_62) f(_63) f(_64) f(_65) +#define VISIT_STRUCT_APPLYF66( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) \ + f(_62) f(_63) f(_64) f(_65) f(_66) +#define VISIT_STRUCT_APPLYF67( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) \ + f(_62) f(_63) f(_64) f(_65) f(_66) f(_67) +#define VISIT_STRUCT_APPLYF68( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) \ + f(_62) f(_63) f(_64) f(_65) f(_66) f(_67) f(_68) +#define VISIT_STRUCT_APPLYF69( \ + f, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, \ + _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, \ + _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69 \ +) \ + f(_1) f(_2) f(_3) f(_4) f(_5) f(_6) f(_7) f(_8) f(_9) f(_10) f(_11) f(_12) f(_13) f(_14) f(_15) f(_16) f(_17) \ + f(_18) f(_19) f(_20) f(_21) f(_22) f(_23) f(_24) f(_25) f(_26) f(_27) f(_28) f(_29) f(_30) f(_31) f(_32) \ + f(_33) f(_34) f(_35) f(_36) f(_37) f(_38) f(_39) f(_40) f(_41) f(_42) f(_43) f(_44) f(_45) f(_46) f(_47) \ + f(_48) f(_49) f(_50) f(_51) f(_52) f(_53) f(_54) f(_55) f(_56) f(_57) f(_58) f(_59) f(_60) f(_61) \ + f(_62) f(_63) f(_64) f(_65) f(_66) f(_67) f(_68) f(_69) #define VISIT_STRUCT_APPLY_F_(M, ...) VISIT_STRUCT_EXPAND(M(__VA_ARGS__)) -#define MACRO_MAP(f, ...) VISIT_STRUCT_EXPAND(VISIT_STRUCT_APPLY_F_(VISIT_STRUCT_CONCAT(VISIT_STRUCT_APPLYF, VISIT_STRUCT_PP_NARG(__VA_ARGS__)), f, __VA_ARGS__)) +#define MACRO_MAP(f, ...) \ + VISIT_STRUCT_EXPAND(VISIT_STRUCT_APPLY_F_( \ + VISIT_STRUCT_CONCAT(VISIT_STRUCT_APPLYF, VISIT_STRUCT_PP_NARG(__VA_ARGS__)), f, __VA_ARGS__ \ + )) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/message.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/message.h index 57f4932520..4a0c79922c 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/message.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/message.h @@ -9,26 +9,23 @@ struct LspMessage { public: - std::string jsonrpc = "2.0"; - virtual void ReflectWriter(Writer&) = 0; + std::string jsonrpc = "2.0"; + virtual void ReflectWriter(Writer&) = 0; - // Send the message to the language client by writing it to stdout. - void Write(std::ostream& out); + // Send the message to the language client by writing it to stdout. + void Write(std::ostream& out); + virtual MethodType GetMethodType() const = 0; + virtual void SetMethodType(MethodType) = 0; - virtual MethodType GetMethodType() const = 0; - virtual void SetMethodType(MethodType) = 0; - - virtual ~LspMessage()=default; - enum Kind - { - REQUEST_MESSAGE, - RESPONCE_MESSAGE, - NOTIFICATION_MESSAGE - }; - - virtual Kind GetKid() = 0; - virtual std::string ToJson() ; + virtual ~LspMessage() = default; + enum Kind + { + REQUEST_MESSAGE, + RESPONCE_MESSAGE, + NOTIFICATION_MESSAGE + }; + virtual Kind GetKid() = 0; + virtual std::string ToJson(); }; - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/serializer.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/serializer.h index 1763c84f5f..31d0b27640 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/serializer.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/serializer.h @@ -15,129 +15,138 @@ struct AbsolutePath; -enum class SerializeFormat { Json, MessagePack }; +enum class SerializeFormat +{ + Json, + MessagePack +}; // A tag type that can be used to write `null` to json. struct JsonNull { - void swap(JsonNull& arg) noexcept; + void swap(JsonNull& arg) noexcept; }; - - -class Reader { +class Reader +{ public: - virtual ~Reader() {} - virtual SerializeFormat Format() const = 0; - - virtual bool IsBool() = 0; - virtual bool IsNull() = 0; - virtual bool IsArray() = 0; - virtual bool IsInt() = 0; - virtual bool IsInt64() = 0; - virtual bool IsUint64() = 0; - virtual bool IsDouble() = 0; + virtual ~Reader() + { + } + virtual SerializeFormat Format() const = 0; + + virtual bool IsBool() = 0; + virtual bool IsNull() = 0; + virtual bool IsArray() = 0; + virtual bool IsInt() = 0; + virtual bool IsInt64() = 0; + virtual bool IsUint64() = 0; + virtual bool IsDouble() = 0; virtual bool IsNumber() = 0; virtual bool IsString() = 0; - virtual void GetNull() = 0; - virtual bool GetBool() = 0; - virtual int GetInt() = 0; - virtual uint32_t GetUint32() = 0; - virtual int64_t GetInt64() = 0; - virtual uint64_t GetUint64() = 0; - virtual double GetDouble() = 0; - virtual std::string GetString() = 0; - - virtual bool HasMember(const char* x) = 0; - virtual std::unique_ptr<Reader> operator[](const char* x) = 0; - virtual void IterMap( std::function<void(const char*, Reader&)> fn) = 0; - virtual void IterArray(std::function<void(Reader&)> fn) = 0; - virtual void DoMember(const char* name, std::function<void(Reader&)> fn) = 0; - virtual std::string ToString() const = 0; + virtual void GetNull() = 0; + virtual bool GetBool() = 0; + virtual int GetInt() = 0; + virtual uint32_t GetUint32() = 0; + virtual int64_t GetInt64() = 0; + virtual uint64_t GetUint64() = 0; + virtual double GetDouble() = 0; + virtual std::string GetString() = 0; + + virtual bool HasMember(char const* x) = 0; + virtual std::unique_ptr<Reader> operator[](char const* x) = 0; + virtual void IterMap(std::function<void(char const*, Reader&)> fn) = 0; + virtual void IterArray(std::function<void(Reader&)> fn) = 0; + virtual void DoMember(char const* name, std::function<void(Reader&)> fn) = 0; + virtual std::string ToString() const = 0; }; - - -class Writer { +class Writer +{ public: - virtual ~Writer() {} - virtual SerializeFormat Format() const = 0; - - virtual void Null() = 0; - virtual void Bool(bool x) = 0; - virtual void Int(int x) = 0; - virtual void Uint32(uint32_t x) = 0; - virtual void Int64(int64_t x) = 0; - virtual void Uint64(uint64_t x) = 0; - virtual void Double(double x) = 0; - virtual void String(const char* x) = 0; - virtual void String(const char* x, size_t len) = 0; - virtual void StartArray(size_t) = 0; - virtual void EndArray() = 0; - virtual void StartObject() = 0; - virtual void EndObject() = 0; - virtual void Key(const char* name) = 0; + virtual ~Writer() + { + } + virtual SerializeFormat Format() const = 0; + + virtual void Null() = 0; + virtual void Bool(bool x) = 0; + virtual void Int(int x) = 0; + virtual void Uint32(uint32_t x) = 0; + virtual void Int64(int64_t x) = 0; + virtual void Uint64(uint64_t x) = 0; + virtual void Double(double x) = 0; + virtual void String(char const* x) = 0; + virtual void String(char const* x, size_t len) = 0; + virtual void StartArray(size_t) = 0; + virtual void EndArray() = 0; + virtual void StartObject() = 0; + virtual void EndObject() = 0; + virtual void Key(char const* name) = 0; }; - - -struct optionals_mandatory_tag {}; +struct optionals_mandatory_tag +{ +}; #define REFLECT_MEMBER_START() ReflectMemberStart(visitor, value) #define REFLECT_MEMBER_END() ReflectMemberEnd(visitor, value); #define REFLECT_MEMBER_END1(value) ReflectMemberEnd(visitor, value); #define REFLECT_MEMBER(name) ReflectMember(visitor, #name, value.name) -#define REFLECT_MEMBER_OPTIONALS(name) \ - ReflectMember(visitor, #name, value.name, optionals_mandatory_tag{}) +#define REFLECT_MEMBER_OPTIONALS(name) ReflectMember(visitor, #name, value.name, optionals_mandatory_tag {}) #define REFLECT_MEMBER2(name, value) ReflectMember(visitor, name, value) -#define MAKE_REFLECT_TYPE_PROXY(type_name) \ - MAKE_REFLECT_TYPE_PROXY2(type_name, std::underlying_type<type_name>::type) -#define MAKE_REFLECT_TYPE_PROXY2(type, as_type) \ - inline void Reflect(Reader& visitor, type& value) { \ - as_type value0; \ - ::Reflect(visitor, value0); \ - value = static_cast<type>(value0); \ - } \ - inline void Reflect(Writer& visitor, type& value) { \ - auto value0 = static_cast<as_type>(value); \ - ::Reflect(visitor, value0); \ - } +#define MAKE_REFLECT_TYPE_PROXY(type_name) MAKE_REFLECT_TYPE_PROXY2(type_name, std::underlying_type<type_name>::type) +#define MAKE_REFLECT_TYPE_PROXY2(type, as_type) \ + inline void Reflect(Reader& visitor, type& value) \ + { \ + as_type value0; \ + ::Reflect(visitor, value0); \ + value = static_cast<type>(value0); \ + } \ + inline void Reflect(Writer& visitor, type& value) \ + { \ + auto value0 = static_cast<as_type>(value); \ + ::Reflect(visitor, value0); \ + } #define _MAPPABLE_REFLECT_MEMBER(name) REFLECT_MEMBER(name); #define _MAPPABLE_REFLECT_MEMBER_OPTIONALS(name) REFLECT_MEMBER_OPTIONALS(name); -#define MAKE_REFLECT_EMPTY_STRUCT(type, ...) \ - template <typename TVisitor> \ - void Reflect(TVisitor& visitor, type& value) { \ - REFLECT_MEMBER_START(); \ - REFLECT_MEMBER_END(); \ - } - -#define MAKE_REFLECT_STRUCT(type, ...) \ - template <typename TVisitor> \ - void Reflect(TVisitor& visitor, type& value) { \ - REFLECT_MEMBER_START(); \ - MACRO_MAP(_MAPPABLE_REFLECT_MEMBER, __VA_ARGS__) \ - REFLECT_MEMBER_END(); \ - } - - -#define _MAPPABLE_SWAP_MEMBER(name) std::swap(name,arg.name); - -#define MAKE_SWAP_METHOD(type, ...) \ -void swap(type& arg) noexcept{ \ +#define MAKE_REFLECT_EMPTY_STRUCT(type, ...) \ + template<typename TVisitor> \ + void Reflect(TVisitor& visitor, type& value) \ + { \ + REFLECT_MEMBER_START(); \ + REFLECT_MEMBER_END(); \ + } + +#define MAKE_REFLECT_STRUCT(type, ...) \ + template<typename TVisitor> \ + void Reflect(TVisitor& visitor, type& value) \ + { \ + REFLECT_MEMBER_START(); \ + MACRO_MAP(_MAPPABLE_REFLECT_MEMBER, __VA_ARGS__) \ + REFLECT_MEMBER_END(); \ + } + +#define _MAPPABLE_SWAP_MEMBER(name) std::swap(name, arg.name); + +#define MAKE_SWAP_METHOD(type, ...) \ + void swap(type& arg) noexcept \ + { \ MACRO_MAP(_MAPPABLE_SWAP_MEMBER, __VA_ARGS__) \ -} + } -#define MAKE_REFLECT_STRUCT_OPTIONALS_MANDATORY(type, ...) \ - template <typename TVisitor> \ - void Reflect(TVisitor& visitor, type& value) { \ - REFLECT_MEMBER_START(); \ - MACRO_MAP(_MAPPABLE_REFLECT_MEMBER_OPTIONALS, __VA_ARGS__) \ - REFLECT_MEMBER_END(); \ - } +#define MAKE_REFLECT_STRUCT_OPTIONALS_MANDATORY(type, ...) \ + template<typename TVisitor> \ + void Reflect(TVisitor& visitor, type& value) \ + { \ + REFLECT_MEMBER_START(); \ + MACRO_MAP(_MAPPABLE_REFLECT_MEMBER_OPTIONALS, __VA_ARGS__) \ + REFLECT_MEMBER_END(); \ + } // clang-format off // Config has many fields, we need to support at least its number of fields. @@ -150,11 +159,12 @@ void swap(type& arg) noexcept{ \ // Reflects the struct so it is serialized as an array instead of an object. // This currently only supports writers. #define MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY(type, ...) \ - inline void Reflect(Writer& visitor, type& value) { \ - visitor.StartArray(NUM_VA_ARGS(__VA_ARGS__)); \ - MACRO_MAP(_MAPPABLE_REFLECT_ARRAY, __VA_ARGS__) \ - visitor.EndArray(); \ - } + inline void Reflect(Writer& visitor, type& value) \ + { \ + visitor.StartArray(NUM_VA_ARGS(__VA_ARGS__)); \ + MACRO_MAP(_MAPPABLE_REFLECT_ARRAY, __VA_ARGS__) \ + visitor.EndArray(); \ + } //// Elementary types @@ -201,172 +211,193 @@ void Reflect(Reader& visitor, SerializeFormat& value); void Reflect(Writer& visitor, SerializeFormat& value); //// Type constructors -template <typename T> -void Reflect(Reader& visitor, optional<T>& value) { - if (visitor.IsNull()) { - visitor.GetNull(); - return; - } - T real_value; - Reflect(visitor, real_value); - value = std::move(real_value); -} -template <typename T> -void Reflect(Writer& visitor, optional<T>& value) { - if (value) - Reflect(visitor, *value); - else - visitor.Null(); +template<typename T> +void Reflect(Reader& visitor, optional<T>& value) +{ + if (visitor.IsNull()) + { + visitor.GetNull(); + return; + } + T real_value; + Reflect(visitor, real_value); + value = std::move(real_value); } - - -template <typename T> -void ReflectMember(Writer& visitor, const char* name, optional<T>& value) { - // For TypeScript optional property key?: value in the spec, - // We omit both key and value if value is std::nullopt (null) for JsonWriter - // to reduce output. But keep it for other serialization formats. - if (value || visitor.Format() != SerializeFormat::Json) { - visitor.Key(name); - Reflect(visitor, value); - } +template<typename T> +void Reflect(Writer& visitor, optional<T>& value) +{ + if (value) + { + Reflect(visitor, *value); + } + else + { + visitor.Null(); + } } - -template <typename T> -void ReflectMember(Writer& visitor, - const char* name, - T& value, - optionals_mandatory_tag) { +template<typename T> +void ReflectMember(Writer& visitor, char const* name, optional<T>& value) +{ + // For TypeScript optional property key?: value in the spec, + // We omit both key and value if value is std::nullopt (null) for JsonWriter + // to reduce output. But keep it for other serialization formats. + if (value || visitor.Format() != SerializeFormat::Json) + { visitor.Key(name); Reflect(visitor, value); + } } -template <typename T> -void ReflectMember(Reader& visitor, - const char* name, - T& value, - optionals_mandatory_tag) { - Reflect(visitor, value); + +template<typename T> +void ReflectMember(Writer& visitor, char const* name, T& value, optionals_mandatory_tag) +{ + visitor.Key(name); + Reflect(visitor, value); +} +template<typename T> +void ReflectMember(Reader& visitor, char const* name, T& value, optionals_mandatory_tag) +{ + Reflect(visitor, value); } -template<class T > +template<class T> void Reflect(Reader& visitor, std::map<std::string, T>& value) { - visitor.IterMap([&](const char* name,Reader& entry) { - T entry_value; - Reflect(entry, entry_value); - value[name]=(std::move(entry_value)); - }); + visitor.IterMap( + [&](char const* name, Reader& entry) + { + T entry_value; + Reflect(entry, entry_value); + value[name] = (std::move(entry_value)); + } + ); } -template<class _Ty > +template<class _Ty> void Reflect(Writer& visitor, std::map<std::string, _Ty>& value) { - REFLECT_MEMBER_START(); - for (auto& it : value) - { - visitor.Key(it.first.c_str()); - Reflect(visitor, it.second); - } - REFLECT_MEMBER_END(); + REFLECT_MEMBER_START(); + for (auto& it : value) + { + visitor.Key(it.first.c_str()); + Reflect(visitor, it.second); + } + REFLECT_MEMBER_END(); } // std::vector -template <typename T> -void Reflect(Reader& visitor, std::vector<T>& values) { - visitor.IterArray([&](Reader& entry) { - T entry_value; - Reflect(entry, entry_value); - values.push_back(std::move(entry_value)); - }); +template<typename T> +void Reflect(Reader& visitor, std::vector<T>& values) +{ + visitor.IterArray( + [&](Reader& entry) + { + T entry_value; + Reflect(entry, entry_value); + values.push_back(std::move(entry_value)); + } + ); } - -template <typename T> -void Reflect(Writer& visitor, std::vector<T>& values) { - visitor.StartArray(values.size()); - for (auto& value : values) - Reflect(visitor, value); - visitor.EndArray(); +template<typename T> +void Reflect(Writer& visitor, std::vector<T>& values) +{ + visitor.StartArray(values.size()); + for (auto& value : values) + { + Reflect(visitor, value); + } + visitor.EndArray(); } // ReflectMember -inline void DefaultReflectMemberStart(Writer& visitor) { - visitor.StartObject(); +inline void DefaultReflectMemberStart(Writer& visitor) +{ + visitor.StartObject(); +} +inline void DefaultReflectMemberStart(Reader&) +{ } -inline void DefaultReflectMemberStart(Reader& visitor) {} -template <typename T> -bool ReflectMemberStart(Reader& visitor, T& value) { - return false; +template<typename T> +bool ReflectMemberStart(Reader&, T&) +{ + return false; } -template <typename T> -bool ReflectMemberStart(Writer& visitor, T& value) { - visitor.StartObject(); - return true; +template<typename T> +bool ReflectMemberStart(Writer& visitor, T&) +{ + visitor.StartObject(); + return true; } -template <typename T> -void ReflectMemberEnd(Reader& visitor, T& value) {} -template <typename T> -void ReflectMemberEnd(Writer& visitor, T& value) { - visitor.EndObject(); +template<typename T> +void ReflectMemberEnd(Reader&, T&) +{ +} +template<typename T> +void ReflectMemberEnd(Writer& visitor, T&) +{ + visitor.EndObject(); } -template <typename T> -void ReflectMember(Reader& visitor, const char* name, T& value) { - visitor.DoMember(name, [&](Reader& child) { Reflect(child, value); }); +template<typename T> +void ReflectMember(Reader& visitor, char const* name, T& value) +{ + visitor.DoMember(name, [&](Reader& child) { Reflect(child, value); }); } -template <typename T> -void ReflectMember(Writer& visitor, const char* name, T& value) { - visitor.Key(name); - Reflect(visitor, value); +template<typename T> +void ReflectMember(Writer& visitor, char const* name, T& value) +{ + visitor.Key(name); + Reflect(visitor, value); } template<class _Ty1, class _Ty2> -void Reflect(Writer& visitor, std::pair< optional<_Ty1>, optional<_Ty2> >& value) +void Reflect(Writer& visitor, std::pair<optional<_Ty1>, optional<_Ty2>>& value) { - if (value.first) - { - Reflect(visitor, value.first); - } - else - { - Reflect(visitor, value.second); - } + if (value.first) + { + Reflect(visitor, value.first); + } + else + { + Reflect(visitor, value.second); + } } template<class _Ty2> -void Reflect(Reader& visitor, std::pair< optional<bool>, optional<_Ty2> >& value) +void Reflect(Reader& visitor, std::pair<optional<bool>, optional<_Ty2>>& value) { - if(visitor.IsBool()) - { - Reflect(visitor, value.first); - return; - } + if (visitor.IsBool()) + { + Reflect(visitor, value.first); + return; + } - Reflect(visitor, value.second); + Reflect(visitor, value.second); } template<class _Ty2> -void Reflect(Reader& visitor, std::pair< optional<std::string>, optional<_Ty2> >& value) +void Reflect(Reader& visitor, std::pair<optional<std::string>, optional<_Ty2>>& value) { - if (visitor.IsString()) - { - Reflect(visitor, value.first); - return; - } + if (visitor.IsString()) + { + Reflect(visitor, value.first); + return; + } - Reflect(visitor, value.second); + Reflect(visitor, value.second); } - template<class _Ty1, class _Ty2> -void Reflect(Reader& visitor, std::pair< optional<_Ty1>, optional<_Ty2> >& value) +void Reflect(Reader& visitor, std::pair<optional<_Ty1>, optional<_Ty2>>& value) { - try - { - Reflect(visitor, value.second); - } - catch (...) - { - Reflect(visitor, value.first); - } + try + { + Reflect(visitor, value.second); + } + catch (...) + { + Reflect(visitor, value.first); + } } diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/stream.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/stream.h index 3dd3def993..e702ea8547 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/stream.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/stream.h @@ -3,194 +3,192 @@ #include <string> namespace lsp { - class stream - { - public: - virtual ~stream() = default; - virtual bool fail() = 0; - virtual bool bad() = 0; - virtual bool eof() = 0; - virtual bool good() = 0; - virtual void clear() = 0; - virtual std::string what() = 0; - virtual bool need_to_clear_the_state() - { - return false; - } - - bool operator!() - { - return bad(); - } - }; - class istream : public stream - { - public: - virtual int get() = 0; - virtual ~istream() = default; - virtual istream& read(char* str, std::streamsize count) = 0; - }; - template <class T > - class base_istream : public istream - { - public: - explicit base_istream(T& _t) :_impl(_t) - { - - } - - int get() override - { - return _impl.get(); - } - bool fail() override - { - return _impl.fail(); - } - bool bad() override - { - return _impl.bad(); - } - bool eof() override - { - return _impl.eof(); - } - bool good() override - { - return _impl.good(); - } - istream& read(char* str, std::streamsize count) override - { - _impl.read(str, count); - return *this; - } - - void clear() override - { - _impl.clear(); - } - T& _impl; - }; - class ostream : public stream - { - public: - virtual ~ostream() = default; - - virtual ostream& write(const std::string&) = 0; - virtual ostream& write(std::streamsize) = 0; - virtual ostream& flush() = 0; - - }; - template <class T > - class base_ostream : public ostream - { - public: - explicit base_ostream(T& _t) :_impl(_t) - { - - } - - bool fail() override - { - return _impl.fail(); - } - bool good() override - { - return _impl.good(); - } - bool bad() override - { - return _impl.bad(); - } - bool eof() override - { - return _impl.eof(); - } - - ostream& write(const std::string& c) override - { - _impl << c; - return *this; - } - - ostream& write(std::streamsize _s) override - { - - _impl << std::to_string(_s); - return *this; - } - - ostream& flush() override - { - _impl.flush(); - return *this; - } - - void clear() override - { - _impl.clear(); - } - protected: - T& _impl; - }; - - template <class T > - class base_iostream : public istream, public ostream - { - public: - explicit base_iostream(T& _t) :_impl(_t) - { - - } - - int get() override - { - return _impl.get(); - } - bool fail() override - { - return _impl.fail(); - } - bool bad() override - { - return _impl.bad(); - } - bool eof() override - { - return _impl.eof(); - } - bool good() override - { - return _impl.good(); - } - istream& read(char* str, std::streamsize count) override - { - _impl.read(str, count); - return *this; - } - ostream& write(const std::string& c) override - { - _impl << c; - return *this; - } - - ostream& write(std::streamsize _s) override - { - _impl << std::to_string(_s); - return *this; - } - - ostream& flush() override - { - _impl.flush(); - return *this; - } - - void clear() override - { - _impl.clear(); - } - protected: - T& _impl; - }; -} +class stream +{ +public: + virtual ~stream() = default; + virtual bool fail() = 0; + virtual bool bad() = 0; + virtual bool eof() = 0; + virtual bool good() = 0; + virtual void clear() = 0; + virtual std::string what() = 0; + virtual bool need_to_clear_the_state() + { + return false; + } + + bool operator!() + { + return bad(); + } +}; +class istream : public stream +{ +public: + virtual int get() = 0; + virtual ~istream() = default; + virtual istream& read(char* str, std::streamsize count) = 0; +}; +template<class T> +class base_istream : public istream +{ +public: + explicit base_istream(T& _t) : _impl(_t) + { + } + + int get() override + { + return _impl.get(); + } + bool fail() override + { + return _impl.fail(); + } + bool bad() override + { + return _impl.bad(); + } + bool eof() override + { + return _impl.eof(); + } + bool good() override + { + return _impl.good(); + } + istream& read(char* str, std::streamsize count) override + { + _impl.read(str, count); + return *this; + } + + void clear() override + { + _impl.clear(); + } + T& _impl; +}; +class ostream : public stream +{ +public: + virtual ~ostream() = default; + + virtual ostream& write(std::string const&) = 0; + virtual ostream& write(std::streamsize) = 0; + virtual ostream& flush() = 0; +}; +template<class T> +class base_ostream : public ostream +{ +public: + explicit base_ostream(T& _t) : _impl(_t) + { + } + + bool fail() override + { + return _impl.fail(); + } + bool good() override + { + return _impl.good(); + } + bool bad() override + { + return _impl.bad(); + } + bool eof() override + { + return _impl.eof(); + } + + ostream& write(std::string const& c) override + { + _impl << c; + return *this; + } + + ostream& write(std::streamsize _s) override + { + + _impl << std::to_string(_s); + return *this; + } + + ostream& flush() override + { + _impl.flush(); + return *this; + } + + void clear() override + { + _impl.clear(); + } + +protected: + T& _impl; +}; + +template<class T> +class base_iostream : public istream, public ostream +{ +public: + explicit base_iostream(T& _t) : _impl(_t) + { + } + + int get() override + { + return _impl.get(); + } + bool fail() override + { + return _impl.fail(); + } + bool bad() override + { + return _impl.bad(); + } + bool eof() override + { + return _impl.eof(); + } + bool good() override + { + return _impl.good(); + } + istream& read(char* str, std::streamsize count) override + { + _impl.read(str, count); + return *this; + } + ostream& write(std::string const& c) override + { + _impl << c; + return *this; + } + + ostream& write(std::streamsize _s) override + { + _impl << std::to_string(_s); + return *this; + } + + ostream& flush() override + { + _impl.flush(); + return *this; + } + + void clear() override + { + _impl.clear(); + } + +protected: + T& _impl; +}; +} // namespace lsp diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/threaded_queue.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/threaded_queue.h index e8fc6d13ea..9680058370 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/threaded_queue.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/threaded_queue.h @@ -15,236 +15,307 @@ struct MultiQueueWaiter; -struct BaseThreadQueue { - virtual ~BaseThreadQueue() = default; +struct BaseThreadQueue +{ + virtual ~BaseThreadQueue() = default; - virtual bool IsEmpty() = 0; + virtual bool IsEmpty() = 0; - std::shared_ptr<MultiQueueWaiter> waiter; + std::shared_ptr<MultiQueueWaiter> waiter; }; // std::lock accepts two or more arguments. We define an overload for one // argument. -namespace std { -template <typename Lockable> -void lock(Lockable& l) { - l.lock(); +namespace std +{ +template<typename Lockable> +void lock(Lockable& l) +{ + l.lock(); } -} // namespace std - -template <typename... Queue> -struct MultiQueueLock { - MultiQueueLock(Queue... lockable) : tuple_{lockable...} { lock(); } - ~MultiQueueLock() { unlock(); } - void lock() { lock_impl(typename std::index_sequence_for<Queue...>{}); } - void unlock() { unlock_impl(typename std::index_sequence_for<Queue...>{}); } - - private: - template <size_t... Is> - void lock_impl(std::index_sequence<Is...>) { - std::lock(std::get<Is>(tuple_)->mutex...); - } - - template <size_t... Is> - void unlock_impl(std::index_sequence<Is...>) { - (void)std::initializer_list<int>{ - (std::get<Is>(tuple_)->mutex.unlock(), 0)...}; - } - - std::tuple<Queue...> tuple_; +} // namespace std + +template<typename... Queue> +struct MultiQueueLock +{ + MultiQueueLock(Queue... lockable) : tuple_ {lockable...} + { + lock(); + } + ~MultiQueueLock() + { + unlock(); + } + void lock() + { + lock_impl(typename std::index_sequence_for<Queue...> {}); + } + void unlock() + { + unlock_impl(typename std::index_sequence_for<Queue...> {}); + } + +private: + template<size_t... Is> + void lock_impl(std::index_sequence<Is...>) + { + std::lock(std::get<Is>(tuple_)->mutex...); + } + + template<size_t... Is> + void unlock_impl(std::index_sequence<Is...>) + { + (void)std::initializer_list<int> {(std::get<Is>(tuple_)->mutex.unlock(), 0)...}; + } + + std::tuple<Queue...> tuple_; }; -struct MultiQueueWaiter { - static bool HasState(std::initializer_list<BaseThreadQueue*> queues); - - bool ValidateWaiter(std::initializer_list<BaseThreadQueue*> queues); - - template <typename... BaseThreadQueue> - bool Wait(std::atomic<bool>& quit, BaseThreadQueue... queues) { - MultiQueueLock<BaseThreadQueue...> l(queues...); - while (!quit.load(std::memory_order_relaxed)) { - if (HasState({ queues... })) - return false; - cv.wait(l); - } - return true; - } - template <typename... BaseThreadQueue> - void WaitUntil(std::chrono::steady_clock::time_point t, - BaseThreadQueue... queues) { - MultiQueueLock<BaseThreadQueue...> l(queues...); - if (!HasState({ queues... })) - cv.wait_until(l, t); - } - template <typename... BaseThreadQueue> - void Wait(BaseThreadQueue... queues) { - assert(ValidateWaiter({queues...})); - - MultiQueueLock<BaseThreadQueue...> l(queues...); - while (!HasState({queues...})) - cv.wait(l); - } - - std::condition_variable_any cv; +struct MultiQueueWaiter +{ + static bool HasState(std::initializer_list<BaseThreadQueue*> queues); + + bool ValidateWaiter(std::initializer_list<BaseThreadQueue*> queues); + + template<typename... BaseThreadQueue> + bool Wait(std::atomic<bool>& quit, BaseThreadQueue... queues) + { + MultiQueueLock<BaseThreadQueue...> l(queues...); + while (!quit.load(std::memory_order_relaxed)) + { + if (HasState({queues...})) + { + return false; + } + cv.wait(l); + } + return true; + } + template<typename... BaseThreadQueue> + void WaitUntil(std::chrono::steady_clock::time_point t, BaseThreadQueue... queues) + { + MultiQueueLock<BaseThreadQueue...> l(queues...); + if (!HasState({queues...})) + { + cv.wait_until(l, t); + } + } + template<typename... BaseThreadQueue> + void Wait(BaseThreadQueue... queues) + { + assert(ValidateWaiter({queues...})); + + MultiQueueLock<BaseThreadQueue...> l(queues...); + while (!HasState({queues...})) + { + cv.wait(l); + } + } + + std::condition_variable_any cv; }; // A threadsafe-queue. http://stackoverflow.com/a/16075550 -template <class T> -struct ThreadedQueue : public BaseThreadQueue { - public: - ThreadedQueue() : ThreadedQueue(std::make_shared<MultiQueueWaiter>()) {} +template<class T> +struct ThreadedQueue : public BaseThreadQueue +{ +public: + ThreadedQueue() : ThreadedQueue(std::make_shared<MultiQueueWaiter>()) + { + } - explicit ThreadedQueue(std::shared_ptr<MultiQueueWaiter> waiter) - : total_count_(0) { - this->waiter = waiter; - } + explicit ThreadedQueue(std::shared_ptr<MultiQueueWaiter> waiter) : total_count_(0) + { + this->waiter = waiter; + } - // Returns the number of elements in the queue. This is lock-free. - size_t Size() const { return total_count_; } + // Returns the number of elements in the queue. This is lock-free. + size_t Size() const + { + return total_count_; + } - // Add an element to the queue. - void Enqueue(T&& t, bool priority) { + // Add an element to the queue. + void Enqueue(T&& t, bool priority) { - std::lock_guard<std::mutex> lock(mutex); - if (priority) - priority_.push_back(std::move(t)); - else - queue_.push_back(std::move(t)); - ++total_count_; + { + std::lock_guard<std::mutex> lock(mutex); + if (priority) + { + priority_.push_back(std::move(t)); + } + else + { + queue_.push_back(std::move(t)); + } + ++total_count_; + } + waiter->cv.notify_one(); } - waiter->cv.notify_one(); - } - // Add a set of elements to the queue. - void EnqueueAll(std::vector<T>&& elements, bool priority) { - if (elements.empty()) - return; + // Add a set of elements to the queue. + void EnqueueAll(std::vector<T>&& elements, bool priority) + { + if (elements.empty()) + { + return; + } + + { + std::lock_guard<std::mutex> lock(mutex); + total_count_ += elements.size(); + for (T& element : elements) + { + if (priority) + { + priority_.push_back(std::move(element)); + } + else + { + queue_.push_back(std::move(element)); + } + } + elements.clear(); + } + + waiter->cv.notify_all(); + } + + // Returns true if the queue is empty. This is lock-free. + bool IsEmpty() + { + return total_count_ == 0; + } + // Get the first element from the queue. Blocks until one is available. + T Dequeue() { - std::lock_guard<std::mutex> lock(mutex); - total_count_ += elements.size(); - for (T& element : elements) { + std::unique_lock<std::mutex> lock(mutex); + waiter->cv.wait(lock, [&]() { return !priority_.empty() || !queue_.empty(); }); + + auto execute = [&](std::deque<T>* q) + { + auto val = std::move(q->front()); + q->pop_front(); + --total_count_; + return std::move(val); + }; + if (!priority_.empty()) + { + return execute(&priority_); + } + return execute(&queue_); + } + + // Get the first element from the queue without blocking. Returns a null + // value if the queue is empty. + optional<T> TryDequeue(bool priority) + { + std::lock_guard<std::mutex> lock(mutex); + + auto pop = [&](std::deque<T>* q) + { + auto val = std::move(q->front()); + q->pop_front(); + --total_count_; + return std::move(val); + }; + + auto get_result = [&](std::deque<T>* first, std::deque<T>* second) -> optional<T> + { + if (!first->empty()) + { + return pop(first); + } + if (!second->empty()) + { + return pop(second); + } + return {}; + }; + if (priority) - priority_.push_back(std::move(element)); - else - queue_.push_back(std::move(element)); - } - elements.clear(); - } - - waiter->cv.notify_all(); - } - - // Returns true if the queue is empty. This is lock-free. - bool IsEmpty() { return total_count_ == 0; } - - // Get the first element from the queue. Blocks until one is available. - T Dequeue() { - std::unique_lock<std::mutex> lock(mutex); - waiter->cv.wait(lock, - [&]() { return !priority_.empty() || !queue_.empty(); }); - - auto execute = [&](std::deque<T>* q) { - auto val = std::move(q->front()); - q->pop_front(); - --total_count_; - return std::move(val); - }; - if (!priority_.empty()) - return execute(&priority_); - return execute(&queue_); - } - - // Get the first element from the queue without blocking. Returns a null - // value if the queue is empty. - optional<T> TryDequeue(bool priority) { - std::lock_guard<std::mutex> lock(mutex); - - auto pop = [&](std::deque<T>* q) { - auto val = std::move(q->front()); - q->pop_front(); - --total_count_; - return std::move(val); - }; - - auto get_result = [&](std::deque<T>* first, - std::deque<T>* second) -> optional<T> { - if (!first->empty()) - return pop(first); - if (!second->empty()) - return pop(second); - return {}; - }; - - if (priority) - return get_result(&priority_, &queue_); - return get_result(&queue_, &priority_); - } - // Return all elements in the queue. - std::vector<T> DequeueAll() { - std::lock_guard<std::mutex> lock(mutex); - - total_count_ = 0; - - std::vector<T> result; - result.reserve(priority_.size() + queue_.size()); - while (!priority_.empty()) { - result.emplace_back(std::move(priority_.front())); - priority_.pop_front(); - } - while (!queue_.empty()) { - result.emplace_back(std::move(queue_.front())); - queue_.pop_front(); - } - - return result; - } - std::vector<T> TryDequeueSome(size_t num) { - std::lock_guard<std::mutex> lock(mutex); - - std::vector<T> result; - num = std::min(num, priority_.size() + queue_.size()); - total_count_ -= num; - result.reserve(num); - while (num) - { - if(!priority_.empty()) { - result.emplace_back(std::move(priority_.front())); - priority_.pop_front(); - } - else - { - break; - } - num -= 1; - } - while (num) - { - if (!queue_.empty()) { - result.emplace_back(std::move(queue_.front())); - queue_.pop_front(); - } - else - { - break; - } - num -= 1; - } - return result; - } - template <typename Fn> - void Iterate(Fn fn) { - std::lock_guard<std::mutex> lock(mutex); - for (auto& entry : priority_) - fn(entry); - for (auto& entry : queue_) - fn(entry); - } - - mutable std::mutex mutex; - - private: - std::atomic<int> total_count_; - std::deque<T> priority_; - std::deque<T> queue_; + { + return get_result(&priority_, &queue_); + } + return get_result(&queue_, &priority_); + } + // Return all elements in the queue. + std::vector<T> DequeueAll() + { + std::lock_guard<std::mutex> lock(mutex); + + total_count_ = 0; + + std::vector<T> result; + result.reserve(priority_.size() + queue_.size()); + while (!priority_.empty()) + { + result.emplace_back(std::move(priority_.front())); + priority_.pop_front(); + } + while (!queue_.empty()) + { + result.emplace_back(std::move(queue_.front())); + queue_.pop_front(); + } + + return result; + } + std::vector<T> TryDequeueSome(size_t num) + { + std::lock_guard<std::mutex> lock(mutex); + + std::vector<T> result; + num = std::min(num, priority_.size() + queue_.size()); + total_count_ -= num; + result.reserve(num); + while (num) + { + if (!priority_.empty()) + { + result.emplace_back(std::move(priority_.front())); + priority_.pop_front(); + } + else + { + break; + } + num -= 1; + } + while (num) + { + if (!queue_.empty()) + { + result.emplace_back(std::move(queue_.front())); + queue_.pop_front(); + } + else + { + break; + } + num -= 1; + } + return result; + } + template<typename Fn> + void Iterate(Fn fn) + { + std::lock_guard<std::mutex> lock(mutex); + for (auto& entry : priority_) + { + fn(entry); + } + for (auto& entry : queue_) + { + fn(entry); + } + } + + mutable std::mutex mutex; + +private: + std::atomic<int> total_count_; + std::deque<T> priority_; + std::deque<T> queue_; }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/traits.h b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/traits.h index ce8905a840..32249af8c9 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/traits.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/JsonRpc/traits.h @@ -14,145 +14,145 @@ #pragma once - #include <tuple> #include <type_traits> -namespace lsp { -namespace traits { - -// NthTypeOf returns the `N`th type in `Types` -template <int N, typename... Types> -using NthTypeOf = typename std::tuple_element<N, std::tuple<Types...>>::type; - -// `IsTypeOrDerived<BASE, T>::value` is true iff `T` is of type `BASE`, or -// derives from `BASE`. -template <typename BASE, typename T> -using IsTypeOrDerived = std::integral_constant< - bool, - std::is_base_of<BASE, typename std::decay<T>::type>::value || - std::is_same<BASE, typename std::decay<T>::type>::value>; - -// `EachIsTypeOrDerived<N, BASES, TYPES>::value` is true iff all of the types in -// the std::tuple `TYPES` is of, or derives from the corresponding indexed type -// in the std::tuple `BASES`. -// `N` must be equal to the number of types in both the std::tuple `BASES` and -// `TYPES`. -template <int N, typename BASES, typename TYPES> -struct EachIsTypeOrDerived { - using base = typename std::tuple_element<N - 1, BASES>::type; - using type = typename std::tuple_element<N - 1, TYPES>::type; - using last_matches = IsTypeOrDerived<base, type>; - using others_match = EachIsTypeOrDerived<N - 1, BASES, TYPES>; - static constexpr bool value = last_matches::value && others_match::value; -}; - -// EachIsTypeOrDerived specialization for N = 1 -template <typename BASES, typename TYPES> -struct EachIsTypeOrDerived<1, BASES, TYPES> { - using base = typename std::tuple_element<0, BASES>::type; - using type = typename std::tuple_element<0, TYPES>::type; - static constexpr bool value = IsTypeOrDerived<base, type>::value; -}; - -// EachIsTypeOrDerived specialization for N = 0 -template <typename BASES, typename TYPES> -struct EachIsTypeOrDerived<0, BASES, TYPES> { - static constexpr bool value = true; -}; - -// Signature describes the signature of a function. -template <typename RETURN, typename... PARAMETERS> -struct Signature { - // The return type of the function signature - using ret = RETURN; - // The parameters of the function signature held in a std::tuple - using parameters = std::tuple<PARAMETERS...>; - // The type of the Nth parameter of function signature - template <std::size_t N> - using parameter = NthTypeOf<N, PARAMETERS...>; - // The total number of parameters - static constexpr std::size_t parameter_count = sizeof...(PARAMETERS); -}; - -// SignatureOf is a traits helper that infers the signature of the function, -// method, static method, lambda, or function-like object `F`. -template <typename F> -struct SignatureOf { - // The signature of the function-like object `F` - using type = typename SignatureOf<decltype(&F::operator())>::type; -}; - -// SignatureOf specialization for a regular function or static method. -template <typename R, typename... ARGS> -struct SignatureOf<R (*)(ARGS...)> { - // The signature of the function-like object `F` - using type = Signature<typename std::decay<R>::type, - typename std::decay<ARGS>::type...>; -}; - -// SignatureOf specialization for a non-static method. -template <typename R, typename C, typename... ARGS> -struct SignatureOf<R (C::*)(ARGS...)> { - // The signature of the function-like object `F` - using type = Signature<typename std::decay<R>::type, - typename std::decay<ARGS>::type...>; -}; - -// SignatureOf specialization for a non-static, const method. -template <typename R, typename C, typename... ARGS> -struct SignatureOf<R (C::*)(ARGS...) const> { - // The signature of the function-like object `F` - using type = Signature<typename std::decay<R>::type, - typename std::decay<ARGS>::type...>; -}; - -// SignatureOfT is an alias to `typename SignatureOf<F>::type`. -template <typename F> -using SignatureOfT = typename SignatureOf<F>::type; - -// ParameterType is an alias to `typename SignatureOf<F>::type::parameter<N>`. -template <typename F, std::size_t N> -using ParameterType = typename SignatureOfT<F>::template parameter<N>; - -// `HasSignature<F, S>::value` is true iff the function-like `F` has a matching -// signature to the function-like `S`. -template <typename F, typename S> -using HasSignature = std::integral_constant< - bool, - std::is_same<SignatureOfT<F>, SignatureOfT<S>>::value>; - -// `Min<A, B>::value` resolves to the smaller value of A and B. -template <std::size_t A, std::size_t B> -using Min = std::integral_constant<std::size_t, (A < B ? A : B)>; - -// `CompatibleWith<F, S>::value` is true iff the function-like `F` -// can be called with the argument types of the function-like `S`. Return type -// of the two functions are not considered. -template <typename F, typename S> -using CompatibleWith = std::integral_constant< - bool, - (SignatureOfT<S>::parameter_count == SignatureOfT<F>::parameter_count) && - EachIsTypeOrDerived<Min<SignatureOfT<S>::parameter_count, - SignatureOfT<F>::parameter_count>::value, - typename SignatureOfT<S>::parameters, - typename SignatureOfT<F>::parameters>::value>; - -// If `CONDITION` is true then EnableIf resolves to type T, otherwise an -// invalid type. -template <bool CONDITION, typename T = void> -using EnableIf = typename std::enable_if<CONDITION, T>::type; - -// If `BASE` is a base of `T` then EnableIfIsType resolves to type `TRUE`, -// otherwise an invalid type. -template <typename BASE, typename T, typename TRUE_ = void> -using EnableIfIsType = EnableIf<IsTypeOrDerived<BASE, T>::value, TRUE_>; - -// If the function-like `F` has a matching signature to the function-like `S` -// then EnableIfHasSignature resolves to type `TRUE`, otherwise an invalid type. -template <typename F, typename S, typename TRUE_ = void> -using EnableIfHasSignature = EnableIf<HasSignature<F, S>::value, TRUE_>; - -} // namespace traits -} // namespace lsp - +namespace lsp +{ +namespace traits +{ + + // NthTypeOf returns the `N`th type in `Types` + template<int N, typename... Types> + using NthTypeOf = typename std::tuple_element<N, std::tuple<Types...>>::type; + + // `IsTypeOrDerived<BASE, T>::value` is true iff `T` is of type `BASE`, or + // derives from `BASE`. + template<typename BASE, typename T> + using IsTypeOrDerived = std::integral_constant< + bool, std::is_base_of<BASE, typename std::decay<T>::type>::value + || std::is_same<BASE, typename std::decay<T>::type>::value>; + + // `EachIsTypeOrDerived<N, BASES, TYPES>::value` is true iff all of the types in + // the std::tuple `TYPES` is of, or derives from the corresponding indexed type + // in the std::tuple `BASES`. + // `N` must be equal to the number of types in both the std::tuple `BASES` and + // `TYPES`. + template<int N, typename BASES, typename TYPES> + struct EachIsTypeOrDerived + { + using base = typename std::tuple_element<N - 1, BASES>::type; + using type = typename std::tuple_element<N - 1, TYPES>::type; + using last_matches = IsTypeOrDerived<base, type>; + using others_match = EachIsTypeOrDerived<N - 1, BASES, TYPES>; + static constexpr bool value = last_matches::value && others_match::value; + }; + + // EachIsTypeOrDerived specialization for N = 1 + template<typename BASES, typename TYPES> + struct EachIsTypeOrDerived<1, BASES, TYPES> + { + using base = typename std::tuple_element<0, BASES>::type; + using type = typename std::tuple_element<0, TYPES>::type; + static constexpr bool value = IsTypeOrDerived<base, type>::value; + }; + + // EachIsTypeOrDerived specialization for N = 0 + template<typename BASES, typename TYPES> + struct EachIsTypeOrDerived<0, BASES, TYPES> + { + static constexpr bool value = true; + }; + + // Signature describes the signature of a function. + template<typename RETURN, typename... PARAMETERS> + struct Signature + { + // The return type of the function signature + using ret = RETURN; + // The parameters of the function signature held in a std::tuple + using parameters = std::tuple<PARAMETERS...>; + // The type of the Nth parameter of function signature + template<std::size_t N> + using parameter = NthTypeOf<N, PARAMETERS...>; + // The total number of parameters + static constexpr std::size_t parameter_count = sizeof...(PARAMETERS); + }; + + // SignatureOf is a traits helper that infers the signature of the function, + // method, static method, lambda, or function-like object `F`. + template<typename F> + struct SignatureOf + { + // The signature of the function-like object `F` + using type = typename SignatureOf<decltype(&F::operator())>::type; + }; + + // SignatureOf specialization for a regular function or static method. + template<typename R, typename... ARGS> + struct SignatureOf<R (*)(ARGS...)> + { + // The signature of the function-like object `F` + using type = Signature<typename std::decay<R>::type, typename std::decay<ARGS>::type...>; + }; + + // SignatureOf specialization for a non-static method. + template<typename R, typename C, typename... ARGS> + struct SignatureOf<R (C::*)(ARGS...)> + { + // The signature of the function-like object `F` + using type = Signature<typename std::decay<R>::type, typename std::decay<ARGS>::type...>; + }; + + // SignatureOf specialization for a non-static, const method. + template<typename R, typename C, typename... ARGS> + struct SignatureOf<R (C::*)(ARGS...) const> + { + // The signature of the function-like object `F` + using type = Signature<typename std::decay<R>::type, typename std::decay<ARGS>::type...>; + }; + + // SignatureOfT is an alias to `typename SignatureOf<F>::type`. + template<typename F> + using SignatureOfT = typename SignatureOf<F>::type; + + // ParameterType is an alias to `typename SignatureOf<F>::type::parameter<N>`. + template<typename F, std::size_t N> + using ParameterType = typename SignatureOfT<F>::template parameter<N>; + + // `HasSignature<F, S>::value` is true iff the function-like `F` has a matching + // signature to the function-like `S`. + template<typename F, typename S> + using HasSignature = std::integral_constant<bool, std::is_same<SignatureOfT<F>, SignatureOfT<S>>::value>; + + // `Min<A, B>::value` resolves to the smaller value of A and B. + template<std::size_t A, std::size_t B> + using Min = std::integral_constant<std::size_t, (A < B ? A : B)>; + + // `CompatibleWith<F, S>::value` is true iff the function-like `F` + // can be called with the argument types of the function-like `S`. Return type + // of the two functions are not considered. + template<typename F, typename S> + using CompatibleWith = std::integral_constant< + bool, (SignatureOfT<S>::parameter_count == SignatureOfT<F>::parameter_count) + && EachIsTypeOrDerived< + Min<SignatureOfT<S>::parameter_count, SignatureOfT<F>::parameter_count>::value, + typename SignatureOfT<S>::parameters, typename SignatureOfT<F>::parameters>::value>; + + // If `CONDITION` is true then EnableIf resolves to type T, otherwise an + // invalid type. + template<bool CONDITION, typename T = void> + using EnableIf = typename std::enable_if<CONDITION, T>::type; + + // If `BASE` is a base of `T` then EnableIfIsType resolves to type `TRUE`, + // otherwise an invalid type. + template<typename BASE, typename T, typename TRUE_ = void> + using EnableIfIsType = EnableIf<IsTypeOrDerived<BASE, T>::value, TRUE_>; + + // If the function-like `F` has a matching signature to the function-like `S` + // then EnableIfHasSignature resolves to type `TRUE`, otherwise an invalid type. + template<typename F, typename S, typename TRUE_ = void> + using EnableIfHasSignature = EnableIf<HasSignature<F, S>::value, TRUE_>; + +} // namespace traits +} // namespace lsp diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/AbsolutePath.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/AbsolutePath.h index 4f9aae0851..e4a2842386 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/AbsolutePath.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/AbsolutePath.h @@ -3,25 +3,24 @@ #include <LibLsp/JsonRpc/serializer.h> #include <string> -struct AbsolutePath { - static AbsolutePath BuildDoNotUse(const std::string& path); - - // Try not to use this. - AbsolutePath(); - - // Provide implicit conversions to std::string for the time being. - AbsolutePath(const std::string& path, bool validate = true); - operator std::string() const; - - bool operator==(const AbsolutePath& rhs) const; - bool operator!=(const AbsolutePath& rhs) const; - bool operator<(const AbsolutePath& rhs) const; - bool operator>(const AbsolutePath& rhs) const; - std::string path; - bool qualify = true; +struct AbsolutePath +{ + static AbsolutePath BuildDoNotUse(std::string const& path); + + // Try not to use this. + AbsolutePath(); + + // Provide implicit conversions to std::string for the time being. + AbsolutePath(std::string const& path, bool validate = true); + operator std::string() const; + + bool operator==(AbsolutePath const& rhs) const; + bool operator!=(AbsolutePath const& rhs) const; + bool operator<(AbsolutePath const& rhs) const; + bool operator>(AbsolutePath const& rhs) const; + std::string path; + bool qualify = true; }; - void Reflect(Reader& visitor, AbsolutePath& value); void Reflect(Writer& visitor, AbsolutePath& value); - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ClientPreferences.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ClientPreferences.h index c8920e4492..4785c39173 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ClientPreferences.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ClientPreferences.h @@ -8,303 +8,373 @@ class ClientPreferences { public: + std::shared_ptr<lsWorkspaceClientCapabilites> workspace; + lsTextDocumentClientCapabilities textDocument; - std::shared_ptr<lsWorkspaceClientCapabilites> workspace; - lsTextDocumentClientCapabilities textDocument ; - - ClientPreferences(const lsClientCapabilities& capabilities) + ClientPreferences(lsClientCapabilities const& capabilities) + { + v3supported = capabilities.textDocument.has_value(); + if (v3supported) { - v3supported = capabilities.textDocument.has_value(); - if (v3supported) - textDocument = capabilities.textDocument.value(); - if(capabilities.workspace) - { - workspace = std::make_shared<lsWorkspaceClientCapabilites>(capabilities.workspace.value()); - } - } - - bool v3supported=false; - - bool isSignatureHelpSupported() { - - return v3supported && (textDocument.signatureHelp); + textDocument = capabilities.textDocument.value(); } - bool isWorkspaceDidChangeConfigurationSupported() const + if (capabilities.workspace) { - return workspace && isDynamicRegistrationSupported(workspace->didChangeConfiguration); + workspace = std::make_shared<lsWorkspaceClientCapabilites>(capabilities.workspace.value()); + } + } + + bool v3supported = false; + + bool isSignatureHelpSupported() + { + + return v3supported && (textDocument.signatureHelp); + } + bool isWorkspaceDidChangeConfigurationSupported() const + { + return workspace && isDynamicRegistrationSupported(workspace->didChangeConfiguration); + } + bool isWorkspaceFoldersSupported() + { + return workspace != nullptr && isTrue(workspace->workspaceFolders); + } + + bool isCompletionDynamicRegistered() + { + return v3supported && isDynamicRegistrationSupported(textDocument.completion); + } + + bool isCompletionSnippetsSupported() + { + //@formatter:off + if (!v3supported || !textDocument.completion) + { + return false; } - bool isWorkspaceFoldersSupported() { - return workspace != nullptr && isTrue(workspace->workspaceFolders); + auto const& completion = textDocument.completion.value(); + if (completion.completionItem) + { + return isTrue(completion.completionItem.value().snippetSupport); + } + return false; + } + + bool isV3Supported() + { + return v3supported; + } + + bool isFormattingDynamicRegistrationSupported() + { + return v3supported && isDynamicRegistrationSupported(textDocument.formatting); + } + + bool isRangeFormattingDynamicRegistrationSupported() + { + return v3supported && isDynamicRegistrationSupported(textDocument.rangeFormatting); + } + + bool isOnTypeFormattingDynamicRegistrationSupported() + { + return v3supported && isDynamicRegistrationSupported(textDocument.onTypeFormatting); + } + + bool isCodeLensDynamicRegistrationSupported() + { + return v3supported && isDynamicRegistrationSupported(textDocument.codeLens); + } + + bool isSignatureHelpDynamicRegistrationSupported() + { + return v3supported && isDynamicRegistrationSupported(textDocument.signatureHelp); + } + template<typename T> + static bool isDynamicRegistrationSupported(optional<T>& capability) + { + if (capability) + { + return (capability.value().dynamicRegistration.value()); } + return false; + } - bool isCompletionDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.completion); + bool isTrue(optional<bool> const& value) + { + if (value) + { + return *value; } - - bool isCompletionSnippetsSupported() { - //@formatter:off - if(!v3supported || !textDocument.completion) - { - return false; - } - const auto& completion = textDocument.completion.value(); - if(completion.completionItem) + else + { + return false; + } + } + + bool isRenameDynamicRegistrationSupported() + { + return v3supported && isDynamicRegistrationSupported(textDocument.rename); + } + + bool isExecuteCommandDynamicRegistrationSupported() + { + return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->executeCommand); + } + + bool isWorkspaceSymbolDynamicRegistered() + { + return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->symbol); + } + + bool isWorkspaceChangeWatchedFilesDynamicRegistered() + { + return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->didChangeWatchedFiles); + } + + bool isDocumentSymbolDynamicRegistered() + { + return v3supported && isDynamicRegistrationSupported(textDocument.documentSymbol); + } + + bool isCodeActionDynamicRegistered() + { + return v3supported && isDynamicRegistrationSupported(textDocument.codeAction); + } + + bool isDefinitionDynamicRegistered() + { + return v3supported && isDynamicRegistrationSupported(textDocument.definition); + } + + bool isTypeDefinitionDynamicRegistered() + { + return v3supported && isDynamicRegistrationSupported(textDocument.typeDefinition); + } + + bool isHoverDynamicRegistered() + { + return v3supported && isDynamicRegistrationSupported(textDocument.hover); + } + + bool isReferencesDynamicRegistered() + { + return v3supported && isDynamicRegistrationSupported(textDocument.references); + } + + bool isDocumentHighlightDynamicRegistered() + { + return v3supported && isDynamicRegistrationSupported(textDocument.documentHighlight); + } + + bool isDocumentLinkDynamicRegistered() + { + return v3supported && isDynamicRegistrationSupported(textDocument.documentLink); + } + + bool isFoldgingRangeDynamicRegistered() + { + return v3supported && isDynamicRegistrationSupported(textDocument.foldingRange); + } + + bool isInlayHintDynamicRegistered() + { + return v3supported && isDynamicRegistrationSupported(textDocument.inlayHint); + } + + bool isImplementationDynamicRegistered() + { + return v3supported && isDynamicRegistrationSupported(textDocument.implementation); + } + + bool isSelectionRangeDynamicRegistered() + { + return v3supported && isDynamicRegistrationSupported(textDocument.selectionRange); + } + + bool isWillSaveRegistered() + { + return v3supported && isTrue(textDocument.synchronization.willSave); + } + + bool isWillSaveWaitUntilRegistered() + { + return v3supported && isTrue(textDocument.synchronization.willSaveWaitUntil); + } + + bool isWorkspaceApplyEditSupported() + { + return workspace != nullptr && isTrue(workspace->applyEdit); + } + + bool isSupportsCompletionDocumentationMarkdown() + { + + if (!v3supported || !textDocument.completion) + { + return false; + } + auto const& completion = textDocument.completion.value(); + if (completion.completionItem) + { + auto& documentationFormat = completion.completionItem.value().documentationFormat; + if (documentationFormat) + { + auto& data = documentationFormat.value(); + for (auto& it : data) { - return isTrue(completion.completionItem.value().snippetSupport); + if (it == "markdown") + { + return true; + } } - return false; - } - - bool isV3Supported() { - return v3supported; - } - - bool isFormattingDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.formatting); - } - - bool isRangeFormattingDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.rangeFormatting); - } - - bool isOnTypeFormattingDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.onTypeFormatting); + } } + return false; + } - bool isCodeLensDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.codeLens); + bool isWorkspaceEditResourceChangesSupported() + { + if (!workspace) + { + return false; } - bool isSignatureHelpDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.signatureHelp); - } - template<typename T> - static bool isDynamicRegistrationSupported(optional<T>& capability) + if (workspace->workspaceEdit) { - if(capability) - return (capability.value().dynamicRegistration.value()); - return false; + return isTrue(workspace->workspaceEdit.value().resourceChanges); } - - bool isTrue(const optional<bool>& value) + return false; + } + static bool contains(std::vector<std::string> const& v, std::string const& target) + { + for (auto& it : v) { - if (value) { - return *value; - } else { - return false; + if (it == target) + { + return true; } } - - bool isRenameDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.rename); - } - - bool isExecuteCommandDynamicRegistrationSupported() { - return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->executeCommand); - } - - bool isWorkspaceSymbolDynamicRegistered() { - return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->symbol); - } - - bool isWorkspaceChangeWatchedFilesDynamicRegistered() { - return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->didChangeWatchedFiles); - } - - bool isDocumentSymbolDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.documentSymbol); - } - - bool isCodeActionDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.codeAction); - } - - bool isDefinitionDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.definition); - } - - bool isTypeDefinitionDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.typeDefinition); - } - - bool isHoverDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.hover); - } - - bool isReferencesDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.references); - } - - bool isDocumentHighlightDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.documentHighlight); - } - - bool isFoldgingRangeDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.foldingRange); - } - - bool isImplementationDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.implementation); - } - - bool isSelectionRangeDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.selectionRange); - } - - bool isWillSaveRegistered() { - return v3supported && isTrue(textDocument.synchronization.willSave); - } - - bool isWillSaveWaitUntilRegistered() { - return v3supported && isTrue(textDocument.synchronization.willSaveWaitUntil); - } - - bool isWorkspaceApplyEditSupported() { - return workspace != nullptr && isTrue(workspace->applyEdit); - } - - bool isSupportsCompletionDocumentationMarkdown() { - - if (!v3supported || !textDocument.completion) - { - return false; - } - const auto& completion = textDocument.completion.value(); - if (completion.completionItem) - { - auto& documentationFormat = completion.completionItem.value().documentationFormat; - if(documentationFormat) - { - auto& data = documentationFormat.value(); - for(auto& it : data) - { - if(it == "markdown") - { - return true; - } - } - } - } - return false; - - } - - - bool isWorkspaceEditResourceChangesSupported() { - if(!workspace) return false; - - if(workspace->workspaceEdit) - { - return isTrue(workspace->workspaceEdit.value().resourceChanges); - } - return false; + return false; + } + bool isResourceOperationSupported() const + { + if (!workspace) + { + return false; } - static bool contains(const std::vector<std::string>& v, const std::string& target) + if (!workspace->workspaceEdit) { - for(auto& it : v) - { - if(it == target) return true; - } - return false; + return false; } - bool isResourceOperationSupported() const + auto& it = (workspace->workspaceEdit.value()); + if (!it.resourceOperations) { - if (!workspace) return false; - if (!workspace->workspaceEdit) - { - return false; - } - auto& it = (workspace->workspaceEdit.value()); - if(!it.resourceOperations) return false; - const auto& resourceOperations = it.resourceOperations.value(); - return contains(resourceOperations, "create") && contains(resourceOperations, "rename") && contains(resourceOperations, "delete"); - + return false; } + auto const& resourceOperations = it.resourceOperations.value(); + return contains(resourceOperations, "create") && contains(resourceOperations, "rename") + && contains(resourceOperations, "delete"); + } - /** + /** * {@code true} if the client has explicitly set the * {@code textDocument.documentSymbol.hierarchicalDocumentSymbolSupport} to * {@code true} when initializing the LS. Otherwise, {@code false}. */ - bool isHierarchicalDocumentSymbolSupported() { - if(!v3supported || !textDocument.documentSymbol) return false; - return isTrue(textDocument.documentSymbol.value().hierarchicalDocumentSymbolSupport); - + bool isHierarchicalDocumentSymbolSupported() + { + if (!v3supported || !textDocument.documentSymbol) + { + return false; } + return isTrue(textDocument.documentSymbol.value().hierarchicalDocumentSymbolSupport); + } - bool isSemanticHighlightingSupported() { - //@formatter:off - if (!v3supported || !textDocument.semanticHighlightingCapabilities) return false; - return isTrue(textDocument.semanticHighlightingCapabilities.value().semanticHighlighting); - //@formatter:on + bool isSemanticHighlightingSupported() + { + //@formatter:off + if (!v3supported || !textDocument.semanticHighlightingCapabilities) + { + return false; } + return isTrue(textDocument.semanticHighlightingCapabilities.value().semanticHighlighting); + //@formatter:on + } - /** + /** * {@code true} if the client has explicitly set the * {@code textDocument.codeAction.codeActionLiteralSupport.codeActionKind.valueSet} * value. Otherwise, {@code false}. */ - bool isSupportedCodeActionKind(const std::string& kind) { - if (!v3supported || !textDocument.codeAction) return false; - //@formatter:off - const auto& codeAction = textDocument.codeAction.value(); - if(codeAction.codeActionLiteralSupport) + bool isSupportedCodeActionKind(std::string const& kind) + { + if (!v3supported || !textDocument.codeAction) + { + return false; + } + //@formatter:off + auto const& codeAction = textDocument.codeAction.value(); + if (codeAction.codeActionLiteralSupport) + { + auto const& codeActionKind = codeAction.codeActionLiteralSupport.value().codeActionKind; + if (codeActionKind) + { + auto const& valueSet = codeActionKind.value().valueSet; + if (valueSet) { - const auto& codeActionKind = codeAction.codeActionLiteralSupport.value().codeActionKind; - if(codeActionKind) + for (auto& k : valueSet.value()) + { + if (lsp::StartsWith(kind, k)) { - const auto& valueSet = codeActionKind.value().valueSet; - if(valueSet) - { - for(auto& k : valueSet.value()) - { - if(lsp::StartsWith(kind,k)) - { - return true; - } - } - } + return true; } + } } - return false; - - //@formatter:on + } } + return false; + + //@formatter:on + } - /** + /** * {@code true} if the client has explicitly set the * {@code textDocument.publishDiagnostics.tagSupport} to * {@code true} when initializing the LS. Otherwise, {@code false}. */ - bool isDiagnosticTagSupported() { - if (!v3supported || !textDocument.publishDiagnostics) return false; - const auto& publishDiagnostics = textDocument.publishDiagnostics.value(); - if(publishDiagnostics.tagSupport) - { - isTagSupported(publishDiagnostics.tagSupport); - } - return false; + bool isDiagnosticTagSupported() + { + if (!v3supported || !textDocument.publishDiagnostics) + { + return false; } - - bool isTagSupported(const optional < std::pair<optional<bool>, - optional<DiagnosticsTagSupport> > >& tagSupport) { - if(tagSupport) - { - auto &v = tagSupport.value(); - if (v.first) - { - return v.first.value(); - } - if (v.second) { - return !v.second.value().valueSet.empty(); - } - } - return false; + auto const& publishDiagnostics = textDocument.publishDiagnostics.value(); + if (publishDiagnostics.tagSupport) + { + isTagSupported(publishDiagnostics.tagSupport); } + return false; + } - bool isCallHierarchyDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.callHierarchy); + bool isTagSupported(optional<std::pair<optional<bool>, optional<DiagnosticsTagSupport>>> const& tagSupport) + { + if (tagSupport) + { + auto& v = tagSupport.value(); + if (v.first) + { + return v.first.value(); + } + if (v.second) + { + return !v.second.value().valueSet.empty(); + } } + return false; + } + bool isCallHierarchyDynamicRegistered() + { + return v3supported && isDynamicRegistrationSupported(textDocument.callHierarchy); + } }; - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/CodeActionParams.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/CodeActionParams.h index 6c30ce82da..931747e4d3 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/CodeActionParams.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/CodeActionParams.h @@ -5,22 +5,22 @@ #include "LibLsp/lsp/workspace/execute_command.h" #include "LibLsp/lsp/lsTextDocumentIdentifier.h" #include "LibLsp/lsp/lsCodeAction.h" -namespace JDT +namespace JDT +{ +namespace CodeActionKind { - namespace CodeActionKind { - - /** + /** * Base kind for quickfix actions: 'quickfix' */ - extern const char* QuickFix; + extern char const* QuickFix; - /** + /** * Base kind for refactoring actions: 'refactor' */ - extern const char* Refactor; + extern char const* Refactor; - /** + /** * Base kind for refactoring extraction actions: 'refactor.extract' * * Example extract actions: @@ -28,18 +28,18 @@ namespace JDT * - Extract method - Extract function - Extract variable - Extract interface * from class - ... */ - extern const char* RefactorExtract; + extern char const* RefactorExtract; - /** + /** * Base kind for refactoring inline actions: 'refactor.inline' * * Example inline actions: * * - Inline function - Inline variable - Inline constant - ... */ - extern const char* RefactorInline; + extern char const* RefactorInline; - /** + /** * Base kind for refactoring rewrite actions: 'refactor.rewrite' * * Example rewrite actions: @@ -47,29 +47,29 @@ namespace JDT * - Convert JavaScript function to class - Add or remove parameter - * Encapsulate field - Make method static - Move method to base class - ... */ - extern const char* RefactorRewrite; + extern char const* RefactorRewrite; - /** + /** * Base kind for source actions: `source` * * Source code actions apply to the entire file. */ - extern const char* Source ; + extern char const* Source; - /** + /** * Base kind for an organize imports source action: `source.organizeImports` */ - extern const char* SourceOrganizeImports; + extern char const* SourceOrganizeImports; - extern const char* COMMAND_ID_APPLY_EDIT; - }; + extern char const* COMMAND_ID_APPLY_EDIT; +}; // namespace CodeActionKind - -} -struct lsCodeActionContext { - // An array of diagnostics. - std::vector<lsDiagnostic> diagnostics; - /** +} // namespace JDT +struct lsCodeActionContext +{ + // An array of diagnostics. + std::vector<lsDiagnostic> diagnostics; + /** * Requested kind of actions to return. * * Actions not of this kind are filtered out by the client before being shown. So servers @@ -77,38 +77,22 @@ struct lsCodeActionContext { * * See {@link CodeActionKind} for allowed values. */ - optional<std::vector<std::string>> only; + optional<std::vector<std::string>> only; - MAKE_SWAP_METHOD(lsCodeActionContext, - diagnostics, only); + MAKE_SWAP_METHOD(lsCodeActionContext, diagnostics, only); }; -MAKE_REFLECT_STRUCT(lsCodeActionContext, - diagnostics, only); - +MAKE_REFLECT_STRUCT(lsCodeActionContext, diagnostics, only); // Params for the CodeActionRequest -struct lsCodeActionParams { - // The document in which the command was invoked. - lsTextDocumentIdentifier textDocument; - // The range for which the command was invoked. - lsRange range; - // Context carrying additional information. - lsCodeActionContext context; - - MAKE_SWAP_METHOD(lsCodeActionParams, - textDocument, - range, - context); +struct lsCodeActionParams +{ + // The document in which the command was invoked. + lsTextDocumentIdentifier textDocument; + // The range for which the command was invoked. + lsRange range; + // Context carrying additional information. + lsCodeActionContext context; + + MAKE_SWAP_METHOD(lsCodeActionParams, textDocument, range, context); }; -MAKE_REFLECT_STRUCT(lsCodeActionParams, - textDocument, - range, - context); - - - - - - - - +MAKE_REFLECT_STRUCT(lsCodeActionParams, textDocument, range, context); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/Directory.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/Directory.h index 77b6cbb3e7..c1ab3fed03 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/Directory.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/Directory.h @@ -3,11 +3,12 @@ struct AbsolutePath; -struct Directory { - explicit Directory(const AbsolutePath& path); +struct Directory +{ + explicit Directory(AbsolutePath const& path); - bool operator==(const Directory& rhs) const; - bool operator!=(const Directory& rhs) const; + bool operator==(Directory const& rhs) const; + bool operator!=(Directory const& rhs) const; - std::string path; + std::string path; }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ExecuteCommandParams.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ExecuteCommandParams.h index bb73d8a46f..c2a4404278 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ExecuteCommandParams.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ExecuteCommandParams.h @@ -1,20 +1,21 @@ #pragma once #include "lsAny.h" -struct ExecuteCommandParams { - /** +struct ExecuteCommandParams +{ + /** * The identifier of the actual command handler. */ - std::string command; + std::string command; - /** + /** * Arguments that the command should be invoked with. * The arguments are typically specified when a command is returned from the server to the client. * Example requests that return a command are textDocument/codeAction or textDocument/codeLens. */ - optional<std::vector<lsp::Any>> arguments; + optional<std::vector<lsp::Any>> arguments; - MAKE_SWAP_METHOD(ExecuteCommandParams, command, arguments); + MAKE_SWAP_METHOD(ExecuteCommandParams, command, arguments); }; -MAKE_REFLECT_STRUCT(ExecuteCommandParams,command,arguments) +MAKE_REFLECT_STRUCT(ExecuteCommandParams, command, arguments) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/IProgressMonitor.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/IProgressMonitor.h index 369ebb2a6d..35ec7e46b8 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/IProgressMonitor.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/IProgressMonitor.h @@ -1,8 +1,8 @@ #pragma once - #include <string> -namespace lsp { +namespace lsp +{ /** * The <code>IProgressMonitor</code> interface is implemented * by objects that monitor the progress of an activity; the methods @@ -36,18 +36,19 @@ namespace lsp { * Clients may implement this interface. * </p> */ - class IProgressMonitor { - public: - virtual ~IProgressMonitor() - { - } +class IProgressMonitor +{ +public: + virtual ~IProgressMonitor() + { + } - /** Constant indicating an unknown amount of work. + /** Constant indicating an unknown amount of work. */ - const static int UNKNOWN = -1; + static int const UNKNOWN = -1; - /** + /** * Notifies that the main task is beginning. This must only be called once * on a given progress monitor instance. * @@ -57,33 +58,30 @@ namespace lsp { * the implemenation is free to indicate progress in a way which * doesn't require the total number of work units in advance. */ - virtual void beginTask(void* , int totalWork) - { + virtual void beginTask(void*, int totalWork) { - }; - /** + }; + /** * Notifies that the work is done; that is, either the main task is completed * or the user canceled it. This method may be called more than once * (implementations should be prepared to handle this case). */ - virtual void endTask(void*, int totalWork) - { - - } + virtual void endTask(void*, int totalWork) + { + } - virtual void done(void*) = 0; + virtual void done(void*) = 0; - /** + /** * Internal method to handle scaling correctly. This method * must not be called by a client. Clients should * always use the method <code>worked(int)</code>. */ - virtual void internalWorked(double work) - { - - } - /** + virtual void internalWorked(double work) + { + } + /** * Returns whether cancelation of current operation has been requested. * Long-running operations should poll to see if cancelation * has been requested. @@ -92,8 +90,8 @@ namespace lsp { * and <code>false</code> otherwise * @see #setCanceled */ - virtual bool isCanceled() = 0; - /** + virtual bool isCanceled() = 0; + /** * Sets the cancel state to the given value. * * @param value <code>true</code> indicates that cancelation has @@ -102,8 +100,8 @@ namespace lsp { * * @see #isCanceled */ - virtual void setCanceled(bool value) = 0; - /** + virtual void setCanceled(bool value) = 0; + /** * Sets the task name to the given value. This method is used to * restore the task label after a nested operation was executed. * Normally there is no need for clients to call this method. @@ -111,21 +109,19 @@ namespace lsp { * @param name the name (or description) of the main task * @see #beginTask(java.lang.const wstring&, int) */ - virtual void setTaskName(void*) - { + virtual void setTaskName(void*) { - }; - /** + }; + /** * Notifies that a subtask of the main task is beginning. * Subtasks are optional; the main task might not have subtasks. * * @param name the name (or description) of the subtask */ - virtual void subTask(void* ) - { - - } - /** + virtual void subTask(void*) + { + } + /** * Notifies that a given number of work unit of the main task * has been completed. Note that this amount represents an * installment, as opposed to a cumulative amount of work done @@ -133,11 +129,10 @@ namespace lsp { * * @param work the number of work units just completed */ - virtual void worked(int work) - { + virtual void worked(int work) { - }; + }; - virtual void catch_exception(void*) = 0; - }; -} + virtual void catch_exception(void*) = 0; +}; +} // namespace lsp diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/Markup/Markup.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/Markup/Markup.h index 1618939c69..07fef15897 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/Markup/Markup.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/Markup/Markup.h @@ -15,105 +15,116 @@ namespace lsp /// Holds text and knows how to lay it out. Multiple blocks can be grouped to /// form a document. Blocks include their own trailing newlines, std::string_ref /// should trim them if need be. -class Block { +class Block +{ public: - virtual void renderMarkdown(std::ostringstream &OS) const = 0; - virtual void renderPlainText(std::ostringstream &OS) const = 0; - virtual std::unique_ptr<Block> clone() const = 0; - std::string_ref asMarkdown() const; - std::string_ref asPlainText() const; - - virtual bool isRuler() const { return false; } - virtual ~Block() = default; + virtual void renderMarkdown(std::ostringstream& OS) const = 0; + virtual void renderPlainText(std::ostringstream& OS) const = 0; + virtual std::unique_ptr<Block> clone() const = 0; + std::string_ref asMarkdown() const; + std::string_ref asPlainText() const; + + virtual bool isRuler() const + { + return false; + } + virtual ~Block() = default; }; /// Represents parts of the markup that can contain strings, like inline code, /// code block or plain text. /// One must introduce different paragraphs to create separate blocks. -class Paragraph : public Block { +class Paragraph : public Block +{ public: - void renderMarkdown(std::ostringstream &OS) const override; - void renderPlainText(std::ostringstream &OS) const override; - std::unique_ptr<Block> clone() const override; + void renderMarkdown(std::ostringstream& OS) const override; + void renderPlainText(std::ostringstream& OS) const override; + std::unique_ptr<Block> clone() const override; - /// Append plain text to the end of the string. - Paragraph &appendText(const std::string_ref& Text); + /// Append plain text to the end of the string. + Paragraph& appendText(std::string_ref const& Text); - /// Append inline code, this translates to the ` block in markdown. - /// \p Preserve indicates the code span must be apparent even in plaintext. - Paragraph &appendCode(const std::string_ref& Code, bool Preserve = false); + /// Append inline code, this translates to the ` block in markdown. + /// \p Preserve indicates the code span must be apparent even in plaintext. + Paragraph& appendCode(std::string_ref const& Code, bool Preserve = false); - /// Ensure there is space between the surrounding chunks. - /// Has no effect at the beginning or end of a paragraph. - Paragraph &appendSpace(); + /// Ensure there is space between the surrounding chunks. + /// Has no effect at the beginning or end of a paragraph. + Paragraph& appendSpace(); private: - struct Chunk { - enum { - PlainText, - InlineCode, - } Kind = PlainText; - // Preserve chunk markers in plaintext. - bool Preserve = false; - std::string_ref Contents; - // Whether this chunk should be surrounded by whitespace. - // Consecutive SpaceAfter and SpaceBefore will be collapsed into one space. - // Code spans don't usually set this: their spaces belong "inside" the span. - bool SpaceBefore = false; - bool SpaceAfter = false; - }; - std::vector<Chunk> Chunks; + struct Chunk + { + enum + { + PlainText, + InlineCode, + } Kind = PlainText; + // Preserve chunk markers in plaintext. + bool Preserve = false; + std::string_ref Contents; + // Whether this chunk should be surrounded by whitespace. + // Consecutive SpaceAfter and SpaceBefore will be collapsed into one space. + // Code spans don't usually set this: their spaces belong "inside" the span. + bool SpaceBefore = false; + bool SpaceAfter = false; + }; + std::vector<Chunk> Chunks; }; /// Represents a sequence of one or more documents. Knows how to print them in a /// list like format, e.g. by prepending with "- " and indentation. -class BulletList : public Block { +class BulletList : public Block +{ public: - void renderMarkdown(std::ostringstream &OS) const override; - void renderPlainText(std::ostringstream &OS) const override; - std::unique_ptr<Block> clone() const override; + void renderMarkdown(std::ostringstream& OS) const override; + void renderPlainText(std::ostringstream& OS) const override; + std::unique_ptr<Block> clone() const override; - class Document &addItem(); + class Document& addItem(); private: - std::vector<class Document> Items; + std::vector<class Document> Items; }; /// A format-agnostic representation for structured text. Allows rendering into /// markdown and plaintext. -class Document { +class Document +{ public: - Document() = default; - Document(const Document &Other) { *this = Other; } - Document &operator=(const Document &); - Document(Document &&) = default; - Document &operator=(Document &&) = default; - - void append(Document Other); - - /// Adds a semantical block that will be separate from others. - Paragraph &addParagraph(); - /// Inserts a horizontal separator to the document. - void addRuler(); - /// Adds a block of code. This translates to a ``` block in markdown. In plain - /// text representation, the code block will be surrounded by newlines. - void addCodeBlock( std::string_ref Code, std::string_ref Language = "cpp"); - /// Heading is a special type of paragraph that will be prepended with \p - /// Level many '#'s in markdown. - Paragraph &addHeading(size_t Level); - - BulletList &addBulletList(); - - /// Doesn't contain any trailing newlines. - /// We try to make the markdown human-readable, e.g. avoid extra escaping. - /// At least one client (coc.nvim) displays the markdown verbatim! - std::string_ref asMarkdown() const; - /// Doesn't contain any trailing newlines. - std::string_ref asPlainText() const; + Document() = default; + Document(Document const& Other) + { + *this = Other; + } + Document& operator=(Document const&); + Document(Document&&) = default; + Document& operator=(Document&&) = default; + + void append(Document Other); + + /// Adds a semantical block that will be separate from others. + Paragraph& addParagraph(); + /// Inserts a horizontal separator to the document. + void addRuler(); + /// Adds a block of code. This translates to a ``` block in markdown. In plain + /// text representation, the code block will be surrounded by newlines. + void addCodeBlock(std::string_ref Code, std::string_ref Language = "cpp"); + /// Heading is a special type of paragraph that will be prepended with \p + /// Level many '#'s in markdown. + Paragraph& addHeading(size_t Level); + + BulletList& addBulletList(); + + /// Doesn't contain any trailing newlines. + /// We try to make the markdown human-readable, e.g. avoid extra escaping. + /// At least one client (coc.nvim) displays the markdown verbatim! + std::string_ref asMarkdown() const; + /// Doesn't contain any trailing newlines. + std::string_ref asPlainText() const; private: - std::vector<std::unique_ptr<Block>> Children; + std::vector<std::unique_ptr<Block>> Children; }; - -} +} // namespace lsp diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/Markup/string_ref.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/Markup/string_ref.h index bac8fbbaf5..391cf7c290 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/Markup/string_ref.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/Markup/string_ref.h @@ -4,7 +4,7 @@ #include <string> #include <vector> #include <stdarg.h> -#include<functional> +#include <functional> #ifndef _WIN32 #include <cstring> @@ -12,262 +12,274 @@ namespace std { - /** +/** * An extension of STL's string providing additional functionality that is often availiable in * higher-level languages such as Python. */ - class string_ref : public string - { - public: - - //static unsigned GetAutoSenseRadix(string_ref& Str) { - // if (Str.empty()) - // return 10; - - // if (Str.start_with("0x") || Str.start_with("0X")) { - // Str = Str.substr(2); - // return 16; - // } - - // if (Str.start_with("0b") || Str.start_with("0B")) { - // Str = Str.substr(2); - // return 2; - // } - - // if (Str.start_with("0o")) { - // Str = Str.substr(2); - // return 8; - // } - - // if (Str[0] == '0' && Str.size() > 1 && std::isdigit(Str[1])) { - // Str = Str.substr(1); - // return 8; - // } - - // return 10; - //} - - //static bool consumeUnsignedInteger(string_ref& Str, unsigned Radix, - // unsigned long long& Result) { - // // Autosense radix if not specified. - // if (Radix == 0) - // Radix = GetAutoSenseRadix(Str); - - // // Empty strings (after the radix autosense) are invalid. - // if (Str.empty()) return true; - - // // Parse all the bytes of the string given this radix. Watch for overflow. - // string_ref Str2 = Str; - // Result = 0; - // while (!Str2.empty()) { - // unsigned CharVal; - // if (Str2[0] >= '0' && Str2[0] <= '9') - // CharVal = Str2[0] - '0'; - // else if (Str2[0] >= 'a' && Str2[0] <= 'z') - // CharVal = Str2[0] - 'a' + 10; - // else if (Str2[0] >= 'A' && Str2[0] <= 'Z') - // CharVal = Str2[0] - 'A' + 10; - // else - // break; - - // // If the parsed value is larger than the integer radix, we cannot - // // consume any more characters. - // if (CharVal >= Radix) - // break; - - // // Add in this character. - // unsigned long long PrevResult = Result; - // Result = Result * Radix + CharVal; - - // // Check for overflow by shifting back and seeing if bits were lost. - // if (Result / Radix < PrevResult) - // return true; - - // Str2 = Str2.substr(1); - // } - - // // We consider the operation a failure if no characters were consumed - // // successfully. - // if (Str.size() == Str2.size()) - // return true; - - // Str = Str2; - // return false; - //} - - //static bool consumeSignedInteger(string_ref& Str, unsigned Radix, - // long long& Result) { - // unsigned long long ULLVal; - - // // Handle positive strings first. - // if (Str.empty() || Str.front() != '-') { - // if (consumeUnsignedInteger(Str, Radix, ULLVal) || - // // Check for value so large it overflows a signed value. - // (long long)ULLVal < 0) - // return true; - // Result = ULLVal; - // return false; - // } - - // // Get the positive part of the value. - // string_ref Str2 = Str.drop_front(1); - // if (consumeUnsignedInteger(Str2, Radix, ULLVal) || - // // Reject values so large they'd overflow as negative signed, but allow - // // "-0". This negates the unsigned so that the negative isn't undefined - // // on signed overflow. - // (long long)-ULLVal > 0) - // return true; - - // Str = Str2; - // Result = -ULLVal; - // return false; - //} - - ///// GetAsUnsignedInteger - Workhorse method that converts a integer character - ///// sequence of radix up to 36 to an unsigned long long value. - //static bool getAsUnsignedInteger(string_ref Str, unsigned Radix, - // unsigned long long& Result) { - // if (consumeUnsignedInteger(Str, Radix, Result)) - // return true; - - // // For getAsUnsignedInteger, we require the whole string to be consumed or - // // else we consider it a failure. - // return !Str.empty(); - //} - - //static bool getAsSignedInteger(string_ref Str, unsigned Radix, - // long long& Result) { - // if (consumeSignedInteger(Str, Radix, Result)) - // return true; - - // // For getAsSignedInteger, we require the whole string to be consumed or else - // // we consider it a failure. - // return !Str.empty(); - //} - - - ///// Parse the current string as an integer of the specified radix. If - ///// \p Radix is specified as zero, this does radix autosensing using - ///// extended C rules: 0 is octal, 0x is hex, 0b is binary. - ///// - ///// If the string is invalid or if only a subset of the string is valid, - ///// this returns true to signify the error. The string is considered - ///// erroneous if empty or if it overflows T. - //template <typename T> - //std::enable_if_t<std::numeric_limits<T>::is_signed, bool> - // getAsInteger(unsigned Radix, T& Result) const { - // long long LLVal; - // if (getAsSignedInteger(*this, Radix, LLVal) || - // static_cast<T>(LLVal) != LLVal) - // return true; - // Result = LLVal; - // return false; - //} - - //template <typename T> - //std::enable_if_t<!std::numeric_limits<T>::is_signed, bool> - // getAsInteger(unsigned Radix, T& Result) const { - // unsigned long long ULLVal; - // // The additional cast to unsigned long long is required to avoid the - // // Visual C++ warning C4805: '!=' : unsafe mix of type 'bool' and type - // // 'unsigned __int64' when instantiating getAsInteger with T = bool. - // if (getAsUnsignedInteger(*this, Radix, ULLVal) || - // static_cast<unsigned long long>(static_cast<T>(ULLVal)) != ULLVal) - // return true; - // Result = ULLVal; - // return false; - //} - - - - /**` +class string_ref : public string +{ +public: + //static unsigned GetAutoSenseRadix(string_ref& Str) { + // if (Str.empty()) + // return 10; + + // if (Str.start_with("0x") || Str.start_with("0X")) { + // Str = Str.substr(2); + // return 16; + // } + + // if (Str.start_with("0b") || Str.start_with("0B")) { + // Str = Str.substr(2); + // return 2; + // } + + // if (Str.start_with("0o")) { + // Str = Str.substr(2); + // return 8; + // } + + // if (Str[0] == '0' && Str.size() > 1 && std::isdigit(Str[1])) { + // Str = Str.substr(1); + // return 8; + // } + + // return 10; + //} + + //static bool consumeUnsignedInteger(string_ref& Str, unsigned Radix, + // unsigned long long& Result) { + // // Autosense radix if not specified. + // if (Radix == 0) + // Radix = GetAutoSenseRadix(Str); + + // // Empty strings (after the radix autosense) are invalid. + // if (Str.empty()) return true; + + // // Parse all the bytes of the string given this radix. Watch for overflow. + // string_ref Str2 = Str; + // Result = 0; + // while (!Str2.empty()) { + // unsigned CharVal; + // if (Str2[0] >= '0' && Str2[0] <= '9') + // CharVal = Str2[0] - '0'; + // else if (Str2[0] >= 'a' && Str2[0] <= 'z') + // CharVal = Str2[0] - 'a' + 10; + // else if (Str2[0] >= 'A' && Str2[0] <= 'Z') + // CharVal = Str2[0] - 'A' + 10; + // else + // break; + + // // If the parsed value is larger than the integer radix, we cannot + // // consume any more characters. + // if (CharVal >= Radix) + // break; + + // // Add in this character. + // unsigned long long PrevResult = Result; + // Result = Result * Radix + CharVal; + + // // Check for overflow by shifting back and seeing if bits were lost. + // if (Result / Radix < PrevResult) + // return true; + + // Str2 = Str2.substr(1); + // } + + // // We consider the operation a failure if no characters were consumed + // // successfully. + // if (Str.size() == Str2.size()) + // return true; + + // Str = Str2; + // return false; + //} + + //static bool consumeSignedInteger(string_ref& Str, unsigned Radix, + // long long& Result) { + // unsigned long long ULLVal; + + // // Handle positive strings first. + // if (Str.empty() || Str.front() != '-') { + // if (consumeUnsignedInteger(Str, Radix, ULLVal) || + // // Check for value so large it overflows a signed value. + // (long long)ULLVal < 0) + // return true; + // Result = ULLVal; + // return false; + // } + + // // Get the positive part of the value. + // string_ref Str2 = Str.drop_front(1); + // if (consumeUnsignedInteger(Str2, Radix, ULLVal) || + // // Reject values so large they'd overflow as negative signed, but allow + // // "-0". This negates the unsigned so that the negative isn't undefined + // // on signed overflow. + // (long long)-ULLVal > 0) + // return true; + + // Str = Str2; + // Result = -ULLVal; + // return false; + //} + + ///// GetAsUnsignedInteger - Workhorse method that converts a integer character + ///// sequence of radix up to 36 to an unsigned long long value. + //static bool getAsUnsignedInteger(string_ref Str, unsigned Radix, + // unsigned long long& Result) { + // if (consumeUnsignedInteger(Str, Radix, Result)) + // return true; + + // // For getAsUnsignedInteger, we require the whole string to be consumed or + // // else we consider it a failure. + // return !Str.empty(); + //} + + //static bool getAsSignedInteger(string_ref Str, unsigned Radix, + // long long& Result) { + // if (consumeSignedInteger(Str, Radix, Result)) + // return true; + + // // For getAsSignedInteger, we require the whole string to be consumed or else + // // we consider it a failure. + // return !Str.empty(); + //} + + ///// Parse the current string as an integer of the specified radix. If + ///// \p Radix is specified as zero, this does radix autosensing using + ///// extended C rules: 0 is octal, 0x is hex, 0b is binary. + ///// + ///// If the string is invalid or if only a subset of the string is valid, + ///// this returns true to signify the error. The string is considered + ///// erroneous if empty or if it overflows T. + //template <typename T> + //std::enable_if_t<std::numeric_limits<T>::is_signed, bool> + // getAsInteger(unsigned Radix, T& Result) const { + // long long LLVal; + // if (getAsSignedInteger(*this, Radix, LLVal) || + // static_cast<T>(LLVal) != LLVal) + // return true; + // Result = LLVal; + // return false; + //} + + //template <typename T> + //std::enable_if_t<!std::numeric_limits<T>::is_signed, bool> + // getAsInteger(unsigned Radix, T& Result) const { + // unsigned long long ULLVal; + // // The additional cast to unsigned long long is required to avoid the + // // Visual C++ warning C4805: '!=' : unsafe mix of type 'bool' and type + // // 'unsigned __int64' when instantiating getAsInteger with T = bool. + // if (getAsUnsignedInteger(*this, Radix, ULLVal) || + // static_cast<unsigned long long>(static_cast<T>(ULLVal)) != ULLVal) + // return true; + // Result = ULLVal; + // return false; + //} + + /**` * Default constructor * * Constructs an empty string_ref ("") */ - string_ref() : string() { } + string_ref() : string() + { + } - /** + /** * Duplicate the STL string copy constructor * * @param[in] s The string to copy * @param[in] pos The starting position in the string to copy from * @param[in] n The number of characters to copy */ - string_ref(const string &s, size_type pos = 0, size_type n = npos) : string(s, pos, npos) { } + string_ref(string const& s, size_type pos = 0, size_type n = npos) : string(s, pos, n) + { + } - /** + /** * Construct an string_ref from a null-terminated character array * * @param[in] s The character array to copy into the new string */ - string_ref(const value_type *s) : string(s) { } + string_ref(value_type const* s) : string(s) + { + } - /** + /** * Construct an string_ref from a character array and a length * * @param[in] s The character array to copy into the new string * @param[in] n The number of characters to copy */ - string_ref(const value_type *s, size_type n) : string(s, n) { } + string_ref(value_type const* s, size_type n) : string(s, n) + { + } - /** + /** * Create an string_ref with @p n copies of @p c * * @param[in] n The number of copies * @param[in] c The character to copy @p n times */ - string_ref(size_type n, value_type c) : string(n, c) { } + string_ref(size_type n, value_type c) : string(n, c) + { + } - /** + /** * Create a string from a range * * @param[in] first The first element to copy in * @param[in] last The last element to copy in */ - template <class InputIterator> - string_ref(InputIterator first, InputIterator last) : string(first, last) { } + template<class InputIterator> + string_ref(InputIterator first, InputIterator last) : string(first, last) + { + } - /** + /** * The destructor */ - ~string_ref() { } + ~string_ref() + { + } - /** + /** * Split a string by whitespace * * @return A vector of strings, each of which is a substring of the string */ - vector<string_ref> split(size_type limit = npos) const + vector<string_ref> split(size_type limit = npos) const + { + vector<string_ref> v; + + const_iterator i = begin(), last = i; + for (; i != end(); i++) + { + if (*i == ' ' || *i == '\n' || *i == '\t' || *i == '\r') + { + if (i + 1 != end() && (i[1] == ' ' || i[1] == '\n' || i[1] == '\t' || i[1] == '\r')) + { + continue; + } + v.push_back(string_ref(last, i)); + last = i + 1; + if (v.size() >= limit - 1) { - vector<string_ref> v; - - const_iterator - i = begin(), - last = i; - for (; i != end(); i++) - { - if (*i == ' ' || *i == '\n' || *i == '\t' || *i == '\r') - { - if (i + 1 != end() && (i[1] == ' ' || i[1] == '\n' || i[1] == '\t' || i[1] == '\r')) - continue; - v.push_back(string_ref(last, i)); - last = i + 1; - if (v.size() >= limit - 1) - { - v.push_back(string_ref(last, end())); - return v; - } - } - } - - if (last != i) - v.push_back(string_ref(last, i)); - - return v; + v.push_back(string_ref(last, end())); + return v; } + } + } + + if (last != i) + { + v.push_back(string_ref(last, i)); + } + + return v; + } - /** + /** * Split a string by a character * * Returns a vector of ext_strings, each of which is a substring of the string formed by splitting @@ -296,34 +308,34 @@ namespace std * test. * @endcode */ - vector<string_ref> split(value_type separator, size_type limit = npos) const + vector<string_ref> split(value_type separator, size_type limit = npos) const + { + vector<string_ref> v; + + const_iterator i = begin(), last = i; + for (; i != end(); i++) + { + if (*i == separator) + { + v.push_back(string_ref(last, i)); + last = i + 1; + if (v.size() >= limit - 1) { - vector<string_ref> v; - - const_iterator - i = begin(), - last = i; - for (; i != end(); i++) - { - if (*i == separator) - { - v.push_back(string_ref(last, i)); - last = i + 1; - if (v.size() >= limit - 1) - { - v.push_back(string_ref(last, end())); - return v; - } - } - } - - if (last != i) - v.push_back(string_ref(last, i)); - - return v; + v.push_back(string_ref(last, end())); + return v; } + } + } + + if (last != i) + { + v.push_back(string_ref(last, i)); + } + + return v; + } - /** + /** * Split a string by another string * * Returns a vector of ext_strings, each of which is a substring of the string formed by @@ -342,35 +354,35 @@ namespace std * * @ref split_ex */ - vector<string_ref> split(const string &separator, size_type limit = npos) const + vector<string_ref> split(string const& separator, size_type limit = npos) const + { + vector<string_ref> v; + + const_iterator i = begin(), last = i; + for (; i != end(); i++) + { + if (string(i, i + separator.length()) == separator) + { + v.push_back(string_ref(last, i)); + last = i + separator.length(); + + if (v.size() >= limit - 1) { - vector<string_ref> v; - - const_iterator - i = begin(), - last = i; - for (; i != end(); i++) - { - if (string(i, i + separator.length()) == separator) - { - v.push_back(string_ref(last, i)); - last = i + separator.length(); - - if (v.size() >= limit - 1) - { - v.push_back(string_ref(last, end())); - return v; - } - } - } - - if (last != i) - v.push_back(string_ref(last, i)); - - return v; + v.push_back(string_ref(last, end())); + return v; } + } + } + + if (last != i) + { + v.push_back(string_ref(last, i)); + } + + return v; + } - /** + /** * Convert a string into an integer * * Convert the initial portion of a string into a signed integer. Once a non-numeric @@ -380,39 +392,45 @@ namespace std * @param s The string to convert * @return The integer converted from @p string */ - static long int integer(const string &s) + static long int integer(string const& s) + { + long int retval = 0; + bool neg = false; + + for (const_iterator i = s.begin(); i != s.end(); i++) + { + if (i == s.begin()) + { + if (*i == '-') + { + neg = true; + continue; + } + else if (*i == '+') { - long int retval = 0; - bool neg = false; - - for (const_iterator i = s.begin(); i != s.end(); i++) - { - if (i == s.begin()) - { - if (*i == '-') - { - neg = true; - continue; - } - else if (*i == '+') - continue; - } - if (*i >= '0' && *i <= '9') - { - retval *= 10; - retval += *i - '0'; - } - else - break; - } - - if (neg) - retval *= -1; - - return retval; + continue; } + } + if (*i >= '0' && *i <= '9') + { + retval *= 10; + retval += *i - '0'; + } + else + { + break; + } + } - /** + if (neg) + { + retval *= -1; + } + + return retval; + } + + /** * Convert the string to an integer * * Convert the initial portion of the string into a signed integer. Once a non-numeric @@ -421,12 +439,12 @@ namespace std * * @return The integer converted from the string */ - long int integer() const - { - return integer(*this); - } + long int integer() const + { + return integer(*this); + } - /** + /** * Split a string into chunks of size @p chunklen. Returns a vector of strings. * * Splits a string into chunks of the given size. The final chunk may not fill its @@ -444,32 +462,32 @@ namespace std * abc def ghi jk * @endcode */ - vector<string_ref> chunk_split(size_type chunklen) const - { - vector<string_ref> retval; - retval.reserve(size() / chunklen + 1); - - size_type count = 0; - const_iterator - i = begin(), - last = i; - for (; i != end(); i++, count++) - { - if (count == chunklen) - { - count = 0; - retval.push_back(string_ref(last, i)); - last = i; - } - } - - if (last != i) - retval.push_back(string_ref(last, i)); - - return retval; - } + vector<string_ref> chunk_split(size_type chunklen) const + { + vector<string_ref> retval; + retval.reserve(size() / chunklen + 1); + + size_type count = 0; + const_iterator i = begin(), last = i; + for (; i != end(); i++, count++) + { + if (count == chunklen) + { + count = 0; + retval.push_back(string_ref(last, i)); + last = i; + } + } + + if (last != i) + { + retval.push_back(string_ref(last, i)); + } - /** + return retval; + } + + /** * Join a sequence of strings by some glue to create a new string * * Glue is not added to the end of the string. @@ -495,43 +513,43 @@ namespace std * This|is|a|test. * @endcode */ - template <class InputIterator> - static string_ref join(const string &glue, InputIterator first, InputIterator last) - { - string_ref retval; - - for (; first != last; ++first) - { - retval.append(*first); - retval.append(glue); - } - retval.erase(retval.length() - glue.length()); - - return retval; - } - - /** + template<class InputIterator> + static string_ref join(string const& glue, InputIterator first, InputIterator last) + { + string_ref retval; + + for (; first != last; ++first) + { + retval.append(*first); + retval.append(glue); + } + retval.erase(retval.length() - glue.length()); + + return retval; + } + + /** * Join a sequence of strings by some glue to create a new string * * @copydoc join * @ref join_ex */ - template <class InputIterator> - static string_ref join(value_type glue, InputIterator first, InputIterator last) - { - string_ref retval; - - for (; first != last; ++first) - { - retval.append(*first); - retval.append(1, glue); - } - retval.erase(retval.length() - 1); - - return retval; - } - - /** + template<class InputIterator> + static string_ref join(value_type glue, InputIterator first, InputIterator last) + { + string_ref retval; + + for (; first != last; ++first) + { + retval.append(*first); + retval.append(1, glue); + } + retval.erase(retval.length() - 1); + + return retval; + } + + /** * Search for any instances of @p needle and replace them with @p s * * @param[in] needle The string to replace @@ -548,33 +566,29 @@ namespace std * There ere a test. * @endcode */ - string_ref &replace(const string &needle, const string &s) - { - size_type - lastpos = 0, - thispos; - - while ((thispos = find(needle, lastpos)) != npos) - { - string::replace(thispos, needle.length(), s); - lastpos = thispos + 1; - } - return *this; - } - string_ref &replace_first(const string &needle, const string &s) - { - size_type - lastpos = 0, - thispos; - - if ((thispos = find(needle, lastpos)) != npos) - { - string::replace(thispos, needle.length(), s); - lastpos = thispos + 1; - } - return *this; - } - /** + string_ref& replace(string const& needle, string const& s) + { + size_type lastpos = 0, thispos; + + while ((thispos = find(needle, lastpos)) != npos) + { + string::replace(thispos, needle.length(), s); + lastpos = thispos + 1; + } + return *this; + } + string_ref& replace_first(string const& needle, string const& s) + { + size_type lastpos = 0, thispos; + + if ((thispos = find(needle, lastpos)) != npos) + { + string::replace(thispos, needle.length(), s); + lastpos = thispos + 1; + } + return *this; + } + /** * Search of any instances of @p needle and replace them with @p c * * @param[in] needle The character to replace @@ -584,16 +598,20 @@ namespace std * * @ref replace-ex */ - string_ref &replace(value_type needle, value_type c) - { - for (iterator i = begin(); i != end(); i++) - if (*i == needle) - *i = c; + string_ref& replace(value_type needle, value_type c) + { + for (iterator i = begin(); i != end(); i++) + { + if (*i == needle) + { + *i = c; + } + } - return *this; - } + return *this; + } - /** + /** * Repeat a string @p n times * * @param[in] n The number of times to repeat the string @@ -608,176 +626,221 @@ namespace std * 123123123 * @endcode */ - string_ref operator*(size_type n) - { - string_ref retval; - for (size_type i = 0; i < n; i++) - retval.append(*this); + string_ref operator*(size_type n) + { + string_ref retval; + for (size_type i = 0; i < n; i++) + { + retval.append(*this); + } - return retval; - } + return retval; + } - /** + /** * Convert the string to lowercase * * @return *this * @post The string is converted to lowercase */ - string_ref &tolower() - { - for (iterator i = begin(); i != end(); i++) - if (*i >= 'A' && *i <= 'Z') - *i = (*i) + ('a' - 'A'); - return *this; - } + string_ref& tolower() + { + for (iterator i = begin(); i != end(); i++) + { + if (*i >= 'A' && *i <= 'Z') + { + *i = (*i) + ('a' - 'A'); + } + } + return *this; + } - /** + /** * Convert the string to uppercase * * @return *this * @post The string is converted to uppercase */ - string_ref &toupper() - { - for (iterator i = begin(); i != end(); i++) - if (*i >= 'a' && *i <= 'z') - *i = (*i) - ('a' - 'A'); - return *this; - } + string_ref& toupper() + { + for (iterator i = begin(); i != end(); i++) + { + if (*i >= 'a' && *i <= 'z') + { + *i = (*i) - ('a' - 'A'); + } + } + return *this; + } - /** + /** * Count the occurances of @p str in the string. * * @return The count of substrings @p str in the string */ - size_type count(const string &str) const - { - size_type - count = 0, - last = 0, - cur = 0; - - while ((cur = find(str, last + 1)) != npos) - { - count++; - last = cur; - } - - return count; - } + size_type count(string const& str) const + { + size_type count = 0, last = 0, cur = 0; - /** + while ((cur = find(str, last + 1)) != npos) + { + count++; + last = cur; + } + + return count; + } + + /** * Determine if the string is alphanumeric * * @return true if the string contains only characters between a-z, A-Z and 0-9 and * contains at least one character, else false */ - bool is_alnum() const + bool is_alnum() const + { + if (length() == 0) + { + return false; + } + + for (const_iterator i = begin(); i != end(); i++) + { + if (*i < 'A' || *i > 'Z') + { + if (*i < '0' || *i > '9') { - if (length() == 0) - return false; - - for (const_iterator i = begin(); i != end(); i++) - { - if (*i < 'A' || *i > 'Z') - if (*i < '0' || *i > '9') - if (*i < 'a' || *i > 'z') - return false; - } - - return true; + if (*i < 'a' || *i > 'z') + { + return false; + } } + } + } + + return true; + } - /** + /** * Determine if the string is alphabetic only * * @return true of the string contains only characters between a-z and A-Z and contains at * least one character, else false */ - bool is_alpha() const - { - if (length() == 0) - return false; + bool is_alpha() const + { + if (length() == 0) + { + return false; + } - for (const_iterator i = begin(); i != end(); i++) - if (*i < 'A' || (*i > 'Z' && (*i < 'a' || *i > 'z'))) - return false; + for (const_iterator i = begin(); i != end(); i++) + { + if (*i < 'A' || (*i > 'Z' && (*i < 'a' || *i > 'z'))) + { + return false; + } + } - return true; - } + return true; + } - /** + /** * Determine if the string is numeric only * * @return true if the string contains only characters between 0-9 and contains at least * one character, else false */ - bool is_numeric() const - { - if (length() == 0) - return false; + bool is_numeric() const + { + if (length() == 0) + { + return false; + } - for (const_iterator i = begin(); i != end(); i++) - if (*i < '0' || *i > '9') - return false; + for (const_iterator i = begin(); i != end(); i++) + { + if (*i < '0' || *i > '9') + { + return false; + } + } - return true; - } + return true; + } - /** + /** * Determine if a string is all lower case * * @return true if there is at least one character, and all characters are lowercase * letters, else false */ - bool is_lower() const - { - if (length() == 0) - return false; + bool is_lower() const + { + if (length() == 0) + { + return false; + } - for (const_iterator i = begin(); i != end(); i++) - if (*i < 'a' || *i < 'z') - return false; + for (const_iterator i = begin(); i != end(); i++) + { + if (*i < 'a' || *i < 'z') + { + return false; + } + } - return true; - } + return true; + } - /** + /** * Determine if a string is all upper case * * @return true if there is at least one character, and all characters are uppercase * letters, else false */ - bool is_upper() const - { - if (length() == 0) - return false; + bool is_upper() const + { + if (length() == 0) + { + return false; + } - for (const_iterator i = begin(); i != end(); i++) - if (*i < 'A' || *i > 'Z') - return false; + for (const_iterator i = begin(); i != end(); i++) + { + if (*i < 'A' || *i > 'Z') + { + return false; + } + } - return true; - } + return true; + } - /** + /** * Swap the case of a string * * @post Converts all uppercase to lowercase, and all lowercase to uppercase in the string * @return *this */ - string_ref &swapcase() - { - for (iterator i = begin(); i != end(); i++) - if (*i >= 'A' && *i <= 'Z') - *i += ('a' - 'A'); - else if (*i >= 'a' && *i <= 'z') - *i -= ('a' - 'A'); + string_ref& swapcase() + { + for (iterator i = begin(); i != end(); i++) + { + if (*i >= 'A' && *i <= 'Z') + { + *i += ('a' - 'A'); + } + else if (*i >= 'a' && *i <= 'z') + { + *i -= ('a' - 'A'); + } + } - return *this; - } + return *this; + } - /******************************************************************************* + /******************************************************************************* Function: std::string_ref::start_with Access: public Qualifier: const @@ -786,73 +849,84 @@ namespace std Purpose: is the string start with str *******************************************************************************/ - bool start_with(const string& str) const - { - return ( this->find(str) == 0 ); - } - - /// Return a string_ref equal to 'this' but with only the last \p N - /// elements remaining. If \p N is greater than the length of the - /// string, the entire string is returned. - - string_ref take_back(size_t N = 1) const { - if (N >= size()) - return *this; - return drop_front(size() - N); - } - /// Return a string_ref equal to 'this' but with the first \p N elements - /// dropped. - - string_ref drop_front(size_t N = 1) const { - //assert(size() >= N && "Dropping more elements than exist"); - return substr(N); - } - - - - /// Return a string_ref equal to 'this' but with the last \p N elements - /// dropped. - - string_ref drop_back(size_t N = 1) const { - - return substr(0, size() - N); - } - - /// Return a string_ref equal to 'this', but with all characters satisfying - /// the given predicate dropped from the beginning of the string. - - string_ref drop_while(std::function<bool(char)> F) const { - return substr(std::find_if_not(begin(),end(),F)-begin()); - } - - /// Return a string_ref equal to 'this', but with all characters not - /// satisfying the given predicate dropped from the beginning of the string. - - string_ref drop_until(std::function<bool(char)> F) const { - return substr(std::find_if(begin(), end(), F) - begin()); - } - - /// Returns true if this string_ref has the given prefix and removes that - /// prefix. - bool consume_front(string_ref Prefix) { - if (!start_with(Prefix)) - return false; - - *this = drop_front(Prefix.size()); - return true; - } - - /// Returns true if this string_ref has the given suffix and removes that - /// suffix. - bool consume_back(string_ref Suffix) { - if (!end_with(Suffix)) - return false; + bool start_with(string const& str) const + { + return (this->find(str) == 0); + } + + /// Return a string_ref equal to 'this' but with only the last \p N + /// elements remaining. If \p N is greater than the length of the + /// string, the entire string is returned. + + string_ref take_back(size_t N = 1) const + { + if (N >= size()) + { + return *this; + } + return drop_front(size() - N); + } + /// Return a string_ref equal to 'this' but with the first \p N elements + /// dropped. + + string_ref drop_front(size_t N = 1) const + { + //assert(size() >= N && "Dropping more elements than exist"); + return substr(N); + } + + /// Return a string_ref equal to 'this' but with the last \p N elements + /// dropped. + + string_ref drop_back(size_t N = 1) const + { + + return substr(0, size() - N); + } + + /// Return a string_ref equal to 'this', but with all characters satisfying + /// the given predicate dropped from the beginning of the string. + + string_ref drop_while(std::function<bool(char)> F) const + { + return substr(std::find_if_not(begin(), end(), F) - begin()); + } + + /// Return a string_ref equal to 'this', but with all characters not + /// satisfying the given predicate dropped from the beginning of the string. + + string_ref drop_until(std::function<bool(char)> F) const + { + return substr(std::find_if(begin(), end(), F) - begin()); + } + + /// Returns true if this string_ref has the given prefix and removes that + /// prefix. + bool consume_front(string_ref Prefix) + { + if (!start_with(Prefix)) + { + return false; + } + + *this = drop_front(Prefix.size()); + return true; + } + + /// Returns true if this string_ref has the given suffix and removes that + /// suffix. + bool consume_back(string_ref Suffix) + { + if (!end_with(Suffix)) + { + return false; + } - *this = drop_back(Suffix.size()); - return true; - } + *this = drop_back(Suffix.size()); + return true; + } - /******************************************************************************* + /******************************************************************************* Function: std::string_ref::end_with Access: public Qualifier: const @@ -861,17 +935,17 @@ namespace std Purpose: is the string end with str *******************************************************************************/ - bool end_with(const string& str) const - { - if (str.length() > this->length()) - { - return false; - } - size_type off = this->length() - str.length(); - return ( find(str, off) == off); - } + bool end_with(string const& str) const + { + if (str.length() > this->length()) + { + return false; + } + size_type off = this->length() - str.length(); + return (find(str, off) == off); + } - /******************************************************************************* + /******************************************************************************* Function: hl_lib::string_ref::format Access: public Qualifier: @@ -881,40 +955,40 @@ namespace std Purpose: format the string *******************************************************************************/ - string_ref& format(const char* format_string, ...) - { - if (format_string == 0) - { - return *this; - } + string_ref& format(char const* format_string, ...) + { + if (format_string == 0) + { + return *this; + } - va_list argList; - va_start( argList, format_string ); + va_list argList; + va_start(argList, format_string); #ifdef _WIN32 - int len = _vscprintf( format_string, argList ); - char* pbuf = new char[len + 1]; - if (pbuf != 0) - { - vsprintf_s( pbuf, len + 1, format_string, argList ); - *this = pbuf; - delete[] pbuf; - } + int len = _vscprintf(format_string, argList); + char* pbuf = new char[len + 1]; + if (pbuf != 0) + { + vsprintf_s(pbuf, len + 1, format_string, argList); + *this = pbuf; + delete[] pbuf; + } #else - const int INLINE_FORMAT_BUFFER_LEN =2048; - char* buf = new char[INLINE_FORMAT_BUFFER_LEN + 1]; - if (buf != 0) - { - int len =vsnprintf(buf,INLINE_FORMAT_BUFFER_LEN, format_string, argList); - assign(buf,buf+len); - delete[] buf; - } + int const INLINE_FORMAT_BUFFER_LEN = 2048; + char* buf = new char[INLINE_FORMAT_BUFFER_LEN + 1]; + if (buf != 0) + { + int len = vsnprintf(buf, INLINE_FORMAT_BUFFER_LEN, format_string, argList); + assign(buf, buf + len); + delete[] buf; + } #endif - va_end( argList ); - return *this; - } + va_end(argList); + return *this; + } - /******************************************************************************* + /******************************************************************************* Function: hl_lib::string_ref::trim_left Access: public Qualifier: @@ -923,17 +997,17 @@ namespace std Purpose: delete all char which is ch at the left of the string *******************************************************************************/ - string_ref& trim_left(value_type ch = ' ') - { - size_type off = this->find_first_not_of(ch); - if (off != string::npos) - { - this->erase(0, off); - } - return *this; - } + string_ref& trim_left(value_type ch = ' ') + { + size_type off = this->find_first_not_of(ch); + if (off != string::npos) + { + this->erase(0, off); + } + return *this; + } - /******************************************************************************* + /******************************************************************************* Function: hl_lib::string_ref::trim_right Access: public Qualifier: @@ -942,22 +1016,22 @@ namespace std Purpose: delete all char which is ch at the right of the string *******************************************************************************/ - string_ref& trim_right(value_type ch = ' ') - { - size_type off = this->find_last_not_of(ch); - if (off == string::npos) - { - off = 0; - } - else - { - off++; - } - this->erase(off, length() - off); - return *this; - } + string_ref& trim_right(value_type ch = ' ') + { + size_type off = this->find_last_not_of(ch); + if (off == string::npos) + { + off = 0; + } + else + { + off++; + } + this->erase(off, length() - off); + return *this; + } - /******************************************************************************* + /******************************************************************************* Function: hl_lib::string_ref::trim Access: public Qualifier: @@ -966,14 +1040,14 @@ namespace std Purpose: delete all char which is ch at the left and right of the string *******************************************************************************/ - string_ref& trim(value_type ch = ' ') - { - trim_left(ch); - trim_right(ch); - return *this; - } - - /******************************************************************************* + string_ref& trim(value_type ch = ' ') + { + trim_left(ch); + trim_right(ch); + return *this; + } + + /******************************************************************************* Function: hl_lib::string_ref::float_num Access: public static Qualifier: @@ -982,12 +1056,12 @@ namespace std Purpose: parse str to a float number *******************************************************************************/ - static double float_num(const string& str) - { - return atof(str.c_str()); - } + static double float_num(string const& str) + { + return atof(str.c_str()); + } - /******************************************************************************* + /******************************************************************************* Function: hl_lib::string_ref::float_num Access: public static Qualifier: @@ -995,12 +1069,12 @@ namespace std Purpose: parse this to a float number *******************************************************************************/ - double float_num() const - { - return float_num(*this); - } + double float_num() const + { + return float_num(*this); + } - /******************************************************************************* + /******************************************************************************* Function: hl_lib::string_ref::compare_nocase Access: public Qualifier: const @@ -1009,16 +1083,16 @@ namespace std Purpose: compare string no case *******************************************************************************/ - int compare_nocase(const string& str) const - { + int compare_nocase(string const& str) const + { #ifdef _WIN32 - return _stricmp(this->c_str(), str.c_str()); + return _stricmp(this->c_str(), str.c_str()); #else - return strcasecmp(this->c_str(), str.c_str()); + return strcasecmp(this->c_str(), str.c_str()); #endif - } + } - /******************************************************************************* + /******************************************************************************* Function: hl_lib::string_ref::compare_nocase Access: public Qualifier: const @@ -1029,13 +1103,13 @@ namespace std Purpose: compare substring no case *******************************************************************************/ - int compare_nocase( size_type index, size_type length, const string &str ) const - { - string_ref temp = this->substr(index, length); - return temp.compare_nocase(str); - } + int compare_nocase(size_type index, size_type length, string const& str) const + { + string_ref temp = this->substr(index, length); + return temp.compare_nocase(str); + } - /******************************************************************************* + /******************************************************************************* Function: hl_lib::string_ref::compare_nocase Access: public Qualifier: const @@ -1048,14 +1122,12 @@ namespace std Purpose: compare two substring no case *******************************************************************************/ - int compare_nocase( size_type index, size_type length, const string &str, size_type index2, size_type length2) const - { - string_ref temp1 = this->substr(index, length); - string_ref temp2 = str.substr(index2, length2); - return temp1.compare_nocase(temp2); - } - - }; - -} - + int compare_nocase(size_type index, size_type length, string const& str, size_type index2, size_type length2) const + { + string_ref temp1 = this->substr(index, length); + string_ref temp2 = str.substr(index2, length2); + return temp1.compare_nocase(temp2); + } +}; + +} // namespace std diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ParentProcessWatcher.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ParentProcessWatcher.h index 6d082d2d2a..96d6f67a3c 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ParentProcessWatcher.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ParentProcessWatcher.h @@ -6,12 +6,11 @@ class ParentProcessWatcher { public: - struct ParentProcessWatcherData; + struct ParentProcessWatcherData; - ParentProcessWatcher(lsp::Log& log, int pid, const std::function<void()>&& callback, uint32_t poll_delay_secs = 10); + ParentProcessWatcher(lsp::Log& log, int pid, std::function<void()> const&& callback, uint32_t poll_delay_secs = 10); - ~ParentProcessWatcher(); + ~ParentProcessWatcher(); - std::shared_ptr<ParentProcessWatcherData> d_ptr; + std::shared_ptr<ParentProcessWatcherData> d_ptr; }; - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ProcessIoService.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ProcessIoService.h index 5edecef0b2..0c4b89781b 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ProcessIoService.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ProcessIoService.h @@ -4,45 +4,41 @@ namespace lsp { - class ProcessIoService - { - public: - using IOService = boost::asio::io_service; - using Work = boost::asio::io_service::work; - using WorkPtr = std::unique_ptr<Work>; - - ProcessIoService() { - - work_ = std::unique_ptr<Work>(new Work(ioService_)); - auto temp_thread_ = new std::thread([this] - { - ioService_.run(); - }); - thread_ = std::unique_ptr<std::thread>(temp_thread_); - } +class ProcessIoService +{ +public: + using IOService = boost::asio::io_context; + using Work = boost::asio::io_context::work; + using WorkPtr = std::unique_ptr<Work>; - ProcessIoService(const ProcessIoService&) = delete; - ProcessIoService& operator=(const ProcessIoService&) = delete; + ProcessIoService() + { - boost::asio::io_service& getIOService() - { - return ioService_; - } + work_ = std::unique_ptr<Work>(new Work(ioService_)); + auto temp_thread_ = new std::thread([this] { ioService_.run(); }); + thread_ = std::unique_ptr<std::thread>(temp_thread_); + } - void stop() - { + ProcessIoService(ProcessIoService const&) = delete; + ProcessIoService& operator=(ProcessIoService const&) = delete; - work_.reset(); + boost::asio::io_context& getIOService() + { + return ioService_; + } - thread_->join(); + void stop() + { - } + work_.reset(); - private: - IOService ioService_; - WorkPtr work_; - std::unique_ptr<std::thread> thread_; + thread_->join(); + } - }; +private: + IOService ioService_; + WorkPtr work_; + std::unique_ptr<std::thread> thread_; +}; -} +} // namespace lsp diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ProtocolJsonHandler.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ProtocolJsonHandler.h index f6097fe172..11483e6c6b 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ProtocolJsonHandler.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ProtocolJsonHandler.h @@ -1,11 +1,12 @@ #pragma once #include "LibLsp/JsonRpc/MessageJsonHandler.h" -namespace lsp { - class ProtocolJsonHandler : public MessageJsonHandler - { - public: - ProtocolJsonHandler(); - }; +namespace lsp +{ +class ProtocolJsonHandler : public MessageJsonHandler +{ +public: + ProtocolJsonHandler(); +}; -} +} // namespace lsp diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ResourceOperation.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ResourceOperation.h index 3d317a8153..0fe3c9f37b 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/ResourceOperation.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/ResourceOperation.h @@ -5,117 +5,119 @@ #include "lsDocumentUri.h" #include "LibLsp/lsp/lsAny.h" #include "LibLsp/lsp/lsTextEdit.h" -struct ResourceOperation { - std::string kind; - virtual ~ResourceOperation() = default; +struct ResourceOperation +{ + std::string kind; + virtual ~ResourceOperation() = default; - MAKE_SWAP_METHOD(ResourceOperation, kind); + MAKE_SWAP_METHOD(ResourceOperation, kind); }; MAKE_REFLECT_STRUCT(ResourceOperation, kind); extern void Reflect(Writer& visitor, ResourceOperation* value); -struct CreateFileOptions{ +struct CreateFileOptions +{ - /** + /** * Overwrite existing file. Overwrite wins over `ignoreIfExists` */ - optional<bool> overwrite = false; + optional<bool> overwrite = false; - /** + /** * Ignore if exists. */ - optional< bool> ignoreIfExists =false; + optional<bool> ignoreIfExists = false; - MAKE_SWAP_METHOD(CreateFileOptions, overwrite, ignoreIfExists) + MAKE_SWAP_METHOD(CreateFileOptions, overwrite, ignoreIfExists) }; MAKE_REFLECT_STRUCT(CreateFileOptions, overwrite, ignoreIfExists) -struct lsCreateFile :public ResourceOperation { +struct lsCreateFile : public ResourceOperation +{ - /** + /** * The resource to create. */ - lsCreateFile(); - lsDocumentUri uri; + lsCreateFile(); + lsDocumentUri uri; - /** + /** * Additional options */ - optional<CreateFileOptions> options; + optional<CreateFileOptions> options; - - /** + /** * An optional annotation identifer describing the operation. * * @since 3.16.0 */ - optional<lsChangeAnnotationIdentifier> annotationId; + optional<lsChangeAnnotationIdentifier> annotationId; - MAKE_SWAP_METHOD(lsCreateFile, kind, uri, options, annotationId) + MAKE_SWAP_METHOD(lsCreateFile, kind, uri, options, annotationId) }; -MAKE_REFLECT_STRUCT(lsCreateFile, kind, uri,options, annotationId) - +MAKE_REFLECT_STRUCT(lsCreateFile, kind, uri, options, annotationId) -struct DeleteFileOptions { - /** +struct DeleteFileOptions +{ + /** * Delete the content recursively if a folder is denoted. */ - optional<bool> recursive = false; + optional<bool> recursive = false; - /** + /** * Ignore the operation if the file doesn't exist. */ - optional<bool> ignoreIfNotExists = false; + optional<bool> ignoreIfNotExists = false; - - MAKE_SWAP_METHOD(DeleteFileOptions, recursive, ignoreIfNotExists); + MAKE_SWAP_METHOD(DeleteFileOptions, recursive, ignoreIfNotExists); }; MAKE_REFLECT_STRUCT(DeleteFileOptions, recursive, ignoreIfNotExists) -struct lsDeleteFile :public ResourceOperation { - /** +struct lsDeleteFile : public ResourceOperation +{ + /** * The file to delete. */ - lsDeleteFile(); - lsDocumentUri uri; + lsDeleteFile(); + lsDocumentUri uri; - /** + /** * Delete options. */ - optional<DeleteFileOptions> options; + optional<DeleteFileOptions> options; - MAKE_SWAP_METHOD(lsDeleteFile, kind, uri, options); + MAKE_SWAP_METHOD(lsDeleteFile, kind, uri, options); }; -MAKE_REFLECT_STRUCT(lsDeleteFile, kind, uri,options); +MAKE_REFLECT_STRUCT(lsDeleteFile, kind, uri, options); -typedef CreateFileOptions RenameFileOptions; -struct lsRenameFile :public ResourceOperation { - /** +typedef CreateFileOptions RenameFileOptions; +struct lsRenameFile : public ResourceOperation +{ + /** * The old (existing) location. */ - lsRenameFile(); - lsDocumentUri oldUri; + lsRenameFile(); + lsDocumentUri oldUri; - /** + /** * The new location. */ - lsDocumentUri newUri; + lsDocumentUri newUri; - /** + /** * Rename options. */ - optional<RenameFileOptions> options; + optional<RenameFileOptions> options; - /** + /** * An optional annotation identifer describing the operation. * * @since 3.16.0 */ - optional<lsChangeAnnotationIdentifier> annotationId; + optional<lsChangeAnnotationIdentifier> annotationId; - MAKE_SWAP_METHOD(lsRenameFile, kind, oldUri, newUri, options, annotationId) + MAKE_SWAP_METHOD(lsRenameFile, kind, oldUri, newUri, options, annotationId) }; MAKE_REFLECT_STRUCT(lsRenameFile, kind, oldUri, newUri, options, annotationId); - -extern ResourceOperation* GetResourceOperation(lsp::Any& lspAny); +extern ResourceOperation* GetResourceOperation(lsp::Any& lspAny); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/SimpleTimer.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/SimpleTimer.h index 3178d25d69..7b8f7f4265 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/SimpleTimer.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/SimpleTimer.h @@ -8,21 +8,22 @@ template<typename Duration = boost::posix_time::milliseconds> class SimpleTimer { public: - SimpleTimer(unsigned int duration,const std::function<void()>& _call_back) - :is_running_(true), call_back(_call_back), _deadline_timer(_ios, Duration(duration)) + SimpleTimer(unsigned int duration, std::function<void()> const& _call_back) + : is_running_(true), call_back(_call_back), _deadline_timer(_ios, Duration(duration)) { - _deadline_timer.async_wait([&](const boost::system::error_code& e) - { - if (e.value() == boost::asio::error::operation_aborted) - { - return; - } - if(is_running_.load(std::memory_order_relaxed)) + _deadline_timer.async_wait( + [&](boost::system::error_code const& e) { - call_back(); + if (e.value() == boost::asio::error::operation_aborted) + { + return; + } + if (is_running_.load(std::memory_order_relaxed)) + { + call_back(); + } } - - }); + ); _thread = std::thread([this] { _ios.run(); }); } ~SimpleTimer() @@ -38,12 +39,11 @@ public: _thread.join(); } } + private: std::atomic_bool is_running_; std::function<void()> call_back; - boost::asio::io_service _ios; + boost::asio::io_context _ios; boost::asio::deadline_timer _deadline_timer; std::thread _thread; - - }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/client/registerCapability.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/client/registerCapability.h index 60484db56a..f4431f0235 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/client/registerCapability.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/client/registerCapability.h @@ -6,24 +6,24 @@ * General parameters to register for a capability. */ -struct Registration { - static Registration Create(const std::string& method); - /** +struct Registration +{ + static Registration Create(std::string const& method); + /** * The id used to register the request. The id can be used to deregister * the request again. */ - std::string id; + std::string id; - /** + /** * The method / capability to register for. */ - std::string method; + std::string method; - MAKE_SWAP_METHOD(Registration, id, method); + MAKE_SWAP_METHOD(Registration, id, method); }; - MAKE_REFLECT_STRUCT(Registration, id, method); /** @@ -35,8 +35,8 @@ MAKE_REFLECT_STRUCT(Registration, id, method); */ struct RegistrationParams { - std::vector<Registration> registrations; - MAKE_SWAP_METHOD(RegistrationParams, registrations); + std::vector<Registration> registrations; + MAKE_SWAP_METHOD(RegistrationParams, registrations); }; /** * The client/registerCapability request is sent from the server to the client @@ -46,4 +46,4 @@ struct RegistrationParams */ MAKE_REFLECT_STRUCT(RegistrationParams, registrations); -DEFINE_REQUEST_RESPONSE_TYPE(Req_ClientRegisterCapability, RegistrationParams,JsonNull, "client/registerCapability"); +DEFINE_REQUEST_RESPONSE_TYPE(Req_ClientRegisterCapability, RegistrationParams, JsonNull, "client/registerCapability"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/client/unregisterCapability.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/client/unregisterCapability.h index 33bf9d1db6..f70dfd639c 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/client/unregisterCapability.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/client/unregisterCapability.h @@ -9,21 +9,22 @@ * General parameters to unregister a capability. */ -struct Unregistration { - /** +struct Unregistration +{ + /** * The id used to unregister the request or notification. Usually an id * provided during the register request. */ - std::string id; + std::string id; - /** + /** * The method / capability to unregister for. */ - std::string method; + std::string method; - MAKE_SWAP_METHOD(Unregistration, id, method); + MAKE_SWAP_METHOD(Unregistration, id, method); }; MAKE_REFLECT_STRUCT(Unregistration, id, method); /** @@ -32,10 +33,12 @@ MAKE_REFLECT_STRUCT(Unregistration, id, method); */ struct UnregistrationParams { - std::vector<Unregistration> unregisterations; - MAKE_SWAP_METHOD(UnregistrationParams, unregisterations); + std::vector<Unregistration> unregisterations; + MAKE_SWAP_METHOD(UnregistrationParams, unregisterations); }; MAKE_REFLECT_STRUCT(UnregistrationParams, unregisterations); -DEFINE_REQUEST_RESPONSE_TYPE(Req_ClientUnregisterCapability, UnregistrationParams,JsonNull, "client/unregisterCapability"); +DEFINE_REQUEST_RESPONSE_TYPE( + Req_ClientUnregisterCapability, UnregistrationParams, JsonNull, "client/unregisterCapability" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/Move.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/Move.h index c0beb625f2..af64f2ba2e 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/Move.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/Move.h @@ -7,8 +7,4 @@ #include "getMoveDestinations.h" #include "getRefactorEdit.h" - DEFINE_REQUEST_RESPONSE_TYPE(java_move, MoveParams, RefactorWorkspaceEdit, "java/move"); - - - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/OverridableMethod.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/OverridableMethod.h index dd0ada60cc..2e577d3915 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/OverridableMethod.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/OverridableMethod.h @@ -4,31 +4,31 @@ #include <string> struct OverridableMethod { - std::string bindingKey; - std::string name; - std::vector<std::string> parameters; - bool unimplemented = false; - std::string declaringClass; - std::string declaringClassType; + std::string bindingKey; + std::string name; + std::vector<std::string> parameters; + bool unimplemented = false; + std::string declaringClass; + std::string declaringClassType; - void swap(OverridableMethod& arg) noexcept - { - bindingKey.swap(arg.bindingKey); - name.swap(arg.name); - parameters.swap(arg.parameters); - declaringClass.swap(arg.declaringClass); - declaringClassType.swap(arg.declaringClassType); - std::swap(unimplemented, arg.unimplemented); - } + void swap(OverridableMethod& arg) noexcept + { + bindingKey.swap(arg.bindingKey); + name.swap(arg.name); + parameters.swap(arg.parameters); + declaringClass.swap(arg.declaringClass); + declaringClassType.swap(arg.declaringClassType); + std::swap(unimplemented, arg.unimplemented); + } }; MAKE_REFLECT_STRUCT(OverridableMethod, bindingKey, name, parameters, unimplemented, declaringClass, declaringClassType); -struct OverridableMethodsResponse +struct OverridableMethodsResponse { - std::string type; - std::vector<OverridableMethod> methods; + std::string type; + std::vector<OverridableMethod> methods; - MAKE_SWAP_METHOD(OverridableMethodsResponse, type, methods) + MAKE_SWAP_METHOD(OverridableMethodsResponse, type, methods) }; MAKE_REFLECT_STRUCT(OverridableMethodsResponse, type, methods) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/WorkspaceSymbolParams.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/WorkspaceSymbolParams.h index c8ddbe3c01..c49c8c72f6 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/WorkspaceSymbolParams.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/WorkspaceSymbolParams.h @@ -3,11 +3,9 @@ #include "LibLsp/JsonRpc/serializer.h" #include <string> - -struct WorkspaceSymbolParams +struct WorkspaceSymbolParams { - std::string query; - MAKE_SWAP_METHOD(WorkspaceSymbolParams, query); + std::string query; + MAKE_SWAP_METHOD(WorkspaceSymbolParams, query); }; MAKE_REFLECT_STRUCT(WorkspaceSymbolParams, query); - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/addOverridableMethods.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/addOverridableMethods.h index 527b3b1827..2d8d90e2e1 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/addOverridableMethods.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/addOverridableMethods.h @@ -5,15 +5,16 @@ #include "LibLsp/lsp/CodeActionParams.h" #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" -struct AddOverridableMethodParams { - lsCodeActionParams context; - std::vector<OverridableMethod> overridableMethods; +struct AddOverridableMethodParams +{ + lsCodeActionParams context; + std::vector<OverridableMethod> overridableMethods; - MAKE_SWAP_METHOD(AddOverridableMethodParams, context, overridableMethods); + MAKE_SWAP_METHOD(AddOverridableMethodParams, context, overridableMethods); }; MAKE_REFLECT_STRUCT(AddOverridableMethodParams, context, overridableMethods); -DEFINE_REQUEST_RESPONSE_TYPE(java_addOverridableMethods, AddOverridableMethodParams, lsWorkspaceEdit, "java/addOverridableMethods"); - - +DEFINE_REQUEST_RESPONSE_TYPE( + java_addOverridableMethods, AddOverridableMethodParams, lsWorkspaceEdit, "java/addOverridableMethods" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/buildWorkspace.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/buildWorkspace.h index 4809e360bb..72d457e8d7 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/buildWorkspace.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/buildWorkspace.h @@ -4,13 +4,13 @@ #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" +enum class BuildWorkspaceStatus : uint8_t +{ - - - -enum class BuildWorkspaceStatus : uint8_t{ - - FAILED, SUCCEED, WITH_ERROR, CANCELLED, + FAILED, + SUCCEED, + WITH_ERROR, + CANCELLED, }; MAKE_REFLECT_TYPE_PROXY(BuildWorkspaceStatus) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkConstructorsStatus.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkConstructorsStatus.h index acb1e4caa6..aa34302ddd 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkConstructorsStatus.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkConstructorsStatus.h @@ -5,25 +5,24 @@ #include "LibLsp/lsp/CodeActionParams.h" #include "checkHashCodeEqualsStatus.h" -struct LspMethodBinding { - std::string bindingKey; - std::string name; - std::vector< std::string> parameters; +struct LspMethodBinding +{ + std::string bindingKey; + std::string name; + std::vector<std::string> parameters; - MAKE_SWAP_METHOD(LspMethodBinding, bindingKey, name, parameters); + MAKE_SWAP_METHOD(LspMethodBinding, bindingKey, name, parameters); }; MAKE_REFLECT_STRUCT(LspMethodBinding, bindingKey, name, parameters); - -struct CheckConstructorsResponse { - std::vector<LspMethodBinding> constructors; - std::vector<LspVariableBinding> fields; - MAKE_SWAP_METHOD(CheckConstructorsResponse, constructors, fields) +struct CheckConstructorsResponse +{ + std::vector<LspMethodBinding> constructors; + std::vector<LspVariableBinding> fields; + MAKE_SWAP_METHOD(CheckConstructorsResponse, constructors, fields) }; -MAKE_REFLECT_STRUCT(CheckConstructorsResponse, constructors,fields) - -DEFINE_REQUEST_RESPONSE_TYPE(java_checkConstructorsStatus, lsCodeActionParams, CheckConstructorsResponse,"java/checkConstructorsStatus") - - - +MAKE_REFLECT_STRUCT(CheckConstructorsResponse, constructors, fields) +DEFINE_REQUEST_RESPONSE_TYPE( + java_checkConstructorsStatus, lsCodeActionParams, CheckConstructorsResponse, "java/checkConstructorsStatus" +) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkDelegateMethodsStatus.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkDelegateMethodsStatus.h index 68a7ed6606..0d9d3528d1 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkDelegateMethodsStatus.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkDelegateMethodsStatus.h @@ -7,23 +7,23 @@ #include "checkHashCodeEqualsStatus.h" #include "checkConstructorsStatus.h" -struct LspDelegateField { - LspVariableBinding field; - std::vector<LspMethodBinding> delegateMethods; +struct LspDelegateField +{ + LspVariableBinding field; + std::vector<LspMethodBinding> delegateMethods; - MAKE_SWAP_METHOD(LspDelegateField, field, delegateMethods); + MAKE_SWAP_METHOD(LspDelegateField, field, delegateMethods); }; MAKE_REFLECT_STRUCT(LspDelegateField, field, delegateMethods); +struct CheckDelegateMethodsResponse +{ + std::vector<LspDelegateField> delegateFields; -struct CheckDelegateMethodsResponse { - std::vector<LspDelegateField> delegateFields; - - MAKE_SWAP_METHOD(CheckDelegateMethodsResponse, delegateFields) + MAKE_SWAP_METHOD(CheckDelegateMethodsResponse, delegateFields) }; MAKE_REFLECT_STRUCT(CheckDelegateMethodsResponse, delegateFields) -DEFINE_REQUEST_RESPONSE_TYPE(java_checkDelegateMethodsStatus, - lsCodeActionParams, CheckDelegateMethodsResponse, "java/checkDelegateMethodsStatus"); - - +DEFINE_REQUEST_RESPONSE_TYPE( + java_checkDelegateMethodsStatus, lsCodeActionParams, CheckDelegateMethodsResponse, "java/checkDelegateMethodsStatus" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkHashCodeEqualsStatus.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkHashCodeEqualsStatus.h index 88731c29b5..43b6cce924 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkHashCodeEqualsStatus.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkHashCodeEqualsStatus.h @@ -7,30 +7,31 @@ #include "LibLsp/lsp/CodeActionParams.h" -struct LspVariableBinding { - std::string bindingKey; - std::string name; - std::string type; - bool isField; - void swap(LspVariableBinding& arg) noexcept - { - bindingKey.swap(arg.bindingKey); - name.swap(arg.name); - type.swap(arg.type); - std::swap(isField, arg.isField); - } +struct LspVariableBinding +{ + std::string bindingKey; + std::string name; + std::string type; + bool isField; + void swap(LspVariableBinding& arg) noexcept + { + bindingKey.swap(arg.bindingKey); + name.swap(arg.name); + type.swap(arg.type); + std::swap(isField, arg.isField); + } }; MAKE_REFLECT_STRUCT(LspVariableBinding, bindingKey, name, type, isField) -struct CheckHashCodeEqualsResponse { - std::string type; - std::vector<LspVariableBinding> fields; - std::vector<std::string> existingMethods; - MAKE_SWAP_METHOD(CheckHashCodeEqualsResponse, type, fields, type, existingMethods) +struct CheckHashCodeEqualsResponse +{ + std::string type; + std::vector<LspVariableBinding> fields; + std::vector<std::string> existingMethods; + MAKE_SWAP_METHOD(CheckHashCodeEqualsResponse, type, fields, type, existingMethods) }; MAKE_REFLECT_STRUCT(CheckHashCodeEqualsResponse, type, fields, type, existingMethods) -DEFINE_REQUEST_RESPONSE_TYPE(java_checkHashCodeEqualsStatus, - lsCodeActionParams, CheckHashCodeEqualsResponse, "java/checkHashCodeEqualsStatus") - - +DEFINE_REQUEST_RESPONSE_TYPE( + java_checkHashCodeEqualsStatus, lsCodeActionParams, CheckHashCodeEqualsResponse, "java/checkHashCodeEqualsStatus" +) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkToStringStatus.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkToStringStatus.h index cadb5ba7dd..8af76126b5 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkToStringStatus.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkToStringStatus.h @@ -5,20 +5,20 @@ #include "LibLsp/lsp/CodeActionParams.h" #include "checkHashCodeEqualsStatus.h" -struct CheckToStringResponse { - std::string type; - std::vector<LspVariableBinding> fields; - bool exists; - void swap(CheckToStringResponse& arg) noexcept - { - type.swap(arg.type); - fields.swap(arg.fields); - std::swap(exists, arg.exists); - } +struct CheckToStringResponse +{ + std::string type; + std::vector<LspVariableBinding> fields; + bool exists; + void swap(CheckToStringResponse& arg) noexcept + { + type.swap(arg.type); + fields.swap(arg.fields); + std::swap(exists, arg.exists); + } }; -MAKE_REFLECT_STRUCT(CheckToStringResponse,type,fields,exists) - -DEFINE_REQUEST_RESPONSE_TYPE(java_checkToStringStatus, - lsCodeActionParams, CheckToStringResponse ,"java/checkToStringStatus") - +MAKE_REFLECT_STRUCT(CheckToStringResponse, type, fields, exists) +DEFINE_REQUEST_RESPONSE_TYPE( + java_checkToStringStatus, lsCodeActionParams, CheckToStringResponse, "java/checkToStringStatus" +) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/classFileContents.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/classFileContents.h index 70eb121b99..9c859433df 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/classFileContents.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/classFileContents.h @@ -6,5 +6,4 @@ #include <string> #include "LibLsp/lsp/lsTextDocumentIdentifier.h" -DEFINE_REQUEST_RESPONSE_TYPE(java_classFileContents, lsTextDocumentIdentifier, std::string ,"java/classFileContents"); - +DEFINE_REQUEST_RESPONSE_TYPE(java_classFileContents, lsTextDocumentIdentifier, std::string, "java/classFileContents"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/codeActionResult.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/codeActionResult.h index c0195908d0..668d477497 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/codeActionResult.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/codeActionResult.h @@ -7,9 +7,10 @@ #include <set> #include "LibLsp/lsp/textDocument/code_action.h" -namespace SourceAssistProcessor { +namespace SourceAssistProcessor +{ - /*std::set<std::string> UNSUPPORTED_RESOURCES = { "module-info.java", "package-info.java" +/*std::set<std::string> UNSUPPORTED_RESOURCES = { "module-info.java", "package-info.java" };*/ // static const char* COMMAND_ID_ACTION_OVERRIDEMETHODSPROMPT = "java.action.overrideMethodsPrompt"; @@ -19,4 +20,4 @@ namespace SourceAssistProcessor { // static const char* COMMAND_ID_ACTION_GENERATEACCESSORSPROMPT = "java.action.generateAccessorsPrompt"; // static const char* COMMAND_ID_ACTION_GENERATECONSTRUCTORSPROMPT = "java.action.generateConstructorsPrompt"; // static const char* COMMAND_ID_ACTION_GENERATEDELEGATEMETHODSPROMPT = "java.action.generateDelegateMethodsPrompt"; -}; +}; // namespace SourceAssistProcessor diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/executeCommand.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/executeCommand.h index 19479adfaf..8585a1d091 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/executeCommand.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/executeCommand.h @@ -4,7 +4,7 @@ #include <string> #include "LibLsp/lsp/lsWorkspaceEdit.h" #include "LibLsp/lsp/ExecuteCommandParams.h" -namespace buildpath +namespace buildpath { // static const char* EDIT_ORGNIZEIMPORTS = "java.edit.organizeImports"; // static const char* RESOLVE_SOURCE_ATTACHMENT = "java.project.resolveSourceAttachment"; @@ -16,14 +16,12 @@ namespace buildpath // static const char* REMOVE_FROM_SOURCEPATH = "java.project.removeFromSourcePath"; // static const char* LIST_SOURCEPATHS = "java.project.listSourcePaths"; - struct Result { - bool status; - std::string message; - }; - - - -} +struct Result +{ + bool status; + std::string message; +}; +} // namespace buildpath DEFINE_REQUEST_RESPONSE_TYPE(java_executeCommand, ExecuteCommandParams, lsWorkspaceEdit, "java/executeCommand"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/findLinks.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/findLinks.h index fd470b17c8..413fe1bded 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/findLinks.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/findLinks.h @@ -7,16 +7,14 @@ #include "getRefactorEdit.h" #include "LibLsp/lsp/lsTextDocumentPositionParams.h" -struct FindLinksParams { - // Supported link types: superImplementation - std::string type; - lsTextDocumentPositionParams position; +struct FindLinksParams +{ + // Supported link types: superImplementation + std::string type; + lsTextDocumentPositionParams position; - MAKE_SWAP_METHOD(FindLinksParams, type, position) + MAKE_SWAP_METHOD(FindLinksParams, type, position) }; -MAKE_REFLECT_STRUCT(FindLinksParams,type,position) - -DEFINE_REQUEST_RESPONSE_TYPE(java_findLinks, FindLinksParams,lsp::Any, "java/findLinks"); - - +MAKE_REFLECT_STRUCT(FindLinksParams, type, position) +DEFINE_REQUEST_RESPONSE_TYPE(java_findLinks, FindLinksParams, lsp::Any, "java/findLinks"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateAccessors.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateAccessors.h index 82013096c7..e8b7d94c3c 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateAccessors.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateAccessors.h @@ -6,14 +6,15 @@ #include "checkHashCodeEqualsStatus.h" #include "resolveUnimplementedAccessors.h" +struct GenerateAccessorsParams +{ + lsCodeActionParams context; + std::vector<AccessorField> accessors; -struct GenerateAccessorsParams { - lsCodeActionParams context; - std::vector<AccessorField> accessors; - - - MAKE_SWAP_METHOD(GenerateAccessorsParams, context, accessors) + MAKE_SWAP_METHOD(GenerateAccessorsParams, context, accessors) }; MAKE_REFLECT_STRUCT(GenerateAccessorsParams, context, accessors) -DEFINE_REQUEST_RESPONSE_TYPE(java_generateAccessors, GenerateAccessorsParams, lsWorkspaceEdit, "java/generateAccessors"); +DEFINE_REQUEST_RESPONSE_TYPE( + java_generateAccessors, GenerateAccessorsParams, lsWorkspaceEdit, "java/generateAccessors" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateConstructors.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateConstructors.h index 157fefed79..fe0266f026 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateConstructors.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateConstructors.h @@ -6,14 +6,15 @@ #include "checkHashCodeEqualsStatus.h" #include "checkConstructorsStatus.h" - -struct GenerateConstructorsParams { - lsCodeActionParams context; - std::vector<LspMethodBinding> constructors; - std::vector< LspVariableBinding >fields; - MAKE_SWAP_METHOD(GenerateConstructorsParams, context, fields) +struct GenerateConstructorsParams +{ + lsCodeActionParams context; + std::vector<LspMethodBinding> constructors; + std::vector<LspVariableBinding> fields; + MAKE_SWAP_METHOD(GenerateConstructorsParams, context, fields) }; MAKE_REFLECT_STRUCT(GenerateConstructorsParams, context, fields) -DEFINE_REQUEST_RESPONSE_TYPE(java_generateConstructors, GenerateConstructorsParams, lsWorkspaceEdit, "java/generateConstructors"); - +DEFINE_REQUEST_RESPONSE_TYPE( + java_generateConstructors, GenerateConstructorsParams, lsWorkspaceEdit, "java/generateConstructors" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateDelegateMethods.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateDelegateMethods.h index c6b4729378..240dd0cd41 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateDelegateMethods.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateDelegateMethods.h @@ -6,20 +6,22 @@ #include "checkHashCodeEqualsStatus.h" #include "checkConstructorsStatus.h" -struct LspDelegateEntry { - LspVariableBinding field; - LspMethodBinding delegateMethod; - MAKE_SWAP_METHOD(LspDelegateEntry, field, delegateMethod); +struct LspDelegateEntry +{ + LspVariableBinding field; + LspMethodBinding delegateMethod; + MAKE_SWAP_METHOD(LspDelegateEntry, field, delegateMethod); }; MAKE_REFLECT_STRUCT(LspDelegateEntry, field, delegateMethod); - -struct GenerateDelegateMethodsParams { - lsCodeActionParams context; - std::vector<LspDelegateEntry> delegateEntries; - MAKE_SWAP_METHOD(GenerateDelegateMethodsParams, context, delegateEntries) +struct GenerateDelegateMethodsParams +{ + lsCodeActionParams context; + std::vector<LspDelegateEntry> delegateEntries; + MAKE_SWAP_METHOD(GenerateDelegateMethodsParams, context, delegateEntries) }; MAKE_REFLECT_STRUCT(GenerateDelegateMethodsParams, context, delegateEntries) -DEFINE_REQUEST_RESPONSE_TYPE(java_generateDelegateMethods, GenerateDelegateMethodsParams, lsWorkspaceEdit, "java/generateDelegateMethods"); - +DEFINE_REQUEST_RESPONSE_TYPE( + java_generateDelegateMethods, GenerateDelegateMethodsParams, lsWorkspaceEdit, "java/generateDelegateMethods" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateHashCodeEquals.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateHashCodeEquals.h index 0881d305b1..f6622c5ee4 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateHashCodeEquals.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateHashCodeEquals.h @@ -7,19 +7,20 @@ #include "LibLsp/lsp/CodeActionParams.h" #include "checkHashCodeEqualsStatus.h" -struct GenerateHashCodeEqualsParams { - lsCodeActionParams context; - std::vector<LspVariableBinding> fields; - bool regenerate= false; - void swap(GenerateHashCodeEqualsParams& arg) noexcept - { - context.swap(arg.context); - fields.swap(arg.fields); - std::swap(regenerate, arg.regenerate); - } +struct GenerateHashCodeEqualsParams +{ + lsCodeActionParams context; + std::vector<LspVariableBinding> fields; + bool regenerate = false; + void swap(GenerateHashCodeEqualsParams& arg) noexcept + { + context.swap(arg.context); + fields.swap(arg.fields); + std::swap(regenerate, arg.regenerate); + } }; MAKE_REFLECT_STRUCT(GenerateHashCodeEqualsParams, context, fields, regenerate); -DEFINE_REQUEST_RESPONSE_TYPE(java_generateHashCodeEquals, GenerateHashCodeEqualsParams, lsWorkspaceEdit, "java/generateHashCodeEquals") - - +DEFINE_REQUEST_RESPONSE_TYPE( + java_generateHashCodeEquals, GenerateHashCodeEqualsParams, lsWorkspaceEdit, "java/generateHashCodeEquals" +) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateToString.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateToString.h index 5e5324a59b..53747a8ca2 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateToString.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateToString.h @@ -5,13 +5,12 @@ #include <string> #include "checkHashCodeEqualsStatus.h" +struct GenerateToStringParams +{ + lsCodeActionParams context; + std::vector<LspVariableBinding> fields; -struct GenerateToStringParams { - lsCodeActionParams context; - std::vector< LspVariableBinding >fields; - - MAKE_SWAP_METHOD(GenerateToStringParams, context, fields) - + MAKE_SWAP_METHOD(GenerateToStringParams, context, fields) }; MAKE_REFLECT_STRUCT(GenerateToStringParams, context, fields) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getMoveDestinations.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getMoveDestinations.h index 8fbe2caa8d..3232d22ba0 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getMoveDestinations.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getMoveDestinations.h @@ -8,58 +8,59 @@ struct MoveKindInfo { - static std::string moveResource() - { - return "moveResource"; - } - static std::string moveInstanceMethod() - { - return "moveInstanceMethod"; - } - static std::string moveStaticMember() - { - return "moveStaticMember"; - } + static std::string moveResource() + { + return "moveResource"; + } + static std::string moveInstanceMethod() + { + return "moveInstanceMethod"; + } + static std::string moveStaticMember() + { + return "moveStaticMember"; + } }; -struct MoveParams { - /** +struct MoveParams +{ + /** * The supported move kind: moveResource, moveInstanceMethod, moveStaticMember, * moveTypeToNewFile. */ - std::string moveKind; - /** + std::string moveKind; + /** * The selected resource uris when the move operation is triggered. */ - std::vector<std::string> sourceUris; - /** + std::vector<std::string> sourceUris; + /** * The code action params when the move operation is triggered. */ - optional<lsCodeActionParams> params; - /** + optional<lsCodeActionParams> params; + /** * The possible destination: a folder/package, class, instanceDeclaration. */ - lsp::Any destination; - bool updateReferences; - void swap(MoveParams& arg) noexcept - { - moveKind.swap(arg.moveKind); - sourceUris.swap(arg.sourceUris); - params.swap(arg.params); - destination.swap(arg.destination); - std::swap(updateReferences, arg.updateReferences); - } + lsp::Any destination; + bool updateReferences; + void swap(MoveParams& arg) noexcept + { + moveKind.swap(arg.moveKind); + sourceUris.swap(arg.sourceUris); + params.swap(arg.params); + destination.swap(arg.destination); + std::swap(updateReferences, arg.updateReferences); + } }; MAKE_REFLECT_STRUCT(MoveParams, moveKind, sourceUris, params, destination, updateReferences); -struct MoveDestinationsResponse { - std::string errorMessage; - std::vector<lsp::Any > destinations; - MAKE_SWAP_METHOD(MoveDestinationsResponse, errorMessage, destinations); +struct MoveDestinationsResponse +{ + std::string errorMessage; + std::vector<lsp::Any> destinations; + MAKE_SWAP_METHOD(MoveDestinationsResponse, errorMessage, destinations); }; MAKE_REFLECT_STRUCT(MoveDestinationsResponse, errorMessage, destinations); -DEFINE_REQUEST_RESPONSE_TYPE(java_getMoveDestinations, MoveParams, MoveDestinationsResponse, "java/getMoveDestinations"); - - - +DEFINE_REQUEST_RESPONSE_TYPE( + java_getMoveDestinations, MoveParams, MoveDestinationsResponse, "java/getMoveDestinations" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getRefactorEdit.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getRefactorEdit.h index 23549ecbcc..7d0021914f 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getRefactorEdit.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getRefactorEdit.h @@ -3,8 +3,6 @@ #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" - - #include <string> #include <vector> #include "WorkspaceSymbolParams.h" @@ -12,66 +10,64 @@ #include "LibLsp/lsp/textDocument/code_action.h" #include "LibLsp/lsp/lsFormattingOptions.h" -namespace -RefactorProposalUtility +namespace RefactorProposalUtility { - extern const char* APPLY_REFACTORING_COMMAND_ID; - extern const char* EXTRACT_VARIABLE_ALL_OCCURRENCE_COMMAND; - extern const char* EXTRACT_VARIABLE_COMMAND; - extern const char* EXTRACT_CONSTANT_COMMAND; - extern const char* EXTRACT_METHOD_COMMAND; - extern const char* EXTRACT_FIELD_COMMAND; - extern const char* CONVERT_VARIABLE_TO_FIELD_COMMAND; - extern const char* MOVE_FILE_COMMAND; - extern const char* MOVE_INSTANCE_METHOD_COMMAND; - extern const char* MOVE_STATIC_MEMBER_COMMAND; - extern const char* MOVE_TYPE_COMMAND; -}; - - -struct RenamePosition { - lsDocumentUri uri; - int offset = 0; - int length = 0; - void swap(RenamePosition& arg) noexcept - { - uri.swap(arg.uri); - std::swap(offset, arg.offset); - std::swap(length, arg.length); - } +extern char const* APPLY_REFACTORING_COMMAND_ID; +extern char const* EXTRACT_VARIABLE_ALL_OCCURRENCE_COMMAND; +extern char const* EXTRACT_VARIABLE_COMMAND; +extern char const* EXTRACT_CONSTANT_COMMAND; +extern char const* EXTRACT_METHOD_COMMAND; +extern char const* EXTRACT_FIELD_COMMAND; +extern char const* CONVERT_VARIABLE_TO_FIELD_COMMAND; +extern char const* MOVE_FILE_COMMAND; +extern char const* MOVE_INSTANCE_METHOD_COMMAND; +extern char const* MOVE_STATIC_MEMBER_COMMAND; +extern char const* MOVE_TYPE_COMMAND; +}; // namespace RefactorProposalUtility + +struct RenamePosition +{ + lsDocumentUri uri; + int offset = 0; + int length = 0; + void swap(RenamePosition& arg) noexcept + { + uri.swap(arg.uri); + std::swap(offset, arg.offset); + std::swap(length, arg.length); + } }; MAKE_REFLECT_STRUCT(RenamePosition, uri, offset, length); struct GetRefactorEditParams { - std::string command; - std::vector<lsp::Any> commandArguments; - lsCodeActionParams context; - optional<lsFormattingOptions> options; - MAKE_SWAP_METHOD(GetRefactorEditParams, command, context, options); + std::string command; + std::vector<lsp::Any> commandArguments; + lsCodeActionParams context; + optional<lsFormattingOptions> options; + MAKE_SWAP_METHOD(GetRefactorEditParams, command, context, options); }; MAKE_REFLECT_STRUCT(GetRefactorEditParams, command, context, options); - - - -struct RefactorWorkspaceEdit { - /** +struct RefactorWorkspaceEdit +{ + /** * The workspace edit this code action performs. */ - lsWorkspaceEdit edit; - /** + lsWorkspaceEdit edit; + /** * A command this code action executes. If a code action provides a edit and a * command, first the edit is executed and then the command. */ - optional<std::string> errorMessage; + optional<std::string> errorMessage; - optional < lsCommandWithAny > command; + optional<lsCommandWithAny> command; - MAKE_SWAP_METHOD(RefactorWorkspaceEdit, edit, command, errorMessage) + MAKE_SWAP_METHOD(RefactorWorkspaceEdit, edit, command, errorMessage) }; -MAKE_REFLECT_STRUCT(RefactorWorkspaceEdit,edit,command,errorMessage) - -DEFINE_REQUEST_RESPONSE_TYPE(java_getRefactorEdit, GetRefactorEditParams, RefactorWorkspaceEdit, "java/getRefactorEdit"); +MAKE_REFLECT_STRUCT(RefactorWorkspaceEdit, edit, command, errorMessage) +DEFINE_REQUEST_RESPONSE_TYPE( + java_getRefactorEdit, GetRefactorEditParams, RefactorWorkspaceEdit, "java/getRefactorEdit" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/listOverridableMethods.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/listOverridableMethods.h index 13b73ce5c2..9c5205f359 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/listOverridableMethods.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/listOverridableMethods.h @@ -6,12 +6,6 @@ #include "LibLsp/lsp/CodeActionParams.h" #include "OverridableMethod.h" - - - - -DEFINE_REQUEST_RESPONSE_TYPE(java_listOverridableMethods, lsCodeActionParams, OverridableMethodsResponse, "java/listOverridableMethods"); - - - - +DEFINE_REQUEST_RESPONSE_TYPE( + java_listOverridableMethods, lsCodeActionParams, OverridableMethodsResponse, "java/listOverridableMethods" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/organizeImports.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/organizeImports.h index 817d52d32b..01c10f4452 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/organizeImports.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/organizeImports.h @@ -5,8 +5,4 @@ #include "LibLsp/lsp/CodeActionParams.h" - - DEFINE_REQUEST_RESPONSE_TYPE(java_organizeImports, lsCodeActionParams, lsWorkspaceEdit, "java/organizeImports"); - - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/projectConfigurationUpdate.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/projectConfigurationUpdate.h index 342d167093..724ea0f392 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/projectConfigurationUpdate.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/projectConfigurationUpdate.h @@ -2,7 +2,6 @@ #include "LibLsp/JsonRpc/NotificationInMessage.h" - #include <string> #include <vector> #include "WorkspaceSymbolParams.h" @@ -10,4 +9,3 @@ #include "LibLsp/lsp/lsTextDocumentIdentifier.h" DEFINE_NOTIFICATION_TYPE(java_projectConfigurationUpdate, lsTextDocumentIdentifier, "java/projectConfigurationUpdate"); - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/resolveUnimplementedAccessors.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/resolveUnimplementedAccessors.h index f8bd8a4f7a..32ca213525 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/resolveUnimplementedAccessors.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/resolveUnimplementedAccessors.h @@ -5,20 +5,24 @@ #include <string> #include "checkHashCodeEqualsStatus.h" - -struct AccessorField { - std::string fieldName; - bool isStatic =false; - bool generateGetter = false; - bool generateSetter = false; - void swap(AccessorField& arg) noexcept{ - fieldName.swap(arg.fieldName); - std::swap(isStatic, arg.isStatic); - std::swap(generateGetter, arg.generateGetter); - std::swap(generateSetter, arg.generateSetter); - } +struct AccessorField +{ + std::string fieldName; + bool isStatic = false; + bool generateGetter = false; + bool generateSetter = false; + void swap(AccessorField& arg) noexcept + { + fieldName.swap(arg.fieldName); + std::swap(isStatic, arg.isStatic); + std::swap(generateGetter, arg.generateGetter); + std::swap(generateSetter, arg.generateSetter); + } }; -MAKE_REFLECT_STRUCT(AccessorField, fieldName,isStatic,generateGetter,generateSetter) +MAKE_REFLECT_STRUCT(AccessorField, fieldName, isStatic, generateGetter, generateSetter) -DEFINE_REQUEST_RESPONSE_TYPE(java_resolveUnimplementedAccessors, lsCodeActionParams, std::vector<AccessorField>, "java/resolveUnimplementedAccessors"); +DEFINE_REQUEST_RESPONSE_TYPE( + java_resolveUnimplementedAccessors, lsCodeActionParams, std::vector<AccessorField>, + "java/resolveUnimplementedAccessors" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/searchSymbols.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/searchSymbols.h index 6639ad2cf4..5f5796ec77 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/searchSymbols.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/searchSymbols.h @@ -3,25 +3,21 @@ #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" - #include <string> #include <vector> #include "WorkspaceSymbolParams.h" #include "LibLsp/lsp/method_type.h" #include "LibLsp/lsp/symbol.h" - -struct SearchSymbolParams :public WorkspaceSymbolParams +struct SearchSymbolParams : public WorkspaceSymbolParams { - optional<std::string> projectName; - optional< bool >sourceOnly; - optional< int> maxResults; - MAKE_SWAP_METHOD(SearchSymbolParams, query, projectName, sourceOnly, maxResults); + optional<std::string> projectName; + optional<bool> sourceOnly; + optional<int> maxResults; + MAKE_SWAP_METHOD(SearchSymbolParams, query, projectName, sourceOnly, maxResults); }; MAKE_REFLECT_STRUCT(SearchSymbolParams, query, projectName, sourceOnly, maxResults); - -DEFINE_REQUEST_RESPONSE_TYPE(java_searchSymbols, SearchSymbolParams, std::vector<lsSymbolInformation>, "java/searchSymbols"); - - - +DEFINE_REQUEST_RESPONSE_TYPE( + java_searchSymbols, SearchSymbolParams, std::vector<lsSymbolInformation>, "java/searchSymbols" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h index 6752c40812..98f82608b8 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h @@ -9,168 +9,148 @@ struct LintRule { - std::string key; - std::string name; - - - std::string Display() const - { - return name + " (" + key + ")"; - } - bool activeByDefault = true; - optional<std::string> severity; - optional<std::string> type; - int icon_index = -1; - MAKE_SWAP_METHOD(LintRule, key, name, activeByDefault, severity, type); - + std::string key; + std::string name; + + std::string Display() const + { + return name + " (" + key + ")"; + } + bool activeByDefault = true; + optional<std::string> severity; + optional<std::string> type; + int icon_index = -1; + MAKE_SWAP_METHOD(LintRule, key, name, activeByDefault, severity, type); }; MAKE_REFLECT_STRUCT(LintRule, key, name, activeByDefault, severity, type); - -struct RuleParameter { - std::string name; - optional<std::string> description; - optional<std::string> defaultValue; - +struct RuleParameter +{ + std::string name; + optional<std::string> description; + optional<std::string> defaultValue; }; MAKE_REFLECT_STRUCT(RuleParameter, name, description, defaultValue); -struct ShowRuleDescriptionParams { - - optional<std::string> key; - - optional<std::string> name; +struct ShowRuleDescriptionParams +{ - optional<std::string> htmlDescription; + optional<std::string> key; - optional<std::string> type; + optional<std::string> name; - optional<std::string> severity; + optional<std::string> htmlDescription; - optional< std::vector<RuleParameter> > parameters; - MAKE_SWAP_METHOD(ShowRuleDescriptionParams, key, name, htmlDescription, type, severity, parameters) + optional<std::string> type; + optional<std::string> severity; + optional<std::vector<RuleParameter>> parameters; + MAKE_SWAP_METHOD(ShowRuleDescriptionParams, key, name, htmlDescription, type, severity, parameters) }; MAKE_REFLECT_STRUCT(ShowRuleDescriptionParams, key, name, htmlDescription, type, severity, parameters); - -struct GetJavaConfigResponse { - std::string projectRoot; - std::string sourceLevel; - std::vector<std::string> classpath; - bool isTest; - std::string vmLocation; - MAKE_SWAP_METHOD(GetJavaConfigResponse, projectRoot, sourceLevel, classpath, isTest, vmLocation); +struct GetJavaConfigResponse +{ + std::string projectRoot; + std::string sourceLevel; + std::vector<std::string> classpath; + bool isTest; + std::string vmLocation; + MAKE_SWAP_METHOD(GetJavaConfigResponse, projectRoot, sourceLevel, classpath, isTest, vmLocation); }; MAKE_REFLECT_STRUCT(GetJavaConfigResponse, projectRoot, sourceLevel, classpath, isTest, vmLocation); -struct SetTraceNotificationParams { - lsInitializeParams::lsTrace value; +struct SetTraceNotificationParams +{ + lsInitializeParams::lsTrace value; }; MAKE_REFLECT_STRUCT(SetTraceNotificationParams, value); +struct ServerConnectionSettings +{ -struct ServerConnectionSettings { - - std::string SONARCLOUD_URL = "https://sonarcloud.io"; - std::vector<std::string>SONARCLOUD_ALIAS = { "https://sonarqube.com", - "https://www.sonarqube.com", - "https://www.sonarcloud.io", - "https://sonarcloud.io" }; - - std::string connectionId; - std::string serverUrl; - std::string token; - optional<std::string> organizationKey; - MAKE_SWAP_METHOD(ServerConnectionSettings, connectionId, serverUrl, token, organizationKey) + std::string SONARCLOUD_URL = "https://sonarcloud.io"; + std::vector<std::string> SONARCLOUD_ALIAS = { + "https://sonarqube.com", "https://www.sonarqube.com", "https://www.sonarcloud.io", "https://sonarcloud.io" + }; + std::string connectionId; + std::string serverUrl; + std::string token; + optional<std::string> organizationKey; + MAKE_SWAP_METHOD(ServerConnectionSettings, connectionId, serverUrl, token, organizationKey) }; MAKE_REFLECT_STRUCT(ServerConnectionSettings, connectionId, serverUrl, token, organizationKey) struct RuleSetting { - bool IsOn(); - std::string level = "on"; - RuleSetting(bool activate); - RuleSetting() = default; - void toggle(); - void on() + bool IsOn(); + std::string level = "on"; + RuleSetting(bool activate); + RuleSetting() = default; + void toggle(); + void on() + { + level = "on"; + } + void off() + { + level = "off"; + } + void turn(bool activate) + { + if (activate) { - level = "on"; + on(); } - void off() + else { - level = "off"; + off(); } - void turn(bool activate) - { - if (activate) - { - on(); - } - else - { - off(); - } - } - optional< std::map<std::string, std::string > > parameters; + } + optional<std::map<std::string, std::string>> parameters; }; MAKE_REFLECT_STRUCT(RuleSetting, level, parameters) struct ConsoleParams { - optional < bool >showAnalyzerLogs; - optional < bool >showVerboseLogs; - MAKE_SWAP_METHOD(ConsoleParams, showAnalyzerLogs, showVerboseLogs) + optional<bool> showAnalyzerLogs; + optional<bool> showVerboseLogs; + MAKE_SWAP_METHOD(ConsoleParams, showAnalyzerLogs, showVerboseLogs) }; MAKE_REFLECT_STRUCT(ConsoleParams, showAnalyzerLogs, showVerboseLogs) struct SonarLintWorkspaceSettings { - optional < bool > disableTelemetry; - optional < std::map<std::string, ServerConnectionSettings> >connectedMode; - optional<std::map<std::string, RuleSetting>> rules; - optional<ConsoleParams> output; - - optional<std::string > pathToNodeExecutable; - - optional< std::map<std::string, std::string > > getConfigurationParameters(const std::string& ruleKey); + optional<bool> disableTelemetry; + optional<std::map<std::string, ServerConnectionSettings>> connectedMode; + optional<std::map<std::string, RuleSetting>> rules; + optional<ConsoleParams> output; + optional<std::string> pathToNodeExecutable; + optional<std::map<std::string, std::string>> getConfigurationParameters(std::string const& ruleKey); }; -MAKE_REFLECT_STRUCT(SonarLintWorkspaceSettings, disableTelemetry, connectedMode, - rules, output, pathToNodeExecutable) - - - - DEFINE_REQUEST_RESPONSE_TYPE(slls_listAllRules, JsonNull, lsp::Any, "sonarlint/listAllRules"); - +MAKE_REFLECT_STRUCT(SonarLintWorkspaceSettings, disableTelemetry, connectedMode, rules, output, pathToNodeExecutable) +DEFINE_REQUEST_RESPONSE_TYPE(slls_listAllRules, JsonNull, lsp::Any, "sonarlint/listAllRules"); DEFINE_NOTIFICATION_TYPE(Notify_didClasspathUpdate, lsDocumentUri, "sonarlint/didClasspathUpdate") - DEFINE_NOTIFICATION_TYPE(Notify_didJavaServerModeChange, std::string, "sonarlint/didJavaServerModeChange") - - DEFINE_REQUEST_RESPONSE_TYPE(slls_showSonarLintOutput, JsonNull, JsonNull, "sonarlint/showSonarLintOutput"); - - DEFINE_REQUEST_RESPONSE_TYPE(slls_openJavaHomeSettings, JsonNull, JsonNull, "sonarlint/openJavaHomeSettings"); - - - DEFINE_REQUEST_RESPONSE_TYPE(slls_openPathToNodeSettings, JsonNull, JsonNull, "sonarlint/openPathToNodeSettings"); - -DEFINE_REQUEST_RESPONSE_TYPE(slls_showRuleDescription, ShowRuleDescriptionParams, JsonNull, "sonarlint/showRuleDescription"); +DEFINE_REQUEST_RESPONSE_TYPE( + slls_showRuleDescription, ShowRuleDescriptionParams, JsonNull, "sonarlint/showRuleDescription" +); DEFINE_REQUEST_RESPONSE_TYPE(slls_getJavaConfig, lsDocumentUri, GetJavaConfigResponse, "sonarlint/getJavaConfig"); - DEFINE_NOTIFICATION_TYPE(slls_setTraceNotification, SetTraceNotificationParams, "$/setTraceNotification") diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/InitializeParams.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/InitializeParams.h index 145c63087f..a23f657a5e 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/InitializeParams.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/InitializeParams.h @@ -5,28 +5,30 @@ #include "lsClientCapabilities.h" #include "LibLsp/lsp/workspace/workspaceFolders.h" -struct ClientInfo { - std::string name; - optional<std::string> version; +struct ClientInfo +{ + std::string name; + optional<std::string> version; - MAKE_SWAP_METHOD(ClientInfo,name,version); + MAKE_SWAP_METHOD(ClientInfo, name, version); }; -MAKE_REFLECT_STRUCT(ClientInfo,name,version); +MAKE_REFLECT_STRUCT(ClientInfo, name, version); -struct lsInitializeParams { - // The process Id of the parent process that started - // the server. Is null if the process has not been started by another process. - // If the parent process is not alive then the server should exit (see exit - // notification) its process. - optional<int> processId; +struct lsInitializeParams +{ + // The process Id of the parent process that started + // the server. Is null if the process has not been started by another process. + // If the parent process is not alive then the server should exit (see exit + // notification) its process. + optional<int> processId; - /** + /** * Information about the client * * @since 3.15.0 */ - optional<ClientInfo> clientInfo; - /** + optional<ClientInfo> clientInfo; + /** * The locale the client is currently showing the user interface * in. This must not necessarily be the locale of the operating * system. @@ -36,48 +38,44 @@ struct lsInitializeParams { * * @since 3.16.0 */ - optional<std::string> locale; + optional<std::string> locale; - // The rootPath of the workspace. Is null - // if no folder is open. - // - // @deprecated in favour of rootUri. - optional<std::string> rootPath; + // The rootPath of the workspace. Is null + // if no folder is open. + // + // @deprecated in favour of rootUri. + optional<std::string> rootPath; - // The rootUri of the workspace. Is null if no - // folder is open. If both `rootPath` and `rootUri` are set - // `rootUri` wins. - optional<lsDocumentUri> rootUri; + // The rootUri of the workspace. Is null if no + // folder is open. If both `rootPath` and `rootUri` are set + // `rootUri` wins. + optional<lsDocumentUri> rootUri; - // User provided initialization options. - optional<lsp::Any> initializationOptions; + // User provided initialization options. + optional<lsp::Any> initializationOptions; - // The capabilities provided by the client (editor or tool) - lsClientCapabilities capabilities; + // The capabilities provided by the client (editor or tool) + lsClientCapabilities capabilities; - - /** + /** * An optional extension to the protocol. * To tell the server what client (editor) is talking to it. */ - // @Deprecated - optional< std::string >clientName; - - + // @Deprecated + optional<std::string> clientName; - enum class lsTrace { - // NOTE: serialized as a string, one of 'off' | 'messages' | 'verbose'; - Off, // off - Messages, // messages - Verbose // verbose + enum class lsTrace + { + // NOTE: serialized as a string, one of 'off' | 'messages' | 'verbose'; + Off, // off + Messages, // messages + Verbose // verbose + }; - }; + // The initial trace setting. If omitted trace is disabled ('off'). + lsTrace trace = lsTrace::Off; - // The initial trace setting. If omitted trace is disabled ('off'). - lsTrace trace = lsTrace::Off; - - - /** + /** * The workspace folders configured in the client when the server starts. * This property is only available if the client supports workspace folders. * It can be `null` if the client supports workspace folders but none are @@ -85,44 +83,34 @@ struct lsInitializeParams { * * Since 3.6.0 */ - optional< std::vector<WorkspaceFolder> > workspaceFolders; - - MAKE_SWAP_METHOD(lsInitializeParams, - processId, - rootPath, - rootUri, - initializationOptions, - capabilities, clientName, clientInfo, - trace, workspaceFolders, locale) + optional<std::vector<WorkspaceFolder>> workspaceFolders; + + MAKE_SWAP_METHOD( + lsInitializeParams, processId, rootPath, rootUri, initializationOptions, capabilities, clientName, clientInfo, + trace, workspaceFolders, locale + ) }; void Reflect(Reader& reader, lsInitializeParams::lsTrace& value); - void Reflect(Writer& writer, lsInitializeParams::lsTrace& value); - -MAKE_REFLECT_STRUCT(lsInitializeParams, - processId, - rootPath, - rootUri, - initializationOptions, - capabilities, clientName, clientInfo, - trace, workspaceFolders, locale) - -struct lsInitializeError { - // Indicates whether the client should retry to send the - // initilize request after showing the message provided - // in the ResponseError. - bool retry; - void swap(lsInitializeError& arg) noexcept - { - auto tem = retry; - retry = arg.retry; - arg.retry = tem; - } +MAKE_REFLECT_STRUCT( + lsInitializeParams, processId, rootPath, rootUri, initializationOptions, capabilities, clientName, clientInfo, + trace, workspaceFolders, locale +) + +struct lsInitializeError +{ + // Indicates whether the client should retry to send the + // initilize request after showing the message provided + // in the ResponseError. + bool retry; + void swap(lsInitializeError& arg) noexcept + { + auto tem = retry; + retry = arg.retry; + arg.retry = tem; + } }; MAKE_REFLECT_STRUCT(lsInitializeError, retry); - - - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/initialize.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/initialize.h index 2198b158bf..f63f0b5e59 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/initialize.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/initialize.h @@ -5,22 +5,17 @@ #include "LibLsp/JsonRpc/lsResponseMessage.h" #include "LibLsp/JsonRpc/RequestInMessage.h" - - - - - /** * The capabilities the language server provides. */ - struct InitializeResult { +struct InitializeResult +{ lsServerCapabilities capabilities; - MAKE_SWAP_METHOD(InitializeResult, capabilities); - }; + MAKE_SWAP_METHOD(InitializeResult, capabilities); +}; MAKE_REFLECT_STRUCT(InitializeResult, capabilities); - /** * The initialize request is sent as the first request from the client to * the server. diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/initialized.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/initialized.h index bb6d12511c..f63a38b82f 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/initialized.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/initialized.h @@ -1,6 +1,5 @@ #pragma once - #include "LibLsp/JsonRpc/NotificationInMessage.h" /** * The initialized notification is sent from the client to the server after @@ -10,4 +9,3 @@ * register capabilities. */ DEFINE_NOTIFICATION_TYPE(Notify_InitializedNotification, JsonNull, "initialized"); - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsClientCapabilities.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsClientCapabilities.h index 4ec9744258..0a454fc773 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsClientCapabilities.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsClientCapabilities.h @@ -9,40 +9,38 @@ * * @since 3.16.0 */ -struct MarkdownClientCapabilities { - /** +struct MarkdownClientCapabilities +{ + /** * The name of the parser. */ - std::string parser; + std::string parser; - /** + /** * The version of the parser. */ - optional<std::string> version; - MAKE_SWAP_METHOD(MarkdownClientCapabilities, parser, version) - + optional<std::string> version; + MAKE_SWAP_METHOD(MarkdownClientCapabilities, parser, version) }; MAKE_REFLECT_STRUCT(MarkdownClientCapabilities, parser, version) -struct lsClientCapabilities { - // Workspace specific client capabilities. - optional<lsWorkspaceClientCapabilites> workspace; +struct lsClientCapabilities +{ + // Workspace specific client capabilities. + optional<lsWorkspaceClientCapabilites> workspace; - // Text document specific client capabilities. - optional<lsTextDocumentClientCapabilities> textDocument; + // Text document specific client capabilities. + optional<lsTextDocumentClientCapabilities> textDocument; - /** + /** * Window specific client capabilities. */ - optional<lsp::Any> window; - /** + optional<lsp::Any> window; + /** * Experimental client capabilities. */ - optional<lsp::Any> experimental; + optional<lsp::Any> experimental; - MAKE_SWAP_METHOD(lsClientCapabilities, workspace, textDocument, window, experimental) + MAKE_SWAP_METHOD(lsClientCapabilities, workspace, textDocument, window, experimental) }; MAKE_REFLECT_STRUCT(lsClientCapabilities, workspace, textDocument, window, experimental) - - - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsServerCapabilities.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsServerCapabilities.h index e8624681b3..a924ebbfb3 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsServerCapabilities.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsServerCapabilities.h @@ -1,7 +1,6 @@ #pragma once #include "LibLsp/lsp/method_type.h" - #include <stdexcept> #include "LibLsp/JsonRpc/message.h" #include "LibLsp/lsp/lsDocumentUri.h" @@ -9,84 +8,83 @@ #include "InitializeParams.h" #include "LibLsp/lsp/textDocument/SemanticTokens.h" - -extern void Reflect(Reader&, std::pair<optional<lsTextDocumentSyncKind>, optional<lsTextDocumentSyncOptions> >&); +extern void Reflect(Reader&, std::pair<optional<lsTextDocumentSyncKind>, optional<lsTextDocumentSyncOptions>>&); // - // Code Action options. - // -struct CodeActionOptions : WorkDoneProgressOptions { - // - // CodeActionKinds that this server may return. - // - // The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server - // may list out every specific kind they provide. - // - typedef std::string CodeActionKind; - std::vector<CodeActionKind> codeActionKinds; - - MAKE_SWAP_METHOD(CodeActionOptions, workDoneProgress, codeActionKinds); +// Code Action options. +// +struct CodeActionOptions : WorkDoneProgressOptions +{ + // + // CodeActionKinds that this server may return. + // + // The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server + // may list out every specific kind they provide. + // + typedef std::string CodeActionKind; + std::vector<CodeActionKind> codeActionKinds; + + MAKE_SWAP_METHOD(CodeActionOptions, workDoneProgress, codeActionKinds); }; MAKE_REFLECT_STRUCT(CodeActionOptions, workDoneProgress, codeActionKinds) -struct CodeLensOptions : WorkDoneProgressOptions { - // - // Code lens has a resolve provider as well. - // - optional<bool> resolveProvider ; - MAKE_SWAP_METHOD(CodeLensOptions, workDoneProgress, resolveProvider); +struct CodeLensOptions : WorkDoneProgressOptions +{ + // + // Code lens has a resolve provider as well. + // + optional<bool> resolveProvider; + MAKE_SWAP_METHOD(CodeLensOptions, workDoneProgress, resolveProvider); }; MAKE_REFLECT_STRUCT(CodeLensOptions, workDoneProgress, resolveProvider) - // Format document on type options -struct lsDocumentOnTypeFormattingOptions :WorkDoneProgressOptions { - // A character on which formatting should be triggered, like `}`. - std::string firstTriggerCharacter; - - // More trigger characters. - std::vector<std::string> moreTriggerCharacter; - MAKE_SWAP_METHOD(lsDocumentOnTypeFormattingOptions, workDoneProgress, - firstTriggerCharacter, - moreTriggerCharacter); +struct lsDocumentOnTypeFormattingOptions : WorkDoneProgressOptions +{ + // A character on which formatting should be triggered, like `}`. + std::string firstTriggerCharacter; + + // More trigger characters. + std::vector<std::string> moreTriggerCharacter; + MAKE_SWAP_METHOD(lsDocumentOnTypeFormattingOptions, workDoneProgress, firstTriggerCharacter, moreTriggerCharacter); }; -MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingOptions, workDoneProgress, - firstTriggerCharacter, - moreTriggerCharacter); -struct RenameOptions : WorkDoneProgressOptions { - // - // Renames should be checked and tested before being executed. - // - optional<bool> prepareProvider; - MAKE_SWAP_METHOD(RenameOptions, workDoneProgress, prepareProvider); +MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingOptions, workDoneProgress, firstTriggerCharacter, moreTriggerCharacter); +struct RenameOptions : WorkDoneProgressOptions +{ + // + // Renames should be checked and tested before being executed. + // + optional<bool> prepareProvider; + MAKE_SWAP_METHOD(RenameOptions, workDoneProgress, prepareProvider); }; -MAKE_REFLECT_STRUCT(RenameOptions,workDoneProgress,prepareProvider) +MAKE_REFLECT_STRUCT(RenameOptions, workDoneProgress, prepareProvider) -struct DocumentFilter{ - // - // A language id, like `typescript`. - // - optional<std::string> language; - // - // A Uri [scheme](#Uri.scheme), like `file` or `untitled`. - // - optional<std::string>scheme; - // - // A glob pattern, like `*.{ts,js}`. - // - // Glob patterns can have the following syntax: - // - `*` to match one or more characters in a path segment - // - `?` to match on one character in a path segment - // - `**` to match any number of path segments, including none - // - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js} - // matches all TypeScript and JavaScript files) - // - `[]` to declare a range of characters to match in a path segment - // (e.g., `example.[0-9]` to match on `example.0`, `example.1`,...) - // - `[!...]` to negate a range of characters to match in a path segment - // (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but - // not `example.0`) - // - optional<std::string>pattern; - MAKE_SWAP_METHOD(DocumentFilter, language, scheme, pattern) +struct DocumentFilter +{ + // + // A language id, like `typescript`. + // + optional<std::string> language; + // + // A Uri [scheme](#Uri.scheme), like `file` or `untitled`. + // + optional<std::string> scheme; + // + // A glob pattern, like `*.{ts,js}`. + // + // Glob patterns can have the following syntax: + // - `*` to match one or more characters in a path segment + // - `?` to match on one character in a path segment + // - `**` to match any number of path segments, including none + // - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js} + // matches all TypeScript and JavaScript files) + // - `[]` to declare a range of characters to match in a path segment + // (e.g., `example.[0-9]` to match on `example.0`, `example.1`,...) + // - `[!...]` to negate a range of characters to match in a path segment + // (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but + // not `example.0`) + // + optional<std::string> pattern; + MAKE_SWAP_METHOD(DocumentFilter, language, scheme, pattern) }; MAKE_REFLECT_STRUCT(DocumentFilter, language, scheme, pattern) @@ -94,496 +92,476 @@ MAKE_REFLECT_STRUCT(DocumentFilter, language, scheme, pattern) using DocumentSelector = std::vector<DocumentFilter>; // Document link options -struct lsDocumentLinkOptions :WorkDoneProgressOptions { - // Document links have a resolve provider as well. - optional<bool> resolveProvider; - MAKE_SWAP_METHOD(lsDocumentLinkOptions, workDoneProgress, resolveProvider); +struct lsDocumentLinkOptions : WorkDoneProgressOptions +{ + // Document links have a resolve provider as well. + optional<bool> resolveProvider; + MAKE_SWAP_METHOD(lsDocumentLinkOptions, workDoneProgress, resolveProvider); }; -MAKE_REFLECT_STRUCT(lsDocumentLinkOptions, workDoneProgress,resolveProvider); +MAKE_REFLECT_STRUCT(lsDocumentLinkOptions, workDoneProgress, resolveProvider); // Execute command options. -struct lsExecuteCommandOptions : WorkDoneProgressOptions { - // The commands to be executed on the server - std::vector<std::string> commands; - MAKE_SWAP_METHOD(lsExecuteCommandOptions, workDoneProgress, commands); +struct lsExecuteCommandOptions : WorkDoneProgressOptions +{ + // The commands to be executed on the server + std::vector<std::string> commands; + MAKE_SWAP_METHOD(lsExecuteCommandOptions, workDoneProgress, commands); }; MAKE_REFLECT_STRUCT(lsExecuteCommandOptions, workDoneProgress, commands); - struct TextDocumentRegistrationOptions { -// - // A document selector to identify the scope of the registration. If set to null - // the document selector provided on the client side will be used. - // - optional<DocumentSelector> documentSelector; + // + // A document selector to identify the scope of the registration. If set to null + // the document selector provided on the client side will be used. + // + optional<DocumentSelector> documentSelector; - MAKE_SWAP_METHOD(TextDocumentRegistrationOptions, documentSelector); + MAKE_SWAP_METHOD(TextDocumentRegistrationOptions, documentSelector); }; MAKE_REFLECT_STRUCT(TextDocumentRegistrationOptions, documentSelector); // - // Static registration options to be returned in the initialize request. - // -struct StaticRegistrationOptions :public TextDocumentRegistrationOptions +// Static registration options to be returned in the initialize request. +// +struct StaticRegistrationOptions : public TextDocumentRegistrationOptions { - // - // The id used to register the request. The id can be used to deregister - // the request again. See also Registration#id. - // - optional<std::string> id; - MAKE_SWAP_METHOD(StaticRegistrationOptions, documentSelector, id) + // + // The id used to register the request. The id can be used to deregister + // the request again. See also Registration#id. + // + optional<std::string> id; + MAKE_SWAP_METHOD(StaticRegistrationOptions, documentSelector, id) }; -MAKE_REFLECT_STRUCT(StaticRegistrationOptions, documentSelector,id) +MAKE_REFLECT_STRUCT(StaticRegistrationOptions, documentSelector, id) // - // The server supports workspace folder. - // - // Since 3.6.0 - // - -struct WorkspaceFoldersOptions { - // - // The server has support for workspace folders - // - optional<bool> supported; +// The server supports workspace folder. +// +// Since 3.6.0 +// - // - // Whether the server wants to receive workspace folder - // change notifications. - // - // If a string is provided, the string is treated as an ID - // under which the notification is registered on the client - // side. The ID can be used to unregister for these events - // using the `client/unregisterCapability` request. - // - optional<std::pair< optional<std::string>, optional<bool> > > changeNotifications; - MAKE_SWAP_METHOD(WorkspaceFoldersOptions, supported, changeNotifications); +struct WorkspaceFoldersOptions +{ + // + // The server has support for workspace folders + // + optional<bool> supported; + + // + // Whether the server wants to receive workspace folder + // change notifications. + // + // If a string is provided, the string is treated as an ID + // under which the notification is registered on the client + // side. The ID can be used to unregister for these events + // using the `client/unregisterCapability` request. + // + optional<std::pair<optional<std::string>, optional<bool>>> changeNotifications; + MAKE_SWAP_METHOD(WorkspaceFoldersOptions, supported, changeNotifications); }; MAKE_REFLECT_STRUCT(WorkspaceFoldersOptions, supported, changeNotifications); // - // A pattern kind describing if a glob pattern matches a file a folder or - // both. - // - // @since 3.16.0 - // +// A pattern kind describing if a glob pattern matches a file a folder or +// both. +// +// @since 3.16.0 +// enum lsFileOperationPatternKind { - file, - folder + file, + folder }; MAKE_REFLECT_TYPE_PROXY(lsFileOperationPatternKind) // - // Matching options for the file operation pattern. - // - // @since 3.16.0 - // -struct lsFileOperationPatternOptions { +// Matching options for the file operation pattern. +// +// @since 3.16.0 +// +struct lsFileOperationPatternOptions +{ - // - // The pattern should be matched ignoring casing. - // - optional<bool> ignoreCase; - MAKE_SWAP_METHOD(lsFileOperationPatternOptions, ignoreCase) + // + // The pattern should be matched ignoring casing. + // + optional<bool> ignoreCase; + MAKE_SWAP_METHOD(lsFileOperationPatternOptions, ignoreCase) }; MAKE_REFLECT_STRUCT(lsFileOperationPatternOptions, ignoreCase) // - // A pattern to describe in which file operation requests or notifications - // the server is interested in. - // - // @since 3.16.0 - // -struct lsFileOperationPattern { - // - // The glob pattern to match. Glob patterns can have the following syntax: - // - `*` to match one or more characters in a path segment - // - `?` to match on one character in a path segment - // - `**` to match any number of path segments, including none - // - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` - // matches all TypeScript and JavaScript files) - // - `[]` to declare a range of characters to match in a path segment - // (e.g., `example.[0-9]` to match on `example.0`, `example.1`,...) - // - `[!...]` to negate a range of characters to match in a path segment - // (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but - // not `example.0`) - // - std::string glob; - - // - // Whether to match files or folders with this pattern. - // - // Matches both if undefined. - // - optional<lsFileOperationPatternKind> matches; - - // - // Additional options used during matching. - // - optional<lsFileOperationPatternOptions> options ; - MAKE_SWAP_METHOD(lsFileOperationPattern, glob, matches, options) +// A pattern to describe in which file operation requests or notifications +// the server is interested in. +// +// @since 3.16.0 +// +struct lsFileOperationPattern +{ + // + // The glob pattern to match. Glob patterns can have the following syntax: + // - `*` to match one or more characters in a path segment + // - `?` to match on one character in a path segment + // - `**` to match any number of path segments, including none + // - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` + // matches all TypeScript and JavaScript files) + // - `[]` to declare a range of characters to match in a path segment + // (e.g., `example.[0-9]` to match on `example.0`, `example.1`,...) + // - `[!...]` to negate a range of characters to match in a path segment + // (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but + // not `example.0`) + // + std::string glob; + + // + // Whether to match files or folders with this pattern. + // + // Matches both if undefined. + // + optional<lsFileOperationPatternKind> matches; + + // + // Additional options used during matching. + // + optional<lsFileOperationPatternOptions> options; + MAKE_SWAP_METHOD(lsFileOperationPattern, glob, matches, options) }; MAKE_REFLECT_STRUCT(lsFileOperationPattern, glob, matches, options) // - // A filter to describe in which file operation requests or notifications - // the server is interested in. - // - // @since 3.16.0 - // -struct lsFileOperationFilter { +// A filter to describe in which file operation requests or notifications +// the server is interested in. +// +// @since 3.16.0 +// +struct lsFileOperationFilter +{ - // - // A Uri like `file` or `untitled`. - // - optional<std::string> scheme; + // + // A Uri like `file` or `untitled`. + // + optional<std::string> scheme; - // - // The actual file operation pattern. - // - optional<lsFileOperationPattern> pattern; - MAKE_SWAP_METHOD(lsFileOperationFilter, scheme, pattern) + // + // The actual file operation pattern. + // + optional<lsFileOperationPattern> pattern; + MAKE_SWAP_METHOD(lsFileOperationFilter, scheme, pattern) }; MAKE_REFLECT_STRUCT(lsFileOperationFilter, scheme, pattern) // - // The options to register for file operations. - // - // @since 3.16.0 - // -struct lsFileOperationRegistrationOptions { - // - // The actual filters. - // - optional<std::vector<lsFileOperationFilter>> filters; - MAKE_SWAP_METHOD(lsFileOperationRegistrationOptions, filters) +// The options to register for file operations. +// +// @since 3.16.0 +// +struct lsFileOperationRegistrationOptions +{ + // + // The actual filters. + // + optional<std::vector<lsFileOperationFilter>> filters; + MAKE_SWAP_METHOD(lsFileOperationRegistrationOptions, filters) }; MAKE_REFLECT_STRUCT(lsFileOperationRegistrationOptions, filters) -struct WorkspaceServerCapabilities { - // - // The server supports workspace folder. - // - // Since 3.6.0 - // - WorkspaceFoldersOptions workspaceFolders; - +struct WorkspaceServerCapabilities +{ + // + // The server supports workspace folder. + // + // Since 3.6.0 + // + WorkspaceFoldersOptions workspaceFolders; + // + // The server is interested in file notifications/requests. + // + // @since 3.16.0 + // + struct lsFileOperations + { // - // The server is interested in file notifications/requests. - // - // @since 3.16.0 - // - struct lsFileOperations - { - // - // The server is interested in receiving didCreateFiles - // notifications. - // - optional<lsFileOperationRegistrationOptions> didCreate; - - // - // The server is interested in receiving willCreateFiles requests. - // - optional<lsFileOperationRegistrationOptions> willCreate; - - // - // The server is interested in receiving didRenameFiles - // notifications. - // - optional<lsFileOperationRegistrationOptions> didRename; - - // - // The server is interested in receiving willRenameFiles requests. - // - optional<lsFileOperationRegistrationOptions> willRename; - - // - // The server is interested in receiving didDeleteFiles file - // notifications. - // - optional<lsFileOperationRegistrationOptions> didDelete; - - // - // The server is interested in receiving willDeleteFiles file - // requests. - // - optional<lsFileOperationRegistrationOptions> willDelete; - MAKE_SWAP_METHOD(lsFileOperations, didCreate, willCreate, didRename, willRename, didDelete, willDelete) - }; - optional<lsFileOperations>fileOperations; - - - MAKE_SWAP_METHOD(WorkspaceServerCapabilities, workspaceFolders, fileOperations) -}; -MAKE_REFLECT_STRUCT(WorkspaceServerCapabilities, workspaceFolders, fileOperations) -MAKE_REFLECT_STRUCT(WorkspaceServerCapabilities::lsFileOperations, didCreate, willCreate, didRename, willRename, didDelete, willDelete) - -// - // Semantic highlighting server capabilities. - // - // <p> - // <b>Note:</b> the <a href= - // "https://github.com/Microsoft/vscode-languageserver-node/pull/367">{@code textDocument/semanticHighlighting} - // language feature</a> is not yet part of the official LSP specification. - // - -struct SemanticHighlightingServerCapabilities { + // The server is interested in receiving didCreateFiles + // notifications. // - // A "lookup table" of semantic highlighting <a href="https://manual.macromates.com/en/language_grammars">TextMate scopes</a> - // supported by the language server. If not defined or empty, then the server does not support the semantic highlighting - // feature. Otherwise, clients should reuse this "lookup table" when receiving semantic highlighting notifications from - // the server. - // - std::vector< std::vector<std::string> > scopes; - MAKE_SWAP_METHOD(SemanticHighlightingServerCapabilities, scopes) -}; -MAKE_REFLECT_STRUCT(SemanticHighlightingServerCapabilities, scopes) + optional<lsFileOperationRegistrationOptions> didCreate; -struct SemanticTokensServerFull -{ // - // The server supports deltas for full documents. + // The server is interested in receiving willCreateFiles requests. // - bool delta =false; - MAKE_SWAP_METHOD(SemanticTokensServerFull, delta) -}; -MAKE_REFLECT_STRUCT(SemanticTokensServerFull, delta) -struct SemanticTokensWithRegistrationOptions -{ - SemanticTokensLegend legend; + optional<lsFileOperationRegistrationOptions> willCreate; // - // Server supports providing semantic tokens for a specific range - // of a document. - // - optional< std::pair< optional<bool>, optional<lsp::Any> > > range; - + // The server is interested in receiving didRenameFiles + // notifications. // - // Server supports providing semantic tokens for a full document. - // - optional< std::pair< optional<bool>, - optional<SemanticTokensServerFull> > > full; + optional<lsFileOperationRegistrationOptions> didRename; // - // A document selector to identify the scope of the registration. If set to null - // the document selector provided on the client side will be used. - // - optional < std::vector<DocumentFilter> > documentSelector; + // The server is interested in receiving willRenameFiles requests. // - // The id used to register the request. The id can be used to deregister - // the request again. See also Registration#id. - // - optional<std::string> id; - MAKE_SWAP_METHOD(SemanticTokensWithRegistrationOptions, legend, range, full, documentSelector, id) -}; -MAKE_REFLECT_STRUCT(SemanticTokensWithRegistrationOptions, legend, range, full, documentSelector ,id) - -using DocumentColorOptions = WorkDoneProgressOptions; -using FoldingRangeOptions = WorkDoneProgressOptions; -struct lsServerCapabilities { - // Defines how text documents are synced. Is either a detailed structure - // defining each notification or for backwards compatibility the - - // TextDocumentSyncKind number. - optional< std::pair<optional<lsTextDocumentSyncKind>, - optional<lsTextDocumentSyncOptions> >> textDocumentSync; + optional<lsFileOperationRegistrationOptions> willRename; - // The server provides hover support. - optional<bool> hoverProvider; - - // The server provides completion support. - optional < lsCompletionOptions > completionProvider; - - // The server provides signature help support. - optional < lsSignatureHelpOptions > signatureHelpProvider; - - // The server provides goto definition support. - optional< std::pair< optional<bool>, optional<WorkDoneProgressOptions> > > definitionProvider; - - - // - // The server provides Goto Type Definition support. - // - // Since 3.6.0 - // - optional< std::pair< optional<bool>, optional<StaticRegistrationOptions> > > typeDefinitionProvider ; - - // The server provides implementation support. - optional< std::pair< optional<bool>, optional<StaticRegistrationOptions> > > implementationProvider ; - - // The server provides find references support. - optional< std::pair< optional<bool>, optional<WorkDoneProgressOptions> > > referencesProvider ; - - // The server provides document highlight support. - optional< std::pair< optional<bool>, optional<WorkDoneProgressOptions> > > documentHighlightProvider ; - - // The server provides document symbol support. - optional< std::pair< optional<bool>, optional<WorkDoneProgressOptions> > > documentSymbolProvider ; - - // The server provides workspace symbol support. - optional< std::pair< optional<bool>, optional<WorkDoneProgressOptions> > > workspaceSymbolProvider ; - - // The server provides code actions. - optional< std::pair< optional<bool>, optional<CodeActionOptions> > > codeActionProvider ; - - // The server provides code lens. - optional<CodeLensOptions> codeLensProvider; + // + // The server is interested in receiving didDeleteFiles file + // notifications. + // + optional<lsFileOperationRegistrationOptions> didDelete; - // The server provides document formatting. - optional< std::pair< optional<bool>, optional<WorkDoneProgressOptions> > > documentFormattingProvider ; + // + // The server is interested in receiving willDeleteFiles file + // requests. + // + optional<lsFileOperationRegistrationOptions> willDelete; + MAKE_SWAP_METHOD(lsFileOperations, didCreate, willCreate, didRename, willRename, didDelete, willDelete) + }; + optional<lsFileOperations> fileOperations; - // The server provides document range formatting. - optional< std::pair< optional<bool>, optional<WorkDoneProgressOptions> > > documentRangeFormattingProvider ; + MAKE_SWAP_METHOD(WorkspaceServerCapabilities, workspaceFolders, fileOperations) +}; +MAKE_REFLECT_STRUCT(WorkspaceServerCapabilities, workspaceFolders, fileOperations) +MAKE_REFLECT_STRUCT( + WorkspaceServerCapabilities::lsFileOperations, didCreate, willCreate, didRename, willRename, didDelete, willDelete +) - // The server provides document formatting on typing. - optional<lsDocumentOnTypeFormattingOptions> documentOnTypeFormattingProvider; +// +// Semantic highlighting server capabilities. +// +// <p> +// <b>Note:</b> the <a href= +// "https://github.com/Microsoft/vscode-languageserver-node/pull/367">{@code textDocument/semanticHighlighting} +// language feature</a> is not yet part of the official LSP specification. +// - // The server provides rename support. - optional< std::pair< optional<bool>, optional<RenameOptions> > > renameProvider; +struct SemanticHighlightingServerCapabilities +{ + // + // A "lookup table" of semantic highlighting <a href="https://manual.macromates.com/en/language_grammars">TextMate scopes</a> + // supported by the language server. If not defined or empty, then the server does not support the semantic highlighting + // feature. Otherwise, clients should reuse this "lookup table" when receiving semantic highlighting notifications from + // the server. + // + std::vector<std::vector<std::string>> scopes; + MAKE_SWAP_METHOD(SemanticHighlightingServerCapabilities, scopes) +}; +MAKE_REFLECT_STRUCT(SemanticHighlightingServerCapabilities, scopes) +struct SemanticTokensServerFull +{ + // + // The server supports deltas for full documents. + // + bool delta = false; + MAKE_SWAP_METHOD(SemanticTokensServerFull, delta) +}; +MAKE_REFLECT_STRUCT(SemanticTokensServerFull, delta) +struct SemanticTokensWithRegistrationOptions +{ + SemanticTokensLegend legend; + + // + // Server supports providing semantic tokens for a specific range + // of a document. + // + optional<std::pair<optional<bool>, optional<lsp::Any>>> range; + + // + // Server supports providing semantic tokens for a full document. + // + optional<std::pair<optional<bool>, optional<SemanticTokensServerFull>>> full; + + // + // A document selector to identify the scope of the registration. If set to null + // the document selector provided on the client side will be used. + // + optional<std::vector<DocumentFilter>> documentSelector; + // + // The id used to register the request. The id can be used to deregister + // the request again. See also Registration#id. + // + optional<std::string> id; + MAKE_SWAP_METHOD(SemanticTokensWithRegistrationOptions, legend, range, full, documentSelector, id) +}; +MAKE_REFLECT_STRUCT(SemanticTokensWithRegistrationOptions, legend, range, full, documentSelector, id) - // The server provides document link support. - optional<lsDocumentLinkOptions > documentLinkProvider; +using DocumentColorOptions = WorkDoneProgressOptions; +using FoldingRangeOptions = WorkDoneProgressOptions; +struct InlayHintOptions : WorkDoneProgressOptions +{ - // - // The server provides color provider support. - // - // @since 3.6.0 - // - optional< std::pair< optional<bool>, optional<DocumentColorOptions> > > colorProvider; + /** + * The server provides support to resolve additional + * information for an inlay hint item. + */ + optional<bool> resolveProvider; + MAKE_SWAP_METHOD(InlayHintOptions, workDoneProgress, resolveProvider); +}; - // - // The server provides folding provider support. - // - // @since 3.10.0 - // - optional < std::pair< optional<bool>, optional<FoldingRangeOptions> > > foldingRangeProvider; +MAKE_REFLECT_STRUCT(InlayHintOptions, workDoneProgress, resolveProvider) - // The server provides execute command support. - optional < lsExecuteCommandOptions >executeCommandProvider; +struct lsServerCapabilities +{ + // Defines how text documents are synced. Is either a detailed structure + // defining each notification or for backwards compatibility the + // TextDocumentSyncKind number. + optional<std::pair<optional<lsTextDocumentSyncKind>, optional<lsTextDocumentSyncOptions>>> textDocumentSync; - // - // Workspace specific server capabilities - // - optional< WorkspaceServerCapabilities > workspace; + // The server provides hover support. + optional<bool> hoverProvider; - // - // Semantic highlighting server capabilities. - // + // The server provides completion support. + optional<lsCompletionOptions> completionProvider; - optional< SemanticHighlightingServerCapabilities >semanticHighlighting; + // The server provides signature help support. + optional<lsSignatureHelpOptions> signatureHelpProvider; - // - // Server capability for calculating super- and subtype hierarchies. - // The LS supports the type hierarchy language feature, if this capability is set to {@code true}. - // - // <p> - // <b>Note:</b> the <a href= - // "https://github.com/Microsoft/vscode-languageserver-node/pull/426">{@code textDocument/typeHierarchy} - // language feature</a> is not yet part of the official LSP specification. - // - - optional< std::pair< optional<bool>, - optional<StaticRegistrationOptions> > > typeHierarchyProvider; + // The server provides goto definition support. + optional<std::pair<optional<bool>, optional<WorkDoneProgressOptions>>> definitionProvider; - // - // The server provides Call Hierarchy support. - // + // + // The server provides Goto Type Definition support. + // + // Since 3.6.0 + // + optional<std::pair<optional<bool>, optional<StaticRegistrationOptions>>> typeDefinitionProvider; - optional< std::pair< optional<bool>, - optional<StaticRegistrationOptions> > > callHierarchyProvider; + // The server provides implementation support. + optional<std::pair<optional<bool>, optional<StaticRegistrationOptions>>> implementationProvider; - // - // The server provides selection range support. - // - // Since 3.15.0 - // - optional< std::pair< optional<bool>, - optional<StaticRegistrationOptions> > > selectionRangeProvider; - - // - // The server provides linked editing range support. - // - // Since 3.16.0 - // - optional< std::pair< optional<bool>, - optional<StaticRegistrationOptions> > > linkedEditingRangeProvider; - - - // - // The server provides semantic tokens support. - // - // Since 3.16.0 - // - optional < SemanticTokensWithRegistrationOptions> semanticTokensProvider; - - // - // Whether server provides moniker support. - // - // Since 3.16.0 - // - optional< std::pair< optional<bool>, - optional<StaticRegistrationOptions> > > monikerProvider; - - optional<lsp::Any> experimental; - - - MAKE_SWAP_METHOD(lsServerCapabilities, - textDocumentSync, - hoverProvider, - completionProvider, - signatureHelpProvider, - definitionProvider, - typeDefinitionProvider, - implementationProvider, - referencesProvider, - documentHighlightProvider, - documentSymbolProvider, - workspaceSymbolProvider, - codeActionProvider, - codeLensProvider, - documentFormattingProvider, - documentRangeFormattingProvider, - documentOnTypeFormattingProvider, - renameProvider, - documentLinkProvider, - executeCommandProvider, - workspace, - semanticHighlighting, - typeHierarchyProvider, - callHierarchyProvider, - selectionRangeProvider, - experimental, colorProvider, foldingRangeProvider, - linkedEditingRangeProvider, monikerProvider, semanticTokensProvider) + // The server provides find references support. + optional<std::pair<optional<bool>, optional<WorkDoneProgressOptions>>> referencesProvider; + // The server provides document highlight support. + optional<std::pair<optional<bool>, optional<WorkDoneProgressOptions>>> documentHighlightProvider; + + // The server provides document symbol support. + optional<std::pair<optional<bool>, optional<WorkDoneProgressOptions>>> documentSymbolProvider; + + // The server provides workspace symbol support. + optional<std::pair<optional<bool>, optional<WorkDoneProgressOptions>>> workspaceSymbolProvider; + + // The server provides code actions. + optional<std::pair<optional<bool>, optional<CodeActionOptions>>> codeActionProvider; + + // The server provides code lens. + optional<CodeLensOptions> codeLensProvider; + + // The server provides document formatting. + optional<std::pair<optional<bool>, optional<WorkDoneProgressOptions>>> documentFormattingProvider; + + // The server provides document range formatting. + optional<std::pair<optional<bool>, optional<WorkDoneProgressOptions>>> documentRangeFormattingProvider; + + // The server provides document formatting on typing. + optional<lsDocumentOnTypeFormattingOptions> documentOnTypeFormattingProvider; + + // The server provides rename support. + optional<std::pair<optional<bool>, optional<RenameOptions>>> renameProvider; + + // The server provides document link support. + optional<lsDocumentLinkOptions> documentLinkProvider; + + // + // The server provides color provider support. + // + // @since 3.6.0 + // + optional<std::pair<optional<bool>, optional<DocumentColorOptions>>> colorProvider; + + // + // The server provides folding provider support. + // + // @since 3.10.0 + // + optional<std::pair<optional<bool>, optional<FoldingRangeOptions>>> foldingRangeProvider; + + // The server provides execute command support. + optional<lsExecuteCommandOptions> executeCommandProvider; + + // + // Workspace specific server capabilities + // + optional<WorkspaceServerCapabilities> workspace; + + // + // Semantic highlighting server capabilities. + // + + optional<SemanticHighlightingServerCapabilities> semanticHighlighting; + + // + // Server capability for calculating super- and subtype hierarchies. + // The LS supports the type hierarchy language feature, if this capability is set to {@code true}. + // + // <p> + // <b>Note:</b> the <a href= + // "https://github.com/Microsoft/vscode-languageserver-node/pull/426">{@code textDocument/typeHierarchy} + // language feature</a> is not yet part of the official LSP specification. + // + + optional<std::pair<optional<bool>, optional<StaticRegistrationOptions>>> typeHierarchyProvider; + + // + // The server provides Call Hierarchy support. + // + + optional<std::pair<optional<bool>, optional<StaticRegistrationOptions>>> callHierarchyProvider; + + // + // The server provides selection range support. + // + // Since 3.15.0 + // + optional<std::pair<optional<bool>, optional<StaticRegistrationOptions>>> selectionRangeProvider; + + // + // The server provides linked editing range support. + // + // Since 3.16.0 + // + optional<std::pair<optional<bool>, optional<StaticRegistrationOptions>>> linkedEditingRangeProvider; + + // + // The server provides semantic tokens support. + // + // Since 3.16.0 + // + optional<SemanticTokensWithRegistrationOptions> semanticTokensProvider; + + // + // Whether server provides moniker support. + // + // Since 3.16.0 + // + optional<std::pair<optional<bool>, optional<StaticRegistrationOptions>>> monikerProvider; + + /** + * The server provides inlay hints. + * + * @since 3.17.0 + */ + optional<std::pair<optional<bool>, optional<InlayHintOptions>>> inlayHintProvider; + + optional<lsp::Any> experimental; + + MAKE_SWAP_METHOD( + lsServerCapabilities, textDocumentSync, hoverProvider, completionProvider, signatureHelpProvider, + definitionProvider, typeDefinitionProvider, implementationProvider, referencesProvider, + documentHighlightProvider, documentSymbolProvider, workspaceSymbolProvider, codeActionProvider, + codeLensProvider, documentFormattingProvider, documentRangeFormattingProvider, documentOnTypeFormattingProvider, + renameProvider, documentLinkProvider, executeCommandProvider, workspace, semanticHighlighting, + typeHierarchyProvider, callHierarchyProvider, selectionRangeProvider, experimental, colorProvider, + foldingRangeProvider, linkedEditingRangeProvider, monikerProvider, semanticTokensProvider + ) }; -MAKE_REFLECT_STRUCT(lsServerCapabilities, - textDocumentSync, - hoverProvider, - completionProvider, - signatureHelpProvider, - definitionProvider, - typeDefinitionProvider, - implementationProvider, - referencesProvider, - documentHighlightProvider, - documentSymbolProvider, - workspaceSymbolProvider, - codeActionProvider, - codeLensProvider, - documentFormattingProvider, - documentRangeFormattingProvider, - documentOnTypeFormattingProvider, - renameProvider, - documentLinkProvider, - executeCommandProvider, - workspace, - semanticHighlighting, - typeHierarchyProvider, - callHierarchyProvider, - selectionRangeProvider, - experimental, colorProvider, foldingRangeProvider, - linkedEditingRangeProvider, monikerProvider, semanticTokensProvider) +MAKE_REFLECT_STRUCT( + lsServerCapabilities, textDocumentSync, hoverProvider, completionProvider, signatureHelpProvider, + definitionProvider, typeDefinitionProvider, implementationProvider, referencesProvider, documentHighlightProvider, + documentSymbolProvider, workspaceSymbolProvider, codeActionProvider, codeLensProvider, documentFormattingProvider, + documentRangeFormattingProvider, documentOnTypeFormattingProvider, renameProvider, documentLinkProvider, + executeCommandProvider, workspace, semanticHighlighting, typeHierarchyProvider, callHierarchyProvider, + selectionRangeProvider, experimental, colorProvider, foldingRangeProvider, linkedEditingRangeProvider, + monikerProvider, semanticTokensProvider +) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsTextDocumentClientCapabilities.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsTextDocumentClientCapabilities.h index 1523254d63..ddedd3711f 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsTextDocumentClientCapabilities.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsTextDocumentClientCapabilities.h @@ -1,7 +1,6 @@ #pragma once #include "LibLsp/lsp/method_type.h" - #include <stdexcept> #include "LibLsp/JsonRpc/message.h" #include "LibLsp/lsp/lsDocumentUri.h" @@ -11,84 +10,84 @@ #include "LibLsp/lsp/lsp_completion.h" #include "LibLsp/lsp/lsp_diagnostic.h" - -struct WorkDoneProgressOptions +struct WorkDoneProgressOptions { - optional<bool>workDoneProgress; - MAKE_SWAP_METHOD(WorkDoneProgressOptions, workDoneProgress); + optional<bool> workDoneProgress; + MAKE_SWAP_METHOD(WorkDoneProgressOptions, workDoneProgress); }; MAKE_REFLECT_STRUCT(WorkDoneProgressOptions, workDoneProgress); // Completion options. -struct lsCompletionOptions:WorkDoneProgressOptions +struct lsCompletionOptions : WorkDoneProgressOptions { - // The server provides support to resolve additional - // information for a completion item. - optional<bool> resolveProvider = false; - - // - // Most tools trigger completion request automatically without explicitly requesting - // it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user - // starts to type an identifier. For example if the user types `c` in a JavaScript file - // code complete will automatically pop up present `console` besides others as a - // completion item. Characters that make up identifiers don't need to be listed here. - // - // If code complete should automatically be trigger on characters not being valid inside - // an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. - // - // https://github.com/Microsoft/language-server-protocol/issues/138. - optional< std::vector<std::string> > triggerCharacters ; - - // - // The list of all possible characters that commit a completion. This field can be used - // if clients don't support individual commmit characters per completion item. See - // `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` - // - optional< std::vector<std::string> > allCommitCharacters; - - MAKE_SWAP_METHOD(lsCompletionOptions, workDoneProgress, resolveProvider, triggerCharacters, allCommitCharacters); + // The server provides support to resolve additional + // information for a completion item. + optional<bool> resolveProvider = false; + + // + // Most tools trigger completion request automatically without explicitly requesting + // it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user + // starts to type an identifier. For example if the user types `c` in a JavaScript file + // code complete will automatically pop up present `console` besides others as a + // completion item. Characters that make up identifiers don't need to be listed here. + // + // If code complete should automatically be trigger on characters not being valid inside + // an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. + // + // https://github.com/Microsoft/language-server-protocol/issues/138. + optional<std::vector<std::string>> triggerCharacters; + + // + // The list of all possible characters that commit a completion. This field can be used + // if clients don't support individual commmit characters per completion item. See + // `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` + // + optional<std::vector<std::string>> allCommitCharacters; + + MAKE_SWAP_METHOD(lsCompletionOptions, workDoneProgress, resolveProvider, triggerCharacters, allCommitCharacters); }; -MAKE_REFLECT_STRUCT(lsCompletionOptions, workDoneProgress, resolveProvider, triggerCharacters,allCommitCharacters); - - +MAKE_REFLECT_STRUCT(lsCompletionOptions, workDoneProgress, resolveProvider, triggerCharacters, allCommitCharacters); // Save options. -struct lsSaveOptions { - // The client is supposed to include the content on save. - bool includeText = false; - void swap(lsSaveOptions& arg)noexcept - { - auto temp = includeText; - includeText = arg.includeText; - arg.includeText = temp; - } +struct lsSaveOptions +{ + // The client is supposed to include the content on save. + bool includeText = false; + void swap(lsSaveOptions& arg) noexcept + { + auto temp = includeText; + includeText = arg.includeText; + arg.includeText = temp; + } }; MAKE_REFLECT_STRUCT(lsSaveOptions, includeText); // Signature help options. -struct lsSignatureHelpOptions : WorkDoneProgressOptions { - // The characters that trigger signature help automatically. - // NOTE: If updating signature help tokens make sure to also update - // WorkingFile::FindClosestCallNameInBuffer. - std::vector<std::string> triggerCharacters; - MAKE_SWAP_METHOD(lsSignatureHelpOptions, workDoneProgress, triggerCharacters); +struct lsSignatureHelpOptions : WorkDoneProgressOptions +{ + // The characters that trigger signature help automatically. + // NOTE: If updating signature help tokens make sure to also update + // WorkingFile::FindClosestCallNameInBuffer. + std::vector<std::string> triggerCharacters; + MAKE_SWAP_METHOD(lsSignatureHelpOptions, workDoneProgress, triggerCharacters); }; -MAKE_REFLECT_STRUCT(lsSignatureHelpOptions, workDoneProgress, triggerCharacters); +MAKE_REFLECT_STRUCT(lsSignatureHelpOptions, workDoneProgress, triggerCharacters); // Defines how the host (editor) should sync document changes to the language // server. -enum class lsTextDocumentSyncKind { - // Documents should not be synced at all. - None = 0, - - // Documents are synced by always sending the full content - // of the document. - Full = 1, - - // Documents are synced by sending the full content on open. - // After that only incremental updates to the document are - // send. - Incremental = 2 +enum class lsTextDocumentSyncKind +{ + // Documents should not be synced at all. + None = 0, + + // Documents are synced by always sending the full content + // of the document. + Full = 1, + + // Documents are synced by sending the full content on open. + // After that only incremental updates to the document are + // send. + Incremental = 2 }; #if _WIN32 @@ -100,294 +99,274 @@ MAKE_REFLECT_TYPE_PROXY(lsTextDocumentSyncKind) //#pragma clang diagnostic pop #endif -struct lsTextDocumentSyncOptions { - // Open and close notifications are sent to the server. - optional<bool> openClose ; - // Change notificatins are sent to the server. See TextDocumentSyncKind.None, - // TextDocumentSyncKind.Full and TextDocumentSyncKindIncremental. - optional< lsTextDocumentSyncKind> change ; - // Will save notifications are sent to the server. - optional<bool> willSave; - // Will save wait until requests are sent to the server. - optional<bool> willSaveWaitUntil; - // Save notifications are sent to the server. - optional<lsSaveOptions> save; - - MAKE_SWAP_METHOD(lsTextDocumentSyncOptions, - openClose, - change, - willSave, - willSaveWaitUntil, - save); -}; -MAKE_REFLECT_STRUCT(lsTextDocumentSyncOptions, - openClose, - change, - willSave, - willSaveWaitUntil, - save); - -struct SynchronizationCapabilities { - // Whether text document synchronization supports dynamic registration. - optional<bool> dynamicRegistration; - - // The client supports sending will save notifications. - optional<bool> willSave; - - // The client supports sending a will save request and - // waits for a response providing text edits which will - // be applied to the document before it is saved. - optional<bool> willSaveWaitUntil; - - // The client supports did save notifications. - optional<bool> didSave; - - MAKE_SWAP_METHOD(SynchronizationCapabilities, - dynamicRegistration, - willSave, - willSaveWaitUntil, - didSave); -}; -MAKE_REFLECT_STRUCT(SynchronizationCapabilities, - dynamicRegistration, - willSave, - willSaveWaitUntil, - didSave); - -struct CompletionItemKindCapabilities +struct lsTextDocumentSyncOptions { - optional<std::vector<lsCompletionItemKind> >valueSet; - MAKE_SWAP_METHOD(CompletionItemKindCapabilities, valueSet); + // Open and close notifications are sent to the server. + optional<bool> openClose; + // Change notificatins are sent to the server. See TextDocumentSyncKind.None, + // TextDocumentSyncKind.Full and TextDocumentSyncKindIncremental. + optional<lsTextDocumentSyncKind> change; + // Will save notifications are sent to the server. + optional<bool> willSave; + // Will save wait until requests are sent to the server. + optional<bool> willSaveWaitUntil; + // Save notifications are sent to the server. + optional<lsSaveOptions> save; + + MAKE_SWAP_METHOD(lsTextDocumentSyncOptions, openClose, change, willSave, willSaveWaitUntil, save); }; -MAKE_REFLECT_STRUCT(CompletionItemKindCapabilities, valueSet); - -struct CompletionItemCapabilities { - // Client supports snippets as insert text. - // - // A snippet can define tab stops and placeholders with `$1`, `$2` - // and `${3:foo}`. `$0` defines the final tab stop, it defaults to - // the end of the snippet. Placeholders with equal identifiers are linked, - // that is typing in one will update others too. - optional<bool> snippetSupport; - - // Client supports commit characters on a completion item. - - optional<bool> commitCharactersSupport; +MAKE_REFLECT_STRUCT(lsTextDocumentSyncOptions, openClose, change, willSave, willSaveWaitUntil, save); +struct SynchronizationCapabilities +{ + // Whether text document synchronization supports dynamic registration. + optional<bool> dynamicRegistration; - // Client supports the following content formats for the documentation - // property. The order describes the preferred format of the client. + // The client supports sending will save notifications. + optional<bool> willSave; - optional< std::vector<std::string> > documentationFormat; + // The client supports sending a will save request and + // waits for a response providing text edits which will + // be applied to the document before it is saved. + optional<bool> willSaveWaitUntil; - // Client supports the deprecated property on a completion item. + // The client supports did save notifications. + optional<bool> didSave; - optional<bool> deprecatedSupport; + MAKE_SWAP_METHOD(SynchronizationCapabilities, dynamicRegistration, willSave, willSaveWaitUntil, didSave); +}; +MAKE_REFLECT_STRUCT(SynchronizationCapabilities, dynamicRegistration, willSave, willSaveWaitUntil, didSave); - // - // Client supports the preselect property on a completion item. - // - optional<bool> preselectSupport; - - MAKE_SWAP_METHOD(CompletionItemCapabilities, - snippetSupport, - commitCharactersSupport, - documentationFormat, - deprecatedSupport, preselectSupport); +struct CompletionItemKindCapabilities +{ + optional<std::vector<lsCompletionItemKind>> valueSet; + MAKE_SWAP_METHOD(CompletionItemKindCapabilities, valueSet); }; -MAKE_REFLECT_STRUCT(CompletionItemCapabilities, - snippetSupport, - commitCharactersSupport, - documentationFormat, - deprecatedSupport, preselectSupport); +MAKE_REFLECT_STRUCT(CompletionItemKindCapabilities, valueSet); +struct CompletionItemCapabilities +{ + // Client supports snippets as insert text. + // + // A snippet can define tab stops and placeholders with `$1`, `$2` + // and `${3:foo}`. `$0` defines the final tab stop, it defaults to + // the end of the snippet. Placeholders with equal identifiers are linked, + // that is typing in one will update others too. + optional<bool> snippetSupport; -// - // Capabilities specific to the `textDocument/completion` - // -struct CompletionCapabilities { - // Whether completion supports dynamic registration. - optional<bool> dynamicRegistration; + // Client supports commit characters on a completion item. + optional<bool> commitCharactersSupport; + // Client supports the following content formats for the documentation + // property. The order describes the preferred format of the client. - // The client supports the following `CompletionItem` specific - // capabilities. - optional<CompletionItemCapabilities> completionItem; + optional<std::vector<std::string>> documentationFormat; - // - // The client supports the following `CompletionItemKind` specific - // capabilities. - // - optional<CompletionItemKindCapabilities> completionItemKind; + // Client supports the deprecated property on a completion item. - // - // The client supports sending additional context information for a - // `textDocument/completion` request. - // - optional<bool> contextSupport; + optional<bool> deprecatedSupport; + // + // Client supports the preselect property on a completion item. + // + optional<bool> preselectSupport; - MAKE_SWAP_METHOD(CompletionCapabilities, - dynamicRegistration, - completionItem, completionItemKind); + MAKE_SWAP_METHOD( + CompletionItemCapabilities, snippetSupport, commitCharactersSupport, documentationFormat, deprecatedSupport, + preselectSupport + ); }; +MAKE_REFLECT_STRUCT( + CompletionItemCapabilities, snippetSupport, commitCharactersSupport, documentationFormat, deprecatedSupport, + preselectSupport +); -MAKE_REFLECT_STRUCT(CompletionCapabilities, - dynamicRegistration, - completionItem , completionItemKind); +// +// Capabilities specific to the `textDocument/completion` +// +struct CompletionCapabilities +{ + // Whether completion supports dynamic registration. + optional<bool> dynamicRegistration; + + // The client supports the following `CompletionItem` specific + // capabilities. + optional<CompletionItemCapabilities> completionItem; + + // + // The client supports the following `CompletionItemKind` specific + // capabilities. + // + optional<CompletionItemKindCapabilities> completionItemKind; + + // + // The client supports sending additional context information for a + // `textDocument/completion` request. + // + optional<bool> contextSupport; + + MAKE_SWAP_METHOD(CompletionCapabilities, dynamicRegistration, completionItem, completionItemKind); +}; +MAKE_REFLECT_STRUCT(CompletionCapabilities, dynamicRegistration, completionItem, completionItemKind); -struct HoverCapabilities:public DynamicRegistrationCapabilities +struct HoverCapabilities : public DynamicRegistrationCapabilities { - // - // Client supports the following content formats for the content - // property. The order describes the preferred format of the client. - // - // See {@link MarkupKind} for allowed values. - // - optional<std::vector<std::string>> contentFormat; - - MAKE_SWAP_METHOD(HoverCapabilities, dynamicRegistration, contentFormat); + // + // Client supports the following content formats for the content + // property. The order describes the preferred format of the client. + // + // See {@link MarkupKind} for allowed values. + // + optional<std::vector<std::string>> contentFormat; + + MAKE_SWAP_METHOD(HoverCapabilities, dynamicRegistration, contentFormat); }; MAKE_REFLECT_STRUCT(HoverCapabilities, dynamicRegistration, contentFormat); // - // Client capabilities specific to parameter information. - // -struct ParameterInformationCapabilities { - // - // The client supports processing label offsets instead of a - // simple label string. - // - // Since 3.14.0 - // - optional<bool> labelOffsetSupport; - - MAKE_SWAP_METHOD(ParameterInformationCapabilities, labelOffsetSupport); +// Client capabilities specific to parameter information. +// +struct ParameterInformationCapabilities +{ + // + // The client supports processing label offsets instead of a + // simple label string. + // + // Since 3.14.0 + // + optional<bool> labelOffsetSupport; + + MAKE_SWAP_METHOD(ParameterInformationCapabilities, labelOffsetSupport); }; MAKE_REFLECT_STRUCT(ParameterInformationCapabilities, labelOffsetSupport) - -struct SignatureInformationCapabilities { - // - // Client supports the following content formats for the documentation - // property. The order describes the preferred format of the client. - // - // See {@link MarkupKind} for allowed values. - // - std::vector<std::string> documentationFormat; - - // - // Client capabilities specific to parameter information. - // - ParameterInformationCapabilities parameterInformation; - - MAKE_SWAP_METHOD(SignatureInformationCapabilities, documentationFormat, parameterInformation) +struct SignatureInformationCapabilities +{ + // + // Client supports the following content formats for the documentation + // property. The order describes the preferred format of the client. + // + // See {@link MarkupKind} for allowed values. + // + std::vector<std::string> documentationFormat; + + // + // Client capabilities specific to parameter information. + // + ParameterInformationCapabilities parameterInformation; + + MAKE_SWAP_METHOD(SignatureInformationCapabilities, documentationFormat, parameterInformation) }; -MAKE_REFLECT_STRUCT(SignatureInformationCapabilities,documentationFormat, parameterInformation) +MAKE_REFLECT_STRUCT(SignatureInformationCapabilities, documentationFormat, parameterInformation) -struct SignatureHelpCapabilities :public DynamicRegistrationCapabilities +struct SignatureHelpCapabilities : public DynamicRegistrationCapabilities { - // - // The client supports the following `SignatureInformation` - // specific properties. - // - optional< SignatureInformationCapabilities > signatureInformation; + // + // The client supports the following `SignatureInformation` + // specific properties. + // + optional<SignatureInformationCapabilities> signatureInformation; - MAKE_SWAP_METHOD(SignatureHelpCapabilities, dynamicRegistration, signatureInformation) + MAKE_SWAP_METHOD(SignatureHelpCapabilities, dynamicRegistration, signatureInformation) }; MAKE_REFLECT_STRUCT(SignatureHelpCapabilities, dynamicRegistration, signatureInformation) -struct DocumentSymbolCapabilities :public DynamicRegistrationCapabilities { - // - // Specific capabilities for the `SymbolKind`. - // - optional<SymbolKindCapabilities> symbolKind; +struct DocumentSymbolCapabilities : public DynamicRegistrationCapabilities +{ + // + // Specific capabilities for the `SymbolKind`. + // + optional<SymbolKindCapabilities> symbolKind; - // - // The client support hierarchical document symbols. - // - optional<bool> hierarchicalDocumentSymbolSupport; + // + // The client support hierarchical document symbols. + // + optional<bool> hierarchicalDocumentSymbolSupport; - MAKE_SWAP_METHOD(DocumentSymbolCapabilities, dynamicRegistration, symbolKind, hierarchicalDocumentSymbolSupport) + MAKE_SWAP_METHOD(DocumentSymbolCapabilities, dynamicRegistration, symbolKind, hierarchicalDocumentSymbolSupport) }; MAKE_REFLECT_STRUCT(DocumentSymbolCapabilities, dynamicRegistration, symbolKind, hierarchicalDocumentSymbolSupport) -struct DeclarationCapabilities:public DynamicRegistrationCapabilities{ - // - // The client supports additional metadata in the form of declaration links. - // - optional<bool>linkSupport; +struct DeclarationCapabilities : public DynamicRegistrationCapabilities +{ + // + // The client supports additional metadata in the form of declaration links. + // + optional<bool> linkSupport; - MAKE_SWAP_METHOD(DeclarationCapabilities, dynamicRegistration, linkSupport); + MAKE_SWAP_METHOD(DeclarationCapabilities, dynamicRegistration, linkSupport); }; MAKE_REFLECT_STRUCT(DeclarationCapabilities, dynamicRegistration, linkSupport) - struct CodeActionKindCapabilities { - // - // The code action kind values the client supports. When this - // property exists the client also guarantees that it will - // handle values outside its set gracefully and falls back - // to a default value when unknown. - // - // See {@link CodeActionKind} for allowed values. - // - optional< std::vector< std::string> >valueSet; - - MAKE_SWAP_METHOD(CodeActionKindCapabilities, valueSet) + // + // The code action kind values the client supports. When this + // property exists the client also guarantees that it will + // handle values outside its set gracefully and falls back + // to a default value when unknown. + // + // See {@link CodeActionKind} for allowed values. + // + optional<std::vector<std::string>> valueSet; + + MAKE_SWAP_METHOD(CodeActionKindCapabilities, valueSet) }; -MAKE_REFLECT_STRUCT(CodeActionKindCapabilities,valueSet) +MAKE_REFLECT_STRUCT(CodeActionKindCapabilities, valueSet) struct CodeActionLiteralSupportCapabilities { - optional<CodeActionKindCapabilities> codeActionKind; + optional<CodeActionKindCapabilities> codeActionKind; - MAKE_SWAP_METHOD(CodeActionLiteralSupportCapabilities, codeActionKind) + MAKE_SWAP_METHOD(CodeActionLiteralSupportCapabilities, codeActionKind) }; MAKE_REFLECT_STRUCT(CodeActionLiteralSupportCapabilities, codeActionKind) -struct CodeActionCapabilities:public DynamicRegistrationCapabilities{ - // - // The client support code action literals as a valid - // response of the `textDocument/codeAction` request. - // - optional<CodeActionLiteralSupportCapabilities> codeActionLiteralSupport; +struct CodeActionCapabilities : public DynamicRegistrationCapabilities +{ + // + // The client support code action literals as a valid + // response of the `textDocument/codeAction` request. + // + optional<CodeActionLiteralSupportCapabilities> codeActionLiteralSupport; - MAKE_SWAP_METHOD(CodeActionCapabilities, dynamicRegistration, codeActionLiteralSupport) + MAKE_SWAP_METHOD(CodeActionCapabilities, dynamicRegistration, codeActionLiteralSupport) }; -MAKE_REFLECT_STRUCT(CodeActionCapabilities,dynamicRegistration,codeActionLiteralSupport) +MAKE_REFLECT_STRUCT(CodeActionCapabilities, dynamicRegistration, codeActionLiteralSupport) -struct RenameCapabilities :public DynamicRegistrationCapabilities { - // - // The client support code action literals as a valid - // response of the `textDocument/codeAction` request. - // - optional<bool> prepareSupport; +struct RenameCapabilities : public DynamicRegistrationCapabilities +{ + // + // The client support code action literals as a valid + // response of the `textDocument/codeAction` request. + // + optional<bool> prepareSupport; - MAKE_SWAP_METHOD(RenameCapabilities, dynamicRegistration, prepareSupport) + MAKE_SWAP_METHOD(RenameCapabilities, dynamicRegistration, prepareSupport) }; MAKE_REFLECT_STRUCT(RenameCapabilities, dynamicRegistration, prepareSupport) -struct DiagnosticsTagSupport { - /** +struct DiagnosticsTagSupport +{ + /** * The tags supported by the client. */ - std::vector<DiagnosticTag> valueSet; - MAKE_SWAP_METHOD(DiagnosticsTagSupport, valueSet) + std::vector<DiagnosticTag> valueSet; + MAKE_SWAP_METHOD(DiagnosticsTagSupport, valueSet) }; MAKE_REFLECT_STRUCT(DiagnosticsTagSupport, valueSet) -struct PublishDiagnosticsClientCapabilities :public DynamicRegistrationCapabilities { - /** +struct PublishDiagnosticsClientCapabilities : public DynamicRegistrationCapabilities +{ + /** * The client support code action literals as a valid * response of the `textDocument/codeAction` request. */ - optional<bool> relatedInformation; + optional<bool> relatedInformation; - /** + /** * Client supports the tag property to provide meta data about a diagnostic. * Clients supporting tags have to handle unknown tags gracefully. * @@ -398,316 +377,288 @@ struct PublishDiagnosticsClientCapabilities :public DynamicRegistrationCapabilit * * Since 3.15 */ - optional < std::pair<optional<bool>, optional<DiagnosticsTagSupport> > > tagSupport; + optional<std::pair<optional<bool>, optional<DiagnosticsTagSupport>>> tagSupport; - /** + /** * Whether the client interprets the version property of the * `textDocument/publishDiagnostics` notification's parameter. * * Since 3.15.0 */ - optional<bool> versionSupport; + optional<bool> versionSupport; - /** + /** * Client supports a codeDescription property * * @since 3.16.0 */ - optional<bool> codeDescriptionSupport ; + optional<bool> codeDescriptionSupport; - /** + /** * Whether code action supports the `data` property which is * preserved between a `textDocument/publishDiagnostics` and * `textDocument/codeAction` request. * * @since 3.16.0 */ - optional<bool> dataSupport ; - + optional<bool> dataSupport; - MAKE_SWAP_METHOD(PublishDiagnosticsClientCapabilities, dynamicRegistration, relatedInformation, tagSupport,versionSupport,codeDescriptionSupport,dataSupport) + MAKE_SWAP_METHOD( + PublishDiagnosticsClientCapabilities, dynamicRegistration, relatedInformation, tagSupport, versionSupport, + codeDescriptionSupport, dataSupport + ) }; -MAKE_REFLECT_STRUCT(PublishDiagnosticsClientCapabilities, dynamicRegistration, relatedInformation, tagSupport, versionSupport, codeDescriptionSupport, dataSupport) - - -struct FoldingRangeCapabilities :public DynamicRegistrationCapabilities { - // - // The maximum number of folding ranges that the client prefers to receive per document. The value serves as a - // hint, servers are free to follow the limit. - // - optional<int> rangeLimit; +MAKE_REFLECT_STRUCT( + PublishDiagnosticsClientCapabilities, dynamicRegistration, relatedInformation, tagSupport, versionSupport, + codeDescriptionSupport, dataSupport +) - // - // If set, the client signals that it only supports folding complete lines. If set, client will - // ignore specified `startCharacter` and `endCharacter` properties in a FoldingRange. - // - optional<bool> lineFoldingOnly; - MAKE_SWAP_METHOD(FoldingRangeCapabilities, dynamicRegistration, rangeLimit, lineFoldingOnly) +struct FoldingRangeCapabilities : public DynamicRegistrationCapabilities +{ + // + // The maximum number of folding ranges that the client prefers to receive per document. The value serves as a + // hint, servers are free to follow the limit. + // + optional<int> rangeLimit; + + // + // If set, the client signals that it only supports folding complete lines. If set, client will + // ignore specified `startCharacter` and `endCharacter` properties in a FoldingRange. + // + optional<bool> lineFoldingOnly; + MAKE_SWAP_METHOD(FoldingRangeCapabilities, dynamicRegistration, rangeLimit, lineFoldingOnly) }; -MAKE_REFLECT_STRUCT(FoldingRangeCapabilities, dynamicRegistration, rangeLimit,lineFoldingOnly) +MAKE_REFLECT_STRUCT(FoldingRangeCapabilities, dynamicRegistration, rangeLimit, lineFoldingOnly) +struct SemanticHighlightingCapabilities : public DynamicRegistrationCapabilities +{ + // + // The client support code action literals as a valid + // response of the `textDocument/codeAction` request. + // + optional<bool> semanticHighlighting; -struct SemanticHighlightingCapabilities :public DynamicRegistrationCapabilities { - // - // The client support code action literals as a valid - // response of the `textDocument/codeAction` request. - // - optional<bool> semanticHighlighting; - - MAKE_SWAP_METHOD(SemanticHighlightingCapabilities, dynamicRegistration, semanticHighlighting) + MAKE_SWAP_METHOD(SemanticHighlightingCapabilities, dynamicRegistration, semanticHighlighting) }; MAKE_REFLECT_STRUCT(SemanticHighlightingCapabilities, dynamicRegistration, semanticHighlighting) -struct SemanticTokensClientCapabilitiesRequestsFull { +struct SemanticTokensClientCapabilitiesRequestsFull +{ - // - // The client will send the `textDocument/semanticTokens/full/delta` request if - // the server provides a corresponding handler. - // - bool delta = false; - MAKE_SWAP_METHOD(SemanticTokensClientCapabilitiesRequestsFull, delta) + // + // The client will send the `textDocument/semanticTokens/full/delta` request if + // the server provides a corresponding handler. + // + bool delta = false; + MAKE_SWAP_METHOD(SemanticTokensClientCapabilitiesRequestsFull, delta) }; MAKE_REFLECT_STRUCT(SemanticTokensClientCapabilitiesRequestsFull, delta) -struct SemanticTokensClientCapabilities : public DynamicRegistrationCapabilities +struct SemanticTokensClientCapabilities : public DynamicRegistrationCapabilities { - //export TokenFormat = 'relative'; - struct lsRequests - { - // - // The client will send the `textDocument/semanticTokens/range` request - // if the server provides a corresponding handler. - // - optional<std::pair< optional<bool>, - optional<SemanticTokensClientCapabilitiesRequestsFull>>> range; - // - // The client will send the `textDocument/semanticTokens/full` request - // if the server provides a corresponding handler. - // - optional<std::pair< optional<bool>, optional<lsp::Any>>> full; - MAKE_SWAP_METHOD(lsRequests, range, full) - }; - - lsRequests requests; + //export TokenFormat = 'relative'; + struct lsRequests + { // - // The token types that the client supports. - // - std::vector<std::string> tokenTypes; - - // - // The token modifiers that the client supports. - // - std::vector<std::string> tokenModifiers; + // The client will send the `textDocument/semanticTokens/range` request + // if the server provides a corresponding handler. // - // The formats the clients supports. - // - std::vector<std::string> formats; + optional<std::pair<optional<bool>, optional<SemanticTokensClientCapabilitiesRequestsFull>>> range; // - // Whether the client supports tokens that can overlap each other. - // - optional < bool >overlappingTokenSupport; - + // The client will send the `textDocument/semanticTokens/full` request + // if the server provides a corresponding handler. // - // Whether the client supports tokens that can span multiple lines. - // - optional < bool > multilineTokenSupport; - - MAKE_SWAP_METHOD(SemanticTokensClientCapabilities, dynamicRegistration,requests, tokenTypes, tokenModifiers, - formats, overlappingTokenSupport, multilineTokenSupport) - + optional<std::pair<optional<bool>, optional<lsp::Any>>> full; + MAKE_SWAP_METHOD(lsRequests, range, full) + }; + + lsRequests requests; + // + // The token types that the client supports. + // + std::vector<std::string> tokenTypes; + + // + // The token modifiers that the client supports. + // + std::vector<std::string> tokenModifiers; + // + // The formats the clients supports. + // + std::vector<std::string> formats; + // + // Whether the client supports tokens that can overlap each other. + // + optional<bool> overlappingTokenSupport; + + // + // Whether the client supports tokens that can span multiple lines. + // + optional<bool> multilineTokenSupport; + + MAKE_SWAP_METHOD( + SemanticTokensClientCapabilities, dynamicRegistration, requests, tokenTypes, tokenModifiers, formats, + overlappingTokenSupport, multilineTokenSupport + ) }; -MAKE_REFLECT_STRUCT(SemanticTokensClientCapabilities::lsRequests, range,full) -MAKE_REFLECT_STRUCT(SemanticTokensClientCapabilities, dynamicRegistration, requests, tokenTypes, tokenModifiers, - formats, overlappingTokenSupport, multilineTokenSupport) +MAKE_REFLECT_STRUCT(SemanticTokensClientCapabilities::lsRequests, range, full) +MAKE_REFLECT_STRUCT( + SemanticTokensClientCapabilities, dynamicRegistration, requests, tokenTypes, tokenModifiers, formats, + overlappingTokenSupport, multilineTokenSupport +) // Text document specific client capabilities. -struct lsTextDocumentClientCapabilities { - - SynchronizationCapabilities synchronization; - - - // Capabilities specific to the `textDocument/completion` - optional<CompletionCapabilities> completion; - - - - // Capabilities specific to the `textDocument/hover` - optional<HoverCapabilities> hover; - - // Capabilities specific to the `textDocument/signatureHelp` - optional<SignatureHelpCapabilities> signatureHelp; - - // Capabilities specific to the `textDocument/references` - optional<DynamicRegistrationCapabilities> references; - - - - - - // Capabilities specific to the `textDocument/documentHighlight` - optional<DynamicRegistrationCapabilities> documentHighlight; - - // Capabilities specific to the `textDocument/documentSymbol` - optional<DocumentSymbolCapabilities> documentSymbol; - - // Capabilities specific to the `textDocument/formatting` - optional<DynamicRegistrationCapabilities> formatting; - - // Capabilities specific to the `textDocument/rangeFormatting` - optional<DynamicRegistrationCapabilities> rangeFormatting; - - // Capabilities specific to the `textDocument/onTypeFormatting` - optional<DynamicRegistrationCapabilities> onTypeFormatting; - - - // - // Capabilities specific to the `textDocument/declaration` - // - // Since 3.14.0 - // - optional< DeclarationCapabilities> declaration; - - - typedef DeclarationCapabilities DefinitionCapabilities; - // Capabilities specific to the `textDocument/definition` - optional<DefinitionCapabilities> definition; - - - - // -// Capabilities specific to the `textDocument/typeDefinition` -// -// Since 3.6.0 -// - typedef DeclarationCapabilities TypeDefinitionCapabilities; - optional<TypeDefinitionCapabilities> typeDefinition; - - - typedef DeclarationCapabilities ImplementationCapabilities; - // Capabilities specific to the `textDocument/implementation` - optional<ImplementationCapabilities> implementation; - - - // Capabilities specific to the `textDocument/codeAction` - optional<CodeActionCapabilities> codeAction; - - - // Capabilities specific to the `textDocument/codeLens` - optional<DynamicRegistrationCapabilities> codeLens; - - // Capabilities specific to the `textDocument/documentLink` - optional<DynamicRegistrationCapabilities> documentLink; - - // - // Capabilities specific to the `textDocument/documentColor` and the - // `textDocument/colorPresentation` request. - // - // Since 3.6.0 - // - optional<DynamicRegistrationCapabilities> colorProvider; - - // Capabilities specific to the `textDocument/rename` - optional<RenameCapabilities> rename; - -// -// Capabilities specific to `textDocument/publishDiagnostics`. -// - optional<PublishDiagnosticsClientCapabilities> publishDiagnostics; - - // -// Capabilities specific to `textDocument/foldingRange` requests. -// -// Since 3.10.0 -// - optional< FoldingRangeCapabilities > foldingRange; - - - // - // Capabilities specific to {@code textDocument/semanticHighlighting}. - // - optional< SemanticHighlightingCapabilities > semanticHighlightingCapabilities; +struct lsTextDocumentClientCapabilities +{ - // - // Capabilities specific to {@code textDocument/typeHierarchy}. - // - optional< DynamicRegistrationCapabilities > typeHierarchyCapabilities; + SynchronizationCapabilities synchronization; + // Capabilities specific to the `textDocument/completion` + optional<CompletionCapabilities> completion; + // Capabilities specific to the `textDocument/hover` + optional<HoverCapabilities> hover; - // -// Capabilities specific to `textDocument/selectionRange` requests -// + // Capabilities specific to the `textDocument/signatureHelp` + optional<SignatureHelpCapabilities> signatureHelp; + + // Capabilities specific to the `textDocument/references` + optional<DynamicRegistrationCapabilities> references; - optional< DynamicRegistrationCapabilities > selectionRange; - - // - // Capabilities specific to the `textDocument/linkedEditingRange` request. - // - // @since 3.16.0 - // - optional< DynamicRegistrationCapabilities > linkedEditingRange; - - // - // Capabilities specific to the various call hierarchy requests. - // - // @since 3.16.0 - // - optional< DynamicRegistrationCapabilities > callHierarchy; - - // - // Capabilities specific to the various semantic token requests. - // - // @since 3.16.0 - // - optional< SemanticTokensClientCapabilities > semanticTokens; - - // - // Capabilities specific to the `textDocument/moniker` request. - // - // @since 3.16.0 - // - optional< DynamicRegistrationCapabilities > moniker; - - MAKE_SWAP_METHOD(lsTextDocumentClientCapabilities, - synchronization, - completion, - hover, - signatureHelp, - implementation, - references, - documentHighlight, - documentSymbol, - formatting, - rangeFormatting, - onTypeFormatting, - declaration, - definition, typeDefinition, implementation, - codeAction, - codeLens, - documentLink, colorProvider, - rename, publishDiagnostics, foldingRange, - semanticHighlightingCapabilities, typeHierarchyCapabilities, - callHierarchy, selectionRange , linkedEditingRange, semanticTokens, moniker) + // Capabilities specific to the `textDocument/documentHighlight` + optional<DynamicRegistrationCapabilities> documentHighlight; + + // Capabilities specific to the `textDocument/documentSymbol` + optional<DocumentSymbolCapabilities> documentSymbol; + + // Capabilities specific to the `textDocument/formatting` + optional<DynamicRegistrationCapabilities> formatting; + + // Capabilities specific to the `textDocument/rangeFormatting` + optional<DynamicRegistrationCapabilities> rangeFormatting; + + // Capabilities specific to the `textDocument/onTypeFormatting` + optional<DynamicRegistrationCapabilities> onTypeFormatting; + + // + // Capabilities specific to the `textDocument/declaration` + // + // Since 3.14.0 + // + optional<DeclarationCapabilities> declaration; + + typedef DeclarationCapabilities DefinitionCapabilities; + // Capabilities specific to the `textDocument/definition` + optional<DefinitionCapabilities> definition; + + // + // Capabilities specific to the `textDocument/typeDefinition` + // + // Since 3.6.0 + // + typedef DeclarationCapabilities TypeDefinitionCapabilities; + optional<TypeDefinitionCapabilities> typeDefinition; + + typedef DeclarationCapabilities ImplementationCapabilities; + // Capabilities specific to the `textDocument/implementation` + optional<ImplementationCapabilities> implementation; + + // Capabilities specific to the `textDocument/codeAction` + optional<CodeActionCapabilities> codeAction; + + // Capabilities specific to the `textDocument/codeLens` + optional<DynamicRegistrationCapabilities> codeLens; + + // Capabilities specific to the `textDocument/documentLink` + optional<DynamicRegistrationCapabilities> documentLink; + + // + // Capabilities specific to the `textDocument/documentColor` and the + // `textDocument/colorPresentation` request. + // + // Since 3.6.0 + // + optional<DynamicRegistrationCapabilities> colorProvider; + + // Capabilities specific to the `textDocument/rename` + optional<RenameCapabilities> rename; + + // + // Capabilities specific to `textDocument/publishDiagnostics`. + // + optional<PublishDiagnosticsClientCapabilities> publishDiagnostics; + + // + // Capabilities specific to `textDocument/foldingRange` requests. + // + // Since 3.10.0 + // + optional<FoldingRangeCapabilities> foldingRange; + + // + // Capabilities specific to {@code textDocument/semanticHighlighting}. + // + optional<SemanticHighlightingCapabilities> semanticHighlightingCapabilities; + + // + // Capabilities specific to {@code textDocument/typeHierarchy}. + // + optional<DynamicRegistrationCapabilities> typeHierarchyCapabilities; + + // + // Capabilities specific to `textDocument/selectionRange` requests + // + + optional<DynamicRegistrationCapabilities> selectionRange; + + // + // Capabilities specific to the `textDocument/linkedEditingRange` request. + // + // @since 3.16.0 + // + optional<DynamicRegistrationCapabilities> linkedEditingRange; + + // + // Capabilities specific to the various call hierarchy requests. + // + // @since 3.16.0 + // + optional<DynamicRegistrationCapabilities> callHierarchy; + + // + // Capabilities specific to the various semantic token requests. + // + // @since 3.16.0 + // + optional<SemanticTokensClientCapabilities> semanticTokens; + + // + // Capabilities specific to the `textDocument/moniker` request. + // + // @since 3.16.0 + // + optional<DynamicRegistrationCapabilities> moniker; + + // + // Capabilities specific to the `textDocument/inlayHint` request. + // + // @since 3.17.0 + // + optional<InlayHintClientCapabilities> inlayHint; + + MAKE_SWAP_METHOD( + lsTextDocumentClientCapabilities, synchronization, completion, hover, signatureHelp, implementation, references, + documentHighlight, documentSymbol, formatting, rangeFormatting, onTypeFormatting, declaration, definition, + typeDefinition, implementation, codeAction, codeLens, documentLink, colorProvider, rename, publishDiagnostics, + foldingRange, semanticHighlightingCapabilities, typeHierarchyCapabilities, callHierarchy, selectionRange, + linkedEditingRange, semanticTokens, moniker, inlayHint + ) }; - -MAKE_REFLECT_STRUCT(lsTextDocumentClientCapabilities, - synchronization, - completion, - hover, - signatureHelp, - implementation, - references, - documentHighlight, - documentSymbol, - formatting, - rangeFormatting, - onTypeFormatting, - declaration, - definition, typeDefinition, implementation, - codeAction, - codeLens, - documentLink, colorProvider, - rename, publishDiagnostics, foldingRange, - semanticHighlightingCapabilities, typeHierarchyCapabilities, - callHierarchy, selectionRange, linkedEditingRange, semanticTokens, moniker) +MAKE_REFLECT_STRUCT( + lsTextDocumentClientCapabilities, synchronization, completion, hover, signatureHelp, implementation, references, + documentHighlight, documentSymbol, formatting, rangeFormatting, onTypeFormatting, declaration, definition, + typeDefinition, implementation, codeAction, codeLens, documentLink, colorProvider, rename, publishDiagnostics, + foldingRange, semanticHighlightingCapabilities, typeHierarchyCapabilities, callHierarchy, selectionRange, + linkedEditingRange, semanticTokens, moniker, inlayHint +) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsWorkspaceClientCapabilites.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsWorkspaceClientCapabilites.h index 4b48aec414..db3c4efd92 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsWorkspaceClientCapabilites.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsWorkspaceClientCapabilites.h @@ -1,7 +1,6 @@ #pragma once #include "LibLsp/lsp/method_type.h" - #include <stdexcept> #include "LibLsp/JsonRpc/message.h" @@ -21,48 +20,49 @@ struct lschangeAnnotationSupport { - /** + /** * Whether the client groups edits with equal labels into tree nodes, * for instance all edits labelled with "Changes in Strings" would * be a tree node. */ - optional<bool> groupsOnLabel; - MAKE_SWAP_METHOD(lschangeAnnotationSupport, groupsOnLabel) + optional<bool> groupsOnLabel; + MAKE_SWAP_METHOD(lschangeAnnotationSupport, groupsOnLabel) }; MAKE_REFLECT_STRUCT(lschangeAnnotationSupport, groupsOnLabel) -struct WorkspaceEditCapabilities { - /** +struct WorkspaceEditCapabilities +{ + /** * The client supports versioned document changes in `WorkspaceEdit`s */ - optional<bool> documentChanges; + optional<bool> documentChanges; - /** + /** * The client supports resource changes * in `WorkspaceEdit`s. * * @deprecated Since LSP introduces resource operations, use {link #resourceOperations} */ - optional<bool> resourceChanges; + optional<bool> resourceChanges; - /** + /** * The resource operations the client supports. Clients should at least * support 'create', 'rename' and 'delete' files and folders. * * @since 3.13.0 */ - optional< std::vector<std::string> > resourceOperations; + optional<std::vector<std::string>> resourceOperations; - /** + /** * The failure handling strategy of a client if applying the workspace edit * fails. * * See {@link FailureHandlingKind} for allowed values. */ - optional<std::string > failureHandling; + optional<std::string> failureHandling; - /** + /** * Whether the client normalizes line endings to the client specific * setting. * If set to `true` the client will normalize line ending characters @@ -70,187 +70,189 @@ struct WorkspaceEditCapabilities { * * @since 3.16.0 */ - optional<bool> normalizesLineEndings;; + optional<bool> normalizesLineEndings; + ; - /** + /** * Whether the client in general supports change annotations on text edits, * create file, rename file and delete file changes. * * @since 3.16.0 */ - optional<lschangeAnnotationSupport> changeAnnotationSupport; + optional<lschangeAnnotationSupport> changeAnnotationSupport; + + MAKE_SWAP_METHOD( + WorkspaceEditCapabilities, documentChanges, resourceChanges, resourceOperations, failureHandling, + normalizesLineEndings, changeAnnotationSupport + ) +}; +MAKE_REFLECT_STRUCT( + WorkspaceEditCapabilities, documentChanges, resourceChanges, resourceOperations, failureHandling, + normalizesLineEndings, changeAnnotationSupport +) - MAKE_SWAP_METHOD(WorkspaceEditCapabilities, documentChanges, resourceChanges, resourceOperations, failureHandling, normalizesLineEndings, changeAnnotationSupport) +struct DynamicRegistrationCapabilities +{ + // Did foo notification supports dynamic registration. + optional<bool> dynamicRegistration; + MAKE_SWAP_METHOD(DynamicRegistrationCapabilities, dynamicRegistration); }; -MAKE_REFLECT_STRUCT(WorkspaceEditCapabilities,documentChanges, resourceChanges, resourceOperations, failureHandling, normalizesLineEndings, changeAnnotationSupport) +MAKE_REFLECT_STRUCT(DynamicRegistrationCapabilities, dynamicRegistration); -struct DynamicRegistrationCapabilities { - // Did foo notification supports dynamic registration. - optional<bool> dynamicRegistration; +struct InlayHintLazyProperties +{ + optional<std::vector<std::string>> properties; - MAKE_SWAP_METHOD(DynamicRegistrationCapabilities, - dynamicRegistration); + MAKE_SWAP_METHOD(InlayHintLazyProperties, properties) }; -MAKE_REFLECT_STRUCT(DynamicRegistrationCapabilities, - dynamicRegistration); +MAKE_REFLECT_STRUCT(InlayHintLazyProperties, properties) +struct InlayHintClientCapabilities +{ + // Whether inlay hints support dynamic registration. + optional<bool> dynamicRegistration; + optional<InlayHintLazyProperties> resolveSupport; + + MAKE_SWAP_METHOD(InlayHintClientCapabilities, dynamicRegistration, resolveSupport); +}; + +MAKE_REFLECT_STRUCT(InlayHintClientCapabilities, dynamicRegistration, resolveSupport) // Workspace specific client capabilities. struct SymbolKindCapabilities { - optional< std::vector<lsSymbolKind> > valueSet; - - MAKE_SWAP_METHOD(SymbolKindCapabilities, valueSet) - + optional<std::vector<lsSymbolKind>> valueSet; + MAKE_SWAP_METHOD(SymbolKindCapabilities, valueSet) }; MAKE_REFLECT_STRUCT(SymbolKindCapabilities, valueSet) - - - -struct SymbolCapabilities :public DynamicRegistrationCapabilities { - /** +struct SymbolCapabilities : public DynamicRegistrationCapabilities +{ + /** * Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. */ - optional<SymbolKindCapabilities> symbolKind; + optional<SymbolKindCapabilities> symbolKind; - MAKE_SWAP_METHOD(SymbolCapabilities, - symbolKind, dynamicRegistration) + MAKE_SWAP_METHOD(SymbolCapabilities, symbolKind, dynamicRegistration) }; -MAKE_REFLECT_STRUCT(SymbolCapabilities, - symbolKind, dynamicRegistration) - +MAKE_REFLECT_STRUCT(SymbolCapabilities, symbolKind, dynamicRegistration) struct lsFileOperations { - /** + /** * Whether the client supports dynamic registration for file * requests/notifications. */ - optional<bool> dynamicRegistration ; + optional<bool> dynamicRegistration; - /** + /** * The client has support for sending didCreateFiles notifications. */ - optional<bool>didCreate ; + optional<bool> didCreate; - /** + /** * The client has support for sending willCreateFiles requests. */ - optional<bool>willCreate ; + optional<bool> willCreate; - /** + /** * The client has support for sending didRenameFiles notifications. */ - optional<bool>didRename ; + optional<bool> didRename; - /** + /** * The client has support for sending willRenameFiles requests. */ - optional<bool>willRename ; + optional<bool> willRename; - /** + /** * The client has support for sending didDeleteFiles notifications. */ - optional<bool>didDelete ; + optional<bool> didDelete; - /** + /** * The client has support for sending willDeleteFiles requests. */ - optional<bool> willDelete ; - MAKE_SWAP_METHOD(lsFileOperations, dynamicRegistration, didCreate, willCreate, - didRename, willRename, didDelete, willDelete) + optional<bool> willDelete; + MAKE_SWAP_METHOD( + lsFileOperations, dynamicRegistration, didCreate, willCreate, didRename, willRename, didDelete, willDelete + ) }; -MAKE_REFLECT_STRUCT(lsFileOperations, dynamicRegistration, didCreate, willCreate, - didRename, willRename, didDelete, willDelete) - -struct lsWorkspaceClientCapabilites { - // The client supports applying batch edits to the workspace. - optional<bool> applyEdit; - - - - // Capabilities specific to `WorkspaceEdit`s - optional<WorkspaceEditCapabilities> workspaceEdit; - +MAKE_REFLECT_STRUCT( + lsFileOperations, dynamicRegistration, didCreate, willCreate, didRename, willRename, didDelete, willDelete +) +struct lsWorkspaceClientCapabilites +{ + // The client supports applying batch edits to the workspace. + optional<bool> applyEdit; - // Capabilities specific to the `workspace/didChangeConfiguration` - // notification. - optional<DynamicRegistrationCapabilities> didChangeConfiguration; + // Capabilities specific to `WorkspaceEdit`s + optional<WorkspaceEditCapabilities> workspaceEdit; - // Capabilities specific to the `workspace/didChangeWatchedFiles` - // notification. - optional<DynamicRegistrationCapabilities> didChangeWatchedFiles; + // Capabilities specific to the `workspace/didChangeConfiguration` + // notification. + optional<DynamicRegistrationCapabilities> didChangeConfiguration; - // Capabilities specific to the `workspace/symbol` request. - optional<SymbolCapabilities> symbol; + // Capabilities specific to the `workspace/didChangeWatchedFiles` + // notification. + optional<DynamicRegistrationCapabilities> didChangeWatchedFiles; - // Capabilities specific to the `workspace/executeCommand` request. - optional<DynamicRegistrationCapabilities> executeCommand; + // Capabilities specific to the `workspace/symbol` request. + optional<SymbolCapabilities> symbol; + // Capabilities specific to the `workspace/executeCommand` request. + optional<DynamicRegistrationCapabilities> executeCommand; - /** + /** * The client has support for workspace folders. * * Since 3.6.0 */ - optional<bool> workspaceFolders; + optional<bool> workspaceFolders; - /** + /** * The client supports `workspace/configuration` requests. * * Since 3.6.0 */ - optional<bool> configuration; - + optional<bool> configuration; - /** + /** * Capabilities specific to the semantic token requests scoped to the * workspace. * * @since 3.16.0 */ - optional<DynamicRegistrationCapabilities> semanticTokens ; + optional<DynamicRegistrationCapabilities> semanticTokens; - /** + /** * Capabilities specific to the code lens requests scoped to the * workspace. * * @since 3.16.0 */ - optional<DynamicRegistrationCapabilities> codeLens ; + optional<DynamicRegistrationCapabilities> codeLens; - /** + /** * The client has support for file requests/notifications. * * @since 3.16.0 */ - optional<lsFileOperations> fileOperations; - - MAKE_SWAP_METHOD(lsWorkspaceClientCapabilites, - applyEdit, - workspaceEdit, - didChangeConfiguration, - didChangeWatchedFiles, - symbol,executeCommand, workspaceFolders, - configuration, semanticTokens, codeLens, fileOperations) -}; - -MAKE_REFLECT_STRUCT(lsWorkspaceClientCapabilites, - applyEdit, - workspaceEdit, - didChangeConfiguration, - didChangeWatchedFiles, - symbol, - executeCommand,workspaceFolders, - configuration, semanticTokens, codeLens, fileOperations) - - + optional<lsFileOperations> fileOperations; + MAKE_SWAP_METHOD( + lsWorkspaceClientCapabilites, applyEdit, workspaceEdit, didChangeConfiguration, didChangeWatchedFiles, symbol, + executeCommand, workspaceFolders, configuration, semanticTokens, codeLens, fileOperations + ) +}; +MAKE_REFLECT_STRUCT( + lsWorkspaceClientCapabilites, applyEdit, workspaceEdit, didChangeConfiguration, didChangeWatchedFiles, symbol, + executeCommand, workspaceFolders, configuration, semanticTokens, codeLens, fileOperations +) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/progress.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/progress.h index d21cfc52f8..536401adef 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/progress.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/progress.h @@ -6,11 +6,11 @@ //This mechanism can be used to report any kind of progress including work done //progress(usually used to report progress in the user interface using a progress bar) //and partial result progress to support streaming of results. -struct ProgressParams +struct ProgressParams { - std::pair<optional<std::string> , optional<int> > token; - lsp::Any value; - MAKE_SWAP_METHOD(ProgressParams, token, value) + std::pair<optional<std::string>, optional<int>> token; + lsp::Any value; + MAKE_SWAP_METHOD(ProgressParams, token, value) }; MAKE_REFLECT_STRUCT(ProgressParams, token, value) DEFINE_NOTIFICATION_TYPE(Notify_Progress, ProgressParams, "$/progress"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/shutdown.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/shutdown.h index 2571334503..fd8831ef39 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/shutdown.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/shutdown.h @@ -1,6 +1,5 @@ #pragma once - #include "LibLsp/JsonRpc/lsResponseMessage.h" #include "LibLsp/JsonRpc/RequestInMessage.h" @@ -12,4 +11,3 @@ */ DEFINE_REQUEST_RESPONSE_TYPE(td_shutdown, optional<JsonNull>, optional<lsp::Any>, "shutdown"); - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/language/language.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/language/language.h index 96b4b61fa9..ebde0af4b9 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/language/language.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/language/language.h @@ -10,28 +10,29 @@ #include <ppltasks.h> #endif -struct StatusReport { - - std::string ToString() const - { - std::string info; - info += "type:" + type + "\n"; - info += "message:" + message + "\n"; - return info; - } - /** +struct StatusReport +{ + + std::string ToString() const + { + std::string info; + info += "type:" + type + "\n"; + info += "message:" + message + "\n"; + return info; + } + /** * The message type. See { * */ - std::string type; - /** + std::string type; + /** * The actual message * */ - std::string message; - MAKE_SWAP_METHOD(StatusReport, type, message); + std::string message; + MAKE_SWAP_METHOD(StatusReport, type, message); }; MAKE_REFLECT_STRUCT(StatusReport, type, message); @@ -41,69 +42,65 @@ MAKE_REFLECT_STRUCT(StatusReport, type, message); */ DEFINE_NOTIFICATION_TYPE(lang_status, StatusReport, "language/status"); +enum class MessageType +{ -enum class MessageType { - - /** + /** * An error message. */ - Error=(1), + Error = (1), - /** + /** * A warning message. */ - Warning=(2), + Warning = (2), - /** + /** * An information message. */ - Info=(3), + Info = (3), - /** + /** * A log message. */ - Log=(4) + Log = (4) }; MAKE_REFLECT_TYPE_PROXY(MessageType); +struct ActionableNotification +{ -struct ActionableNotification { - - - - /** + /** * The message type. See { * */ - MessageType severity; - /** + MessageType severity; + /** * The actual message * */ - std::string message; + std::string message; - /** + /** * Optional data * */ - optional<lsp::Any> data; + optional<lsp::Any> data; - - /** + /** * Optional commands * */ - std::vector<lsCommandWithAny> commands; + std::vector<lsCommandWithAny> commands; - MAKE_SWAP_METHOD(ActionableNotification, severity, message, data, commands) + MAKE_SWAP_METHOD(ActionableNotification, severity, message, data, commands) }; MAKE_REFLECT_STRUCT(ActionableNotification, severity, message, data, commands) - /** * The actionable notification is sent from a server to a client to ask the * client to display a particular message in the user interface, and possible @@ -111,33 +108,26 @@ MAKE_REFLECT_STRUCT(ActionableNotification, severity, message, data, commands) */ DEFINE_NOTIFICATION_TYPE(lang_actionableNotification, ActionableNotification, "language/actionableNotification"); +struct ProgressReport +{ + std::string ToString() const; + std::string id; -struct ProgressReport { - std::string ToString() const; - - std::string id; - - - std::string task; - - - std::string subTask; - - - std::string status; + std::string task; - int totalWork = 0; + std::string subTask; + std::string status; - int workDone = 0; + int totalWork = 0; + int workDone = 0; - bool complete = false; - MAKE_SWAP_METHOD(ProgressReport, id, task, subTask, status, workDone, complete); + bool complete = false; + MAKE_SWAP_METHOD(ProgressReport, id, task, subTask, status, workDone, complete); }; - MAKE_REFLECT_STRUCT(ProgressReport, id, task, subTask, status, workDone, complete); /** @@ -146,24 +136,25 @@ MAKE_REFLECT_STRUCT(ProgressReport, id, task, subTask, status, workDone, complet */ DEFINE_NOTIFICATION_TYPE(lang_progressReport, ProgressReport, "language/progressReport"); -enum EventType { - /** +enum EventType +{ + /** * classpath updated event. */ - ClasspathUpdated = (100), + ClasspathUpdated = (100), - /** + /** * projects imported event. */ - ProjectsImported = (200) + ProjectsImported = (200) }; struct EventNotification { - int eventType; - lsp::Any data; - std::string ToString() const; - MAKE_SWAP_METHOD(EventNotification, eventType, data) + int eventType; + lsp::Any data; + std::string ToString() const; + MAKE_SWAP_METHOD(EventNotification, eventType, data) }; MAKE_REFLECT_STRUCT(EventNotification, eventType, data); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/location_type.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/location_type.h index f1d8070bf5..d63b2e472e 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/location_type.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/location_type.h @@ -3,61 +3,60 @@ #include "lsDocumentUri.h" #include "lsRange.h" //Represents a location inside a resource, such as a line inside a text file. -struct lsLocation { - lsLocation(); - lsLocation(lsDocumentUri uri, lsRange range); +struct lsLocation +{ + lsLocation(); + lsLocation(lsDocumentUri uri, lsRange range); - bool operator==(const lsLocation& other) const; - bool operator<(const lsLocation& o) const; + bool operator==(lsLocation const& other) const; + bool operator<(lsLocation const& o) const; - lsDocumentUri uri; - lsRange range; - MAKE_SWAP_METHOD(lsLocation, uri, range) + lsDocumentUri uri; + lsRange range; + MAKE_SWAP_METHOD(lsLocation, uri, range) }; MAKE_REFLECT_STRUCT(lsLocation, uri, range) - - -struct LinkLocation :public lsLocation +struct LinkLocation : public lsLocation { - std::string displayName; - std::string kind; - MAKE_REFLECT_STRUCT(LinkLocation, uri, range, displayName, kind) + std::string displayName; + std::string kind; + MAKE_REFLECT_STRUCT(LinkLocation, uri, range, displayName, kind) }; -MAKE_REFLECT_STRUCT(LinkLocation, uri, range, displayName,kind) +MAKE_REFLECT_STRUCT(LinkLocation, uri, range, displayName, kind) //Represents a link between a sourceand a target location. struct LocationLink { - /** + /** * Span of the origin of this link. * * Used as the underlined span for mouse interaction. Defaults to the word range at * the mouse position. */ - optional<lsRange> originSelectionRange; + optional<lsRange> originSelectionRange; - /** + /** * The target resource identifier of this link. */ - lsDocumentUri targetUri; + lsDocumentUri targetUri; - /** + /** * The full target range of this link. If the target for example is a symbol then target range is the * range enclosing this symbol not including leading/trailing whitespace but everything else * like comments. This information is typically used to highlight the range in the editor. */ - lsRange targetRange; + lsRange targetRange; - /** + /** * The range that should be selected and revealed when this link is being followed, e.g the name of a function. * Must be contained by the the `targetRange`. See also `DocumentSymbol#range` */ - lsRange targetSelectionRange; + lsRange targetSelectionRange; - MAKE_SWAP_METHOD(LocationLink, originSelectionRange, targetUri, targetRange, targetSelectionRange); + MAKE_SWAP_METHOD(LocationLink, originSelectionRange, targetUri, targetRange, targetSelectionRange); }; MAKE_REFLECT_STRUCT(LocationLink, originSelectionRange, targetUri, targetRange, targetSelectionRange); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lru_cache.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lru_cache.h index f33bc5627a..c9424918d7 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lru_cache.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lru_cache.h @@ -8,144 +8,180 @@ // Cache that evicts old entries which have not been used recently. Implemented // using array/linear search so this works well for small array sizes. -template <typename TKey, typename TValue> -struct LruCache { - explicit LruCache(int max_entries); - - // Fetches an entry for |key|. If it does not exist, |allocator| will be - // invoked to create one. - template <typename TAllocator> - TValue Get(const TKey& key, TAllocator allocator); - // Returns true if there is an entry for |key|. - bool Has(const TKey& key); - // Fetches the entry for |filename| and updates it's usage so it is less - // likely to be evicted. - bool TryGet(const TKey& key, TValue* dest); - // TryGetEntry, except the entry is removed from the cache. - bool TryTake(const TKey& key, TValue* dest); - // Inserts an entry. Evicts the oldest unused entry if there is no space. - void Insert(const TKey& key, const TValue& value); - - // Call |func| on existing entries. If |func| returns false iteration - // terminates early. - template <typename TFunc> - void IterateValues(TFunc func); - - // Empties the cache - void Clear(void); - - private: - // There is a global score counter, when we access an element we increase - // its score to the current global value, so it has the highest overall - // score. This means that the oldest/least recently accessed value has the - // lowest score. - // - // There is a bit of special logic to handle score overlow. - struct Entry { - uint32_t score = 0; - TKey key; - TValue value; - bool operator<(const Entry& other) const { return score < other.score; } - }; - - void IncrementScore(); - - std::vector<Entry> entries_; - int max_entries_ = 1; - uint32_t next_score_ = 0; +template<typename TKey, typename TValue> +struct LruCache +{ + explicit LruCache(int max_entries); + + // Fetches an entry for |key|. If it does not exist, |allocator| will be + // invoked to create one. + template<typename TAllocator> + TValue Get(TKey const& key, TAllocator allocator); + // Returns true if there is an entry for |key|. + bool Has(TKey const& key); + // Fetches the entry for |filename| and updates it's usage so it is less + // likely to be evicted. + bool TryGet(TKey const& key, TValue* dest); + // TryGetEntry, except the entry is removed from the cache. + bool TryTake(TKey const& key, TValue* dest); + // Inserts an entry. Evicts the oldest unused entry if there is no space. + void Insert(TKey const& key, TValue const& value); + + // Call |func| on existing entries. If |func| returns false iteration + // terminates early. + template<typename TFunc> + void IterateValues(TFunc func); + + // Empties the cache + void Clear(void); + +private: + // There is a global score counter, when we access an element we increase + // its score to the current global value, so it has the highest overall + // score. This means that the oldest/least recently accessed value has the + // lowest score. + // + // There is a bit of special logic to handle score overlow. + struct Entry + { + uint32_t score = 0; + TKey key; + TValue value; + bool operator<(Entry const& other) const + { + return score < other.score; + } + }; + + void IncrementScore(); + + std::vector<Entry> entries_; + int max_entries_ = 1; + uint32_t next_score_ = 0; }; -template <typename TKey, typename TValue> -LruCache<TKey, TValue>::LruCache(int max_entries) : max_entries_(max_entries) { - assert(max_entries > 0); +template<typename TKey, typename TValue> +LruCache<TKey, TValue>::LruCache(int max_entries) : max_entries_(max_entries) +{ + assert(max_entries > 0); } -template <typename TKey, typename TValue> -template <typename TAllocator> -TValue LruCache<TKey, TValue>::Get(const TKey& key, TAllocator allocator) { - for (Entry& entry : entries_) { - if (entry.key == key) - return entry.value; - } - - auto result = allocator(); - Insert(key, result); - return result; +template<typename TKey, typename TValue> +template<typename TAllocator> +TValue LruCache<TKey, TValue>::Get(TKey const& key, TAllocator allocator) +{ + for (Entry& entry : entries_) + { + if (entry.key == key) + { + return entry.value; + } + } + + auto result = allocator(); + Insert(key, result); + return result; } -template <typename TKey, typename TValue> -bool LruCache<TKey, TValue>::Has(const TKey& key) { - for (Entry& entry : entries_) { - if (entry.key == key) - return true; - } - return false; +template<typename TKey, typename TValue> +bool LruCache<TKey, TValue>::Has(TKey const& key) +{ + for (Entry& entry : entries_) + { + if (entry.key == key) + { + return true; + } + } + return false; } -template <typename TKey, typename TValue> -bool LruCache<TKey, TValue>::TryGet(const TKey& key, TValue* dest) { - // Assign new score. - for (Entry& entry : entries_) { - if (entry.key == key) { - entry.score = next_score_; - IncrementScore(); - if (dest) - *dest = entry.value; - return true; +template<typename TKey, typename TValue> +bool LruCache<TKey, TValue>::TryGet(TKey const& key, TValue* dest) +{ + // Assign new score. + for (Entry& entry : entries_) + { + if (entry.key == key) + { + entry.score = next_score_; + IncrementScore(); + if (dest) + { + *dest = entry.value; + } + return true; + } } - } - return false; + return false; } -template <typename TKey, typename TValue> -bool LruCache<TKey, TValue>::TryTake(const TKey& key, TValue* dest) { - for (size_t i = 0; i < entries_.size(); ++i) { - if (entries_[i].key == key) { - if (dest) - *dest = entries_[i].value; - entries_.erase(entries_.begin() + i); - return true; +template<typename TKey, typename TValue> +bool LruCache<TKey, TValue>::TryTake(TKey const& key, TValue* dest) +{ + for (size_t i = 0; i < entries_.size(); ++i) + { + if (entries_[i].key == key) + { + if (dest) + { + *dest = entries_[i].value; + } + entries_.erase(entries_.begin() + i); + return true; + } } - } - return false; + return false; } -template <typename TKey, typename TValue> -void LruCache<TKey, TValue>::Insert(const TKey& key, const TValue& value) { - if ((int)entries_.size() >= max_entries_) - entries_.erase(std::min_element(entries_.begin(), entries_.end())); - - Entry entry; - entry.score = next_score_; - IncrementScore(); - entry.key = key; - entry.value = value; - entries_.push_back(entry); -} +template<typename TKey, typename TValue> +void LruCache<TKey, TValue>::Insert(TKey const& key, TValue const& value) +{ + if ((int)entries_.size() >= max_entries_) + { + entries_.erase(std::min_element(entries_.begin(), entries_.end())); + } -template <typename TKey, typename TValue> -template <typename TFunc> -void LruCache<TKey, TValue>::IterateValues(TFunc func) { - for (Entry& entry : entries_) { - if (!func(entry.value)) - break; - } + Entry entry; + entry.score = next_score_; + IncrementScore(); + entry.key = key; + entry.value = value; + entries_.push_back(entry); } -template <typename TKey, typename TValue> -void LruCache<TKey, TValue>::IncrementScore() { - // Overflow. - if (++next_score_ == 0) { - std::sort(entries_.begin(), entries_.end()); +template<typename TKey, typename TValue> +template<typename TFunc> +void LruCache<TKey, TValue>::IterateValues(TFunc func) +{ for (Entry& entry : entries_) - entry.score = next_score_++; - } + { + if (!func(entry.value)) + { + break; + } + } +} + +template<typename TKey, typename TValue> +void LruCache<TKey, TValue>::IncrementScore() +{ + // Overflow. + if (++next_score_ == 0) + { + std::sort(entries_.begin(), entries_.end()); + for (Entry& entry : entries_) + { + entry.score = next_score_++; + } + } } -template <typename TKey, typename TValue> -void LruCache<TKey, TValue>::Clear(void) { - entries_.clear(); - next_score_ = 0; +template<typename TKey, typename TValue> +void LruCache<TKey, TValue>::Clear(void) +{ + entries_.clear(); + next_score_ = 0; } diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsAny.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsAny.h index 49a917e4f6..880bf7cb82 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsAny.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsAny.h @@ -5,45 +5,44 @@ #include "LibLsp/JsonRpc/message.h" namespace lsp { - struct Any - { - //! Type of JSON value - enum Type { - kUnKnown=-1, - kNullType = 0, //!< null - kFalseType = 1, //!< false - kTrueType = 2, //!< true - kObjectType = 3, //!< object - kArrayType = 4, //!< array - kStringType = 5, //!< string - kNumberType = 6 //!< number - }; - - +struct Any +{ + //! Type of JSON value + enum Type + { + kUnKnown = -1, + kNullType = 0, //!< null + kFalseType = 1, //!< false + kTrueType = 2, //!< true + kObjectType = 3, //!< object + kArrayType = 4, //!< array + kStringType = 5, //!< string + kNumberType = 6 //!< number + }; - template <typename T> - bool Get(T& value); + template<typename T> + bool Get(T& value); - template <typename T> - void Set(T& value); + template<typename T> + void Set(T& value); - int GuessType(); - int GetType(); + int GuessType(); + int GetType(); - void Set(std::unique_ptr<LspMessage> value); + void Set(std::unique_ptr<LspMessage> value); - void SetJsonString(std::string&& _data, Type _type); + void SetJsonString(std::string&& _data, Type _type); - void SetJsonString(const std::string& _data, Type _type); + void SetJsonString(std::string const& _data, Type _type); - const std::string& Data()const - { - return data; - } + std::string const& Data() const + { + return data; + } - void swap(Any& arg) noexcept; + void swap(Any& arg) noexcept; - /* + /* *Example for GetFromMap struct A{ std::string visitor; @@ -57,103 +56,103 @@ namespace lsp A a_object; any.GetFromMap(a_object); */ - template <typename T> - bool GetFromMap(T& value); - - - template <typename T> - bool GetForMapHelper(T& value); - bool GetForMapHelper(std::string& value); - bool GetForMapHelper(optional<std::string>& value); - private: - std::unique_ptr<Reader> GetReader(); - std::unique_ptr<Writer> GetWriter() const; - void SetData(std::unique_ptr<Writer>&); + template<typename T> + bool GetFromMap(T& value); - std::string data; - int jsonType = kUnKnown; + template<typename T> + bool GetForMapHelper(T& value); + bool GetForMapHelper(std::string& value); + bool GetForMapHelper(optional<std::string>& value); - }; +private: + std::unique_ptr<Reader> GetReader(); + std::unique_ptr<Writer> GetWriter() const; + void SetData(std::unique_ptr<Writer>&); + std::string data; + int jsonType = kUnKnown; }; +}; // namespace lsp extern void Reflect(Reader& visitor, lsp::Any& value); -extern void Reflect(Writer& visitor, lsp::Any& value); +extern void Reflect(Writer& visitor, lsp::Any& value); -template <typename T> -void ReflectMember(std::map < std::string, lsp::Any>& visitor, const char* name, T& value) { +template<typename T> +void ReflectMember(std::map<std::string, lsp::Any>& visitor, char const* name, T& value) +{ - auto it = visitor.find(name); - if (it != visitor.end()) - { - it->second.GetForMapHelper(value); - } -} -template <typename T> -void ReflectMember(std::map < std::string, std::string>& visitor, const char* name, T& value) { - - auto it = visitor.find(name); - if (it != visitor.end()) - { - lsp::Any any; - any.SetJsonString(it->second, static_cast<lsp::Any::Type>(-1)); - any.Get(value); - } + auto it = visitor.find(name); + if (it != visitor.end()) + { + it->second.GetForMapHelper(value); + } } +template<typename T> +void ReflectMember(std::map<std::string, std::string>& visitor, char const* name, T& value) +{ -#define REFLECT_MAP_TO_STRUCT(type, ...) \ - template <typename TVisitor> \ - void ReflectMap(TVisitor& visitor, type& value) { \ - MACRO_MAP(_MAPPABLE_REFLECT_MEMBER, __VA_ARGS__) \ - } + auto it = visitor.find(name); + if (it != visitor.end()) + { + lsp::Any any; + any.SetJsonString(it->second, static_cast<lsp::Any::Type>(-1)); + any.Get(value); + } +} +#define REFLECT_MAP_TO_STRUCT(type, ...) \ + template<typename TVisitor> \ + void ReflectMap(TVisitor& visitor, type& value) \ + { \ + MACRO_MAP(_MAPPABLE_REFLECT_MEMBER, __VA_ARGS__) \ + } namespace lsp { - template <typename T> - bool Any::Get(T& value) - { - const auto visitor = GetReader(); - Reflect(*visitor, value); - return true; - } - - template <typename T> - void Any::Set(T& value) - { - auto visitor = GetWriter(); - Reflect(*visitor, value); - SetData(visitor); - } - - template <typename T> - bool Any::GetFromMap(T& value) - { - const auto visitor = GetReader(); - std::map < std::string, lsp::Any> _temp; - Reflect(*visitor, _temp); - ReflectMap(_temp, value); - return true; - } - - template <typename T> - bool Any::GetForMapHelper(T& value) - { - jsonType = GetType(); - if (jsonType == kStringType) - { - auto copy = data; - copy.erase(copy.find_last_not_of('"') + 1); - copy.erase(0, copy.find_first_not_of('"')); - lsp::Any any; - any.SetJsonString(copy, kUnKnown); - any.Get(value); - } - else - { - Get(value); - } - return true; - } +template<typename T> +bool Any::Get(T& value) +{ + auto const visitor = GetReader(); + Reflect(*visitor, value); + return true; +} + +template<typename T> +void Any::Set(T& value) +{ + auto visitor = GetWriter(); + Reflect(*visitor, value); + SetData(visitor); +} + +template<typename T> +bool Any::GetFromMap(T& value) +{ + auto const visitor = GetReader(); + std::map<std::string, lsp::Any> _temp; + Reflect(*visitor, _temp); + ReflectMap(_temp, value); + return true; +} + +template<typename T> +bool Any::GetForMapHelper(T& value) +{ + jsonType = GetType(); + if (jsonType == kStringType) + { + auto copy = data; + copy.erase(copy.find_last_not_of('"') + 1); + copy.erase(0, copy.find_first_not_of('"')); + lsp::Any any; + any.SetJsonString(copy, kUnKnown); + any.Get(value); + } + else + { + Get(value); + } + return true; } +} // namespace lsp diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsCodeAction.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsCodeAction.h index 1b398cae2b..4ba18a6667 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsCodeAction.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsCodeAction.h @@ -2,8 +2,6 @@ #include "LibLsp/JsonRpc/serializer.h" - - #include <string> #include <vector> #include "lsPosition.h" @@ -13,46 +11,44 @@ struct CodeAction { - /** + /** * A short, human-readable, title for this code action. */ - std::string title; + std::string title; - /** + /** * The kind of the code action. * * Used to filter code actions. */ - optional < std::string> kind; + optional<std::string> kind; - /** + /** * The diagnostics that this code action resolves. */ - optional < std::vector<lsDiagnostic>> diagnostics; + optional<std::vector<lsDiagnostic>> diagnostics; - /** + /** * The workspace edit this code action performs. */ - optional < lsWorkspaceEdit >edit; + optional<lsWorkspaceEdit> edit; - /** + /** * A command this code action executes. If a code action * provides a edit and a command, first the edit is * executed and then the command. */ - optional< lsCommandWithAny > command; + optional<lsCommandWithAny> command; - MAKE_SWAP_METHOD(CodeAction, title, kind, diagnostics, edit, command) + MAKE_SWAP_METHOD(CodeAction, title, kind, diagnostics, edit, command) }; MAKE_REFLECT_STRUCT(CodeAction, title, kind, diagnostics, edit, command) struct TextDocumentCodeAction { - typedef std::pair<optional<lsCommandWithAny>, optional<CodeAction> > Either; - + typedef std::pair<optional<lsCommandWithAny>, optional<CodeAction>> Either; }; - -extern void Reflect(Reader& visitor, TextDocumentCodeAction::Either& value); +extern void Reflect(Reader& visitor, TextDocumentCodeAction::Either& value); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsCommand.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsCommand.h index 2d624c3d99..826c7abe44 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsCommand.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsCommand.h @@ -2,8 +2,6 @@ #include "LibLsp/JsonRpc/serializer.h" - - #include <string> #include <vector> #include "lsAny.h" @@ -12,33 +10,34 @@ //Commands are identified by a string identifier. //The recommended way to handle commands is to implement their execution on the server side //if the clientand server provides the corresponding capabilities.Alternatively the tool -//extension code could handle the command.The protocol currently doesn¡¯t specify a set of well - known commands. -template <typename AnyArray> -struct lsCommand { - // Title of the command (ie, 'save') - std::string title; - // Actual command identifier. - std::string command; - // Arguments to run the command with. - // **NOTE** This must be serialized as an array. Use - // MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY. - optional<AnyArray> arguments; +//extension code could handle the command.The protocol currently doesn't specify a set of well - known commands. +template<typename AnyArray> +struct lsCommand +{ + // Title of the command (ie, 'save') + std::string title; + // Actual command identifier. + std::string command; + // Arguments to run the command with. + // **NOTE** This must be serialized as an array. Use + // MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY. + optional<AnyArray> arguments; - void swap(lsCommand<AnyArray>& arg) noexcept - { - title.swap(arg.title); - command.swap(arg.command); - arguments.swap(arg.arguments); - } + void swap(lsCommand<AnyArray>& arg) noexcept + { + title.swap(arg.title); + command.swap(arg.command); + arguments.swap(arg.arguments); + } }; -template <typename TVisitor, typename T> -void Reflect(TVisitor& visitor, lsCommand<T>& value) { - REFLECT_MEMBER_START(); - REFLECT_MEMBER(title); - REFLECT_MEMBER(command); - REFLECT_MEMBER(arguments); - REFLECT_MEMBER_END(); +template<typename TVisitor, typename T> +void Reflect(TVisitor& visitor, lsCommand<T>& value) +{ + REFLECT_MEMBER_START(); + REFLECT_MEMBER(title); + REFLECT_MEMBER(command); + REFLECT_MEMBER(arguments); + REFLECT_MEMBER_END(); } - -using lsCommandWithAny = lsCommand< std::vector<lsp::Any>>; +using lsCommandWithAny = lsCommand<std::vector<lsp::Any>>; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsDocumentUri.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsDocumentUri.h index 255c4c39ba..d47e7ac2b3 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsDocumentUri.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsDocumentUri.h @@ -1,26 +1,27 @@ #pragma once #include "LibLsp/JsonRpc/serializer.h" #include <string> -struct lsDocumentUri { - static lsDocumentUri FromPath(const AbsolutePath& path); +struct lsDocumentUri +{ + static lsDocumentUri FromPath(AbsolutePath const& path); - lsDocumentUri(); + lsDocumentUri(); - lsDocumentUri(const AbsolutePath& path); - lsDocumentUri(const lsDocumentUri& other);; - bool operator==(const lsDocumentUri& other) const; - bool operator==(const std::string& other) const; - void SetPath(const AbsolutePath& path); - std::string GetRawPath() const; - AbsolutePath GetAbsolutePath() const; + lsDocumentUri(AbsolutePath const& path); + lsDocumentUri(lsDocumentUri const& other); + ; + bool operator==(lsDocumentUri const& other) const; + bool operator==(std::string const& other) const; + void SetPath(AbsolutePath const& path); + std::string GetRawPath() const; + AbsolutePath GetAbsolutePath() const; - - std::string raw_uri_; - void swap(lsDocumentUri& arg) noexcept - { - raw_uri_.swap(arg.raw_uri_); - } + std::string raw_uri_; + void swap(lsDocumentUri& arg) noexcept + { + raw_uri_.swap(arg.raw_uri_); + } }; extern void Reflect(Writer& visitor, lsDocumentUri& value); extern void Reflect(Reader& visitor, lsDocumentUri& value); -extern std::string make_file_scheme_uri(const std::string& absolute_path); +extern std::string make_file_scheme_uri(std::string const& absolute_path); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsFormattingOptions.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsFormattingOptions.h index 0c3999896b..25ebd13e35 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsFormattingOptions.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsFormattingOptions.h @@ -2,42 +2,48 @@ #include "LibLsp/JsonRpc/serializer.h" -struct lsFormattingOptions { - struct KeyData { - optional<bool> _boolean; - optional<int32_t> _integer; - optional<std::string> _string; - }; +struct lsFormattingOptions +{ + struct KeyData + { + optional<bool> _boolean; + optional<int32_t> _integer; + optional<std::string> _string; + }; - // Size of a tab in spaces. - int tabSize =4; - // Prefer spaces over tabs. - bool insertSpaces = true; + // Size of a tab in spaces. + int tabSize = 4; + // Prefer spaces over tabs. + bool insertSpaces = true; - /** + /** * Trim trailing whitespace on a line. * * @since 3.15.0 */ - optional<bool> trimTrailingWhitespace; + optional<bool> trimTrailingWhitespace; - /** + /** * Insert a newline character at the end of the file if one does not exist. * * @since 3.15.0 */ - optional<bool> insertFinalNewline; + optional<bool> insertFinalNewline; - /** + /** * Trim all newlines after the final newline at the end of the file. * * @since 3.15.0 */ - optional<bool> trimFinalNewlines; - optional<KeyData> key; - MAKE_SWAP_METHOD(lsFormattingOptions, tabSize, insertSpaces, trimTrailingWhitespace, insertFinalNewline, trimFinalNewlines, key) + optional<bool> trimFinalNewlines; + optional<KeyData> key; + MAKE_SWAP_METHOD( + lsFormattingOptions, tabSize, insertSpaces, trimTrailingWhitespace, insertFinalNewline, trimFinalNewlines, key + ) }; -MAKE_REFLECT_STRUCT(lsFormattingOptions, tabSize, insertSpaces, trimTrailingWhitespace, insertFinalNewline, trimFinalNewlines, key); +MAKE_REFLECT_STRUCT( + lsFormattingOptions, tabSize, insertSpaces, trimTrailingWhitespace, insertFinalNewline, trimFinalNewlines, key +); extern void Reflect(Reader& visitor, lsFormattingOptions::KeyData& value); -extern void Reflect(Writer& visitor, lsFormattingOptions::KeyData& value); +extern void Reflect(Writer& visitor, lsFormattingOptions::KeyData& value); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsMarkedString.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsMarkedString.h index 8478c055c5..45381e8e2d 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsMarkedString.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsMarkedString.h @@ -5,7 +5,6 @@ #include <string> #include <vector> - // MarkedString can be used to render human readable text. It is either a // markdown string or a code-block that provides a language and a code snippet. // The language identifier is sematically equal to the optional language @@ -19,27 +18,29 @@ // // Note that markdown strings will be sanitized - that means html will be // escaped. -struct lsMarkedString { - optional<std::string> language; - std::string value; +struct lsMarkedString +{ + optional<std::string> language; + std::string value; }; -struct MarkupContent { - /** +struct MarkupContent +{ + /** * The type of the Markup. */ - std::string kind; + std::string kind; - /** + /** * The content itself. */ - std::string value; + std::string value; - MAKE_SWAP_METHOD(MarkupContent, kind, value); + MAKE_SWAP_METHOD(MarkupContent, kind, value); }; -MAKE_REFLECT_STRUCT(MarkupContent,kind,value); +MAKE_REFLECT_STRUCT(MarkupContent, kind, value); void Reflect(Writer& visitor, lsMarkedString& value); void Reflect(Reader& visitor, lsMarkedString& value); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsPosition.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsPosition.h index a14d75ed90..608ab01f15 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsPosition.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsPosition.h @@ -2,29 +2,28 @@ #include "LibLsp/JsonRpc/serializer.h" - - #include <string> #include <vector> //Position in a text document expressed as zero - based line and zero - based character offset. -//A position is between two characters like an ¡®insert¡¯ cursor in a editor.Special values like +//A position is between two characters like an insert cursor in a editor.Special values like //for example - 1 to denote the end of a line are not supported. -struct lsPosition { - lsPosition(); - lsPosition(int line, int character); +struct lsPosition +{ + lsPosition(); + lsPosition(int line, int character); - bool operator==(const lsPosition& other) const; - bool operator<(const lsPosition& other) const; + bool operator==(lsPosition const& other) const; + bool operator<(lsPosition const& other) const; - std::string ToString() const; + std::string ToString() const; - /** + /** * Line position in a document (zero-based). */ - // Note: these are 0-based. - unsigned line = 0; - /** + // Note: these are 0-based. + unsigned line = 0; + /** * Character offset on a line in a document (zero-based). Assuming that * the line is represented as a string, the `character` value represents * the gap between the `character` and `character + 1`. @@ -32,9 +31,9 @@ struct lsPosition { * If the character value is greater than the line length it defaults back * to the line length. */ - unsigned character = 0; - static const lsPosition kZeroPosition; + unsigned character = 0; + static lsPosition const kZeroPosition; - MAKE_SWAP_METHOD(lsPosition, line, character) + MAKE_SWAP_METHOD(lsPosition, line, character) }; MAKE_REFLECT_STRUCT(lsPosition, line, character); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsRange.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsRange.h index 97d78712d7..ff1715761b 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsRange.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsRange.h @@ -2,8 +2,6 @@ #include "LibLsp/JsonRpc/serializer.h" - - #include <string> #include <vector> #include "lsPosition.h" @@ -11,22 +9,23 @@ //A range is comparable to a selection in an editor.Therefore the end position is exclusive. //If you want to specify a range that contains a line including the line ending character(s) //then use an end position denoting the start of the next line. -struct lsRange { - lsRange(); - lsRange(lsPosition start, lsPosition end); +struct lsRange +{ + lsRange(); + lsRange(lsPosition start, lsPosition end); - bool operator==(const lsRange& other) const; - bool operator<(const lsRange& other) const; - /** + bool operator==(lsRange const& other) const; + bool operator<(lsRange const& other) const; + /** * The range's start position. */ - lsPosition start; - /** + lsPosition start; + /** * The range's end position. */ - lsPosition end; - std::string ToString()const; - MAKE_SWAP_METHOD(lsRange, start, end) + lsPosition end; + std::string ToString() const; + MAKE_SWAP_METHOD(lsRange, start, end) }; MAKE_REFLECT_STRUCT(lsRange, start, end) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsResponseError.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsResponseError.h index 254e76f757..9ebe804cef 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsResponseError.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsResponseError.h @@ -4,15 +4,16 @@ #include <sstream> #include "LibLsp/lsp/lsAny.h" -enum class lsErrorCodes:int32_t { - // Defined by JSON RPC - ParseError = -32700, - InvalidRequest = -32600, - MethodNotFound = -32601, - InvalidParams = -32602, - InternalError = -32603, - - /** +enum class lsErrorCodes : int32_t +{ + // Defined by JSON RPC + ParseError = -32700, + InvalidRequest = -32600, + MethodNotFound = -32601, + InvalidParams = -32602, + InternalError = -32603, + + /** * This is the start range of JSON RPC reserved error codes. * It doesn't denote a real error code. No LSP error codes should * be defined between the start and end range. For backwards @@ -21,45 +22,45 @@ enum class lsErrorCodes:int32_t { * * @since 3.16.0 */ - jsonrpcReservedErrorRangeStart = -32099, - /** @deprecated use jsonrpcReservedErrorRangeStart */ - serverErrorStart = jsonrpcReservedErrorRangeStart, + jsonrpcReservedErrorRangeStart = -32099, + /** @deprecated use jsonrpcReservedErrorRangeStart */ + serverErrorStart = jsonrpcReservedErrorRangeStart, - /** + /** * This is the start range of JSON RPC reserved error codes. * It doesn't denote a real error code. * * @since 3.16.0 */ - jsonrpcReservedErrorRangeEnd = -32000, - /** @deprecated use jsonrpcReservedErrorRangeEnd */ - serverErrorEnd = jsonrpcReservedErrorRangeEnd, + jsonrpcReservedErrorRangeEnd = -32000, + /** @deprecated use jsonrpcReservedErrorRangeEnd */ + serverErrorEnd = jsonrpcReservedErrorRangeEnd, - /** + /** * Error code indicating that a server received a notification or * request before the server has received the `initialize` request. */ - ServerNotInitialized = -32002, - UnknownErrorCode = -32001, + ServerNotInitialized = -32002, + UnknownErrorCode = -32001, - /** + /** * This is the start range of LSP reserved error codes. * It doesn't denote a real error code. * * @since 3.16.0 */ - lspReservedErrorRangeStart= -32899, + lspReservedErrorRangeStart = -32899, - /** + /** * The server cancelled the request. This error code should * only be used for requests that explicitly support being * server cancellable. * * @since 3.17.0 */ - ServerCancelled = -32802, + ServerCancelled = -32802, - /** + /** * The server detected that the content of a document got * modified outside normal conditions. A server should * NOT send this error code if it detects a content change @@ -69,49 +70,47 @@ enum class lsErrorCodes:int32_t { * If a client decides that a result is not of any use anymore * the client should cancel the request. */ - ContentModified = -32801, + ContentModified = -32801, - /** + /** * The client has canceled a request and a server as detected * the cancel. */ - RequestCancelled = -32800, + RequestCancelled = -32800, - /** + /** * This is the end range of LSP reserved error codes. * It doesn't denote a real error code. * * @since 3.16.0 */ - lspReservedErrorRangeEnd = -32800, - - - + lspReservedErrorRangeEnd = -32800, }; MAKE_REFLECT_TYPE_PROXY(lsErrorCodes); -struct lsResponseError { - lsResponseError(): code(lsErrorCodes::UnknownErrorCode) - { - } +struct lsResponseError +{ + lsResponseError() : code(lsErrorCodes::UnknownErrorCode) + { + } - /** + /** * A number indicating the error type that occurred. */ - lsErrorCodes code; - // Short description. - /** + lsErrorCodes code; + // Short description. + /** * A string providing a short description of the error. */ - std::string message; + std::string message; - /** + /** * A primitive or structured value that contains additional * information about the error. Can be omitted. */ - optional<lsp::Any> data; - std::string ToString(); - void Write(Writer& visitor); + optional<lsp::Any> data; + std::string ToString(); + void Write(Writer& visitor); - MAKE_SWAP_METHOD(lsResponseError, code, message, data) + MAKE_SWAP_METHOD(lsResponseError, code, message, data) }; MAKE_REFLECT_STRUCT(lsResponseError, code, message, data) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentEdit.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentEdit.h index bebbcd48c2..bf614e39fc 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentEdit.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentEdit.h @@ -6,19 +6,19 @@ #include "lsVersionedTextDocumentIdentifier.h" #include "lsTextEdit.h" +struct lsTextDocumentEdit +{ + // The text document to change. + lsVersionedTextDocumentIdentifier textDocument; -struct lsTextDocumentEdit { - // The text document to change. - lsVersionedTextDocumentIdentifier textDocument; - - /** + /** * The edits to be applied. * * @since 3.16.0 - support for AnnotatedTextEdit. This is guarded by the * client capability `workspace.workspaceEdit.changeAnnotationSupport` */ - // The edits to be applied. - std::vector< lsAnnotatedTextEdit > edits; - MAKE_SWAP_METHOD(lsTextDocumentEdit, textDocument, edits); + // The edits to be applied. + std::vector<lsAnnotatedTextEdit> edits; + MAKE_SWAP_METHOD(lsTextDocumentEdit, textDocument, edits); }; MAKE_REFLECT_STRUCT(lsTextDocumentEdit, textDocument, edits); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentIdentifier.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentIdentifier.h index 0129df9b99..09927478a9 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentIdentifier.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentIdentifier.h @@ -4,11 +4,12 @@ #include "lsDocumentUri.h" //Text documents are identified using a URI.On the protocol level, //URIs are passed as strings.The corresponding JSON structure looks like this: -struct lsTextDocumentIdentifier { - /** +struct lsTextDocumentIdentifier +{ + /** * The text document's URI. */ - lsDocumentUri uri; + lsDocumentUri uri; MAKE_SWAP_METHOD(lsTextDocumentIdentifier, uri) }; MAKE_REFLECT_STRUCT(lsTextDocumentIdentifier, uri) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentItem.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentItem.h index c5bc915132..365054c453 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentItem.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentItem.h @@ -6,21 +6,22 @@ #include "lsDocumentUri.h" //An item to transfer a text document from the client to the server. -struct lsTextDocumentItem { - // The text document's URI. - lsDocumentUri uri; +struct lsTextDocumentItem +{ + // The text document's URI. + lsDocumentUri uri; - // The text document's language identifier. - std::string languageId; + // The text document's language identifier. + std::string languageId; - // The version number of this document (it will strictly increase after each - // change, including undo/redo). - int version = 0; + // The version number of this document (it will strictly increase after each + // change, including undo/redo). + int version = 0; - // The content of the opened text document. - std::string text; + // The content of the opened text document. + std::string text; - MAKE_SWAP_METHOD(lsTextDocumentItem, uri, languageId, version, text) + MAKE_SWAP_METHOD(lsTextDocumentItem, uri, languageId, version, text) }; MAKE_REFLECT_STRUCT(lsTextDocumentItem, uri, languageId, version, text) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentPositionParams.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentPositionParams.h index a46fa22a9e..ce6b3495c8 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentPositionParams.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentPositionParams.h @@ -8,19 +8,19 @@ /** * A parameter literal used in requests to pass a text document and a position inside that document. */ -struct lsTextDocumentPositionParams { - // The text document. - lsTextDocumentIdentifier textDocument; +struct lsTextDocumentPositionParams +{ + // The text document. + lsTextDocumentIdentifier textDocument; - // The position inside the text document. - lsPosition position; + // The position inside the text document. + lsPosition position; - /** + /** * Legacy property to support protocol version 1.0 requests. */ - optional<lsDocumentUri> uri; - - MAKE_SWAP_METHOD(lsTextDocumentPositionParams, textDocument, position, uri); + optional<lsDocumentUri> uri; + MAKE_SWAP_METHOD(lsTextDocumentPositionParams, textDocument, position, uri); }; MAKE_REFLECT_STRUCT(lsTextDocumentPositionParams, textDocument, position, uri); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextEdit.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextEdit.h index 29699c9c31..a6ec3e913f 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextEdit.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsTextEdit.h @@ -2,12 +2,9 @@ #include "LibLsp/JsonRpc/serializer.h" - - #include <string> #include "lsRange.h" - //Since 3.16.0 there is also the concept of an annotated text edit which supports to add an annotation to a text edit. //The annotation can add information describing the change to the text edit. /** @@ -17,28 +14,27 @@ */ struct lsChangeAnnotation { - /** + /** * A human-readable string describing the actual change. The string * is rendered prominent in the user interface. */ - std::string label; + std::string label; - /** + /** * A flag which indicates that user confirmation is needed * before applying the change. */ - optional<bool> needsConfirmation; + optional<bool> needsConfirmation; - /** + /** * A human-readable string which is rendered less prominent in * the user interface. */ - optional < std::string > description; - MAKE_REFLECT_STRUCT(lsChangeAnnotation, label, needsConfirmation, description) + optional<std::string> description; + MAKE_REFLECT_STRUCT(lsChangeAnnotation, label, needsConfirmation, description) }; MAKE_REFLECT_STRUCT(lsChangeAnnotation, label, needsConfirmation, description) - //Usually clients provide options to group the changes along the annotations they are associated with. //To support this in the protocol an edit or resource operation refers to a change annotation //using an identifier and not the change annotation literal directly.This allows servers to use @@ -46,8 +42,6 @@ MAKE_REFLECT_STRUCT(lsChangeAnnotation, label, needsConfirmation, description) //to group the operations under that change annotation.The actual change annotations together with //their identifers are managed by the workspace edit via the new property changeAnnotations. - - /** * An identifier referring to a change annotation managed by a workspace * edit. @@ -61,27 +55,26 @@ using lsChangeAnnotationIdentifier = std::string; * @since 3.16.0. */ - //A textual edit applicable to a text document. -struct lsTextEdit { - // The range of the text document to be manipulated. To insert - // text into a document create a range where start === end. - lsRange range; +struct lsTextEdit +{ + // The range of the text document to be manipulated. To insert + // text into a document create a range where start === end. + lsRange range; - // The string to be inserted. For delete operations use an - // empty string. - std::string newText; + // The string to be inserted. For delete operations use an + // empty string. + std::string newText; - /** + /** * The actual annotation identifier. */ - optional<lsChangeAnnotationIdentifier> annotationId; - + optional<lsChangeAnnotationIdentifier> annotationId; - bool operator==(const lsTextEdit& that); - std::string ToString() const; - MAKE_SWAP_METHOD(lsTextEdit, range, newText, annotationId) + bool operator==(lsTextEdit const& that); + std::string ToString() const; + MAKE_SWAP_METHOD(lsTextEdit, range, newText, annotationId) }; MAKE_REFLECT_STRUCT(lsTextEdit, range, newText, annotationId) -using lsAnnotatedTextEdit = lsTextEdit; +using lsAnnotatedTextEdit = lsTextEdit; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsVersionedTextDocumentIdentifier.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsVersionedTextDocumentIdentifier.h index 2b17a4fb0b..bf687f2cc7 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsVersionedTextDocumentIdentifier.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsVersionedTextDocumentIdentifier.h @@ -8,13 +8,13 @@ struct lsVersionedTextDocumentIdentifier { - lsDocumentUri uri; - // The version number of this document. number | null - optional<int> version; + lsDocumentUri uri; + // The version number of this document. number | null + optional<int> version; - lsTextDocumentIdentifier AsTextDocumentIdentifier() const; + lsTextDocumentIdentifier AsTextDocumentIdentifier() const; - MAKE_SWAP_METHOD(lsVersionedTextDocumentIdentifier, uri, version) + MAKE_SWAP_METHOD(lsVersionedTextDocumentIdentifier, uri, version) }; MAKE_REFLECT_STRUCT(lsVersionedTextDocumentIdentifier, uri, version) @@ -29,4 +29,4 @@ MAKE_REFLECT_STRUCT(lsVersionedTextDocumentIdentifier, uri, version) * The version number of a document will increase after each change, * including undo/redo. The number doesn't need to be consecutive. */ -using lsOptionalVersionedTextDocumentIdentifier = lsVersionedTextDocumentIdentifier; +using lsOptionalVersionedTextDocumentIdentifier = lsVersionedTextDocumentIdentifier; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsWorkspaceEdit.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsWorkspaceEdit.h index 4caf296c28..83c077d9e5 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsWorkspaceEdit.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsWorkspaceEdit.h @@ -16,28 +16,27 @@ //txt.An invalid sequence(e.g. (1) delete file a.txt and (2) insert text into file a.txt) will cause failure of the operation. //How the client recovers from the failure is described by the client capability : workspace.workspaceEdit.failureHandling - - struct lsChangeAnnotations { - lsChangeAnnotation id; - MAKE_SWAP_METHOD(lsChangeAnnotations, id) + lsChangeAnnotation id; + MAKE_SWAP_METHOD(lsChangeAnnotations, id) }; MAKE_REFLECT_STRUCT(lsChangeAnnotations, id) -struct lsWorkspaceEdit { - // Holds changes to existing resources. - // changes ? : { [uri:string]: TextEdit[]; }; - // std::unordered_map<lsDocumentUri, std::vector<lsTextEdit>> changes; - - // An array of `TextDocumentEdit`s to express changes to specific a specific - // version of a text document. Whether a client supports versioned document - // edits is expressed via `WorkspaceClientCapabilites.versionedWorkspaceEdit`. - // - optional< std::map<std::string, std::vector<lsTextEdit> > > changes; - typedef std::pair < optional<lsTextDocumentEdit>, optional<lsp::Any> > Either; - - optional < std::vector< Either > > documentChanges; - /** +struct lsWorkspaceEdit +{ + // Holds changes to existing resources. + // changes ? : { [uri:string]: TextEdit[]; }; + // std::unordered_map<lsDocumentUri, std::vector<lsTextEdit>> changes; + + // An array of `TextDocumentEdit`s to express changes to specific a specific + // version of a text document. Whether a client supports versioned document + // edits is expressed via `WorkspaceClientCapabilites.versionedWorkspaceEdit`. + // + optional<std::map<std::string, std::vector<lsTextEdit>>> changes; + typedef std::pair<optional<lsTextDocumentEdit>, optional<lsp::Any>> Either; + + optional<std::vector<Either>> documentChanges; + /** * A map of change annotations that can be referenced in * `AnnotatedTextEdit`s or create, rename and delete file / folder * operations. @@ -47,11 +46,10 @@ struct lsWorkspaceEdit { * * @since 3.16.0 */ - optional< lsChangeAnnotations > changeAnnotations; + optional<lsChangeAnnotations> changeAnnotations; - MAKE_SWAP_METHOD(lsWorkspaceEdit, changes, documentChanges, changeAnnotations) + MAKE_SWAP_METHOD(lsWorkspaceEdit, changes, documentChanges, changeAnnotations) }; MAKE_REFLECT_STRUCT(lsWorkspaceEdit, changes, documentChanges, changeAnnotations) extern void Reflect(Reader& visitor, lsWorkspaceEdit::Either& value); - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_code_action.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_code_action.h index 2d5c7111fb..5f4e143001 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_code_action.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_code_action.h @@ -1,64 +1,77 @@ #pragma once - #include "location_type.h" #include "lsDocumentUri.h" #include "lsTextEdit.h" #include "lsPosition.h" // codeAction -struct CommandArgs { - lsDocumentUri textDocumentUri; - std::vector<lsTextEdit> edits; +struct CommandArgs +{ + lsDocumentUri textDocumentUri; + std::vector<lsTextEdit> edits; }; MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY(CommandArgs, textDocumentUri, edits); -inline void Reflect(Reader& visitor, CommandArgs& value) { - int i = 0; - visitor.IterArray([&](Reader& visitor) { - switch (i++) { - case 0: - Reflect(visitor, value.textDocumentUri); - break; - case 1: - Reflect(visitor, value.edits); - break; - - } - }); +inline void Reflect(Reader& visitor, CommandArgs& value) +{ + int i = 0; + visitor.IterArray( + [&](Reader& visitor) + { + switch (i++) + { + case 0: + Reflect(visitor, value.textDocumentUri); + break; + case 1: + Reflect(visitor, value.edits); + break; + } + } + ); } // codeLens -struct lsCodeLensUserData {}; +struct lsCodeLensUserData +{ +}; MAKE_REFLECT_EMPTY_STRUCT(lsCodeLensUserData); -struct lsCodeLensCommandArguments { - lsDocumentUri uri; - lsPosition position; - std::vector<lsLocation> locations; +struct lsCodeLensCommandArguments +{ + lsDocumentUri uri; + lsPosition position; + std::vector<lsLocation> locations; }; // FIXME Don't use array in vscode-cquery -inline void Reflect(Writer& visitor, lsCodeLensCommandArguments& value) { - visitor.StartArray(3); - Reflect(visitor, value.uri); - Reflect(visitor, value.position); - Reflect(visitor, value.locations); - visitor.EndArray(); +inline void Reflect(Writer& visitor, lsCodeLensCommandArguments& value) +{ + visitor.StartArray(3); + Reflect(visitor, value.uri); + Reflect(visitor, value.position); + Reflect(visitor, value.locations); + visitor.EndArray(); } -inline void Reflect(Reader& visitor, lsCodeLensCommandArguments& value) { - int i = 0; - visitor.IterArray([&](Reader& visitor) { - switch (i++) { - case 0: - Reflect(visitor, value.uri); - break; - case 1: - Reflect(visitor, value.position); - break; - case 2: - Reflect(visitor, value.locations); - break; - } - }); +inline void Reflect(Reader& visitor, lsCodeLensCommandArguments& value) +{ + int i = 0; + visitor.IterArray( + [&](Reader& visitor) + { + switch (i++) + { + case 0: + Reflect(visitor, value.uri); + break; + case 1: + Reflect(visitor, value.position); + break; + case 2: + Reflect(visitor, value.locations); + break; + } + } + ); } diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_completion.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_completion.h index fca45e9cb7..0f54f173c5 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_completion.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_completion.h @@ -3,150 +3,147 @@ #include "lsMarkedString.h" #include "lsCommand.h" - // The kind of a completion entry. -enum class lsCompletionItemKind { - Text = 1, - Method = 2, - Function = 3, - Constructor = 4, - Field = 5, - Variable = 6, - Class = 7, - Interface = 8, - Module = 9, - Property = 10, - Unit = 11, - Value = 12, - Enum = 13, - Keyword = 14, - Snippet = 15, - Color = 16, - File = 17, - Reference = 18, - Folder = 19, - EnumMember = 20, - Constant = 21, - Struct = 22, - Event = 23, - Operator = 24, - TypeParameter = 25, +enum class lsCompletionItemKind +{ + Text = 1, + Method = 2, + Function = 3, + Constructor = 4, + Field = 5, + Variable = 6, + Class = 7, + Interface = 8, + Module = 9, + Property = 10, + Unit = 11, + Value = 12, + Enum = 13, + Keyword = 14, + Snippet = 15, + Color = 16, + File = 17, + Reference = 18, + Folder = 19, + EnumMember = 20, + Constant = 21, + Struct = 22, + Event = 23, + Operator = 24, + TypeParameter = 25, }; MAKE_REFLECT_TYPE_PROXY(lsCompletionItemKind); - - // Defines whether the insert text in a completion item should be interpreted as // plain text or a snippet. -enum class lsInsertTextFormat { - // The primary text to be inserted is treated as a plain string. - PlainText = 1, - - // The primary text to be inserted is treated as a snippet. - // - // A snippet can define tab stops and placeholders with `$1`, `$2` - // and `${3:foo}`. `$0` defines the final tab stop, it defaults to - // the end of the snippet. Placeholders with equal identifiers are linked, - // that is typing in one will update others too. - // - // See also: - // https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md - Snippet = 2 +enum class lsInsertTextFormat +{ + // The primary text to be inserted is treated as a plain string. + PlainText = 1, + + // The primary text to be inserted is treated as a snippet. + // + // A snippet can define tab stops and placeholders with `$1`, `$2` + // and `${3:foo}`. `$0` defines the final tab stop, it defaults to + // the end of the snippet. Placeholders with equal identifiers are linked, + // that is typing in one will update others too. + // + // See also: + // https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md + Snippet = 2 }; MAKE_REFLECT_TYPE_PROXY(lsInsertTextFormat); namespace lsp { - std::string ToString(lsCompletionItemKind); - std::string ToString(lsInsertTextFormat); -} +std::string ToString(lsCompletionItemKind); +std::string ToString(lsInsertTextFormat); +} // namespace lsp /** * The Completion request is sent from the client to the server to compute completion items at a given cursor position. * Completion items are presented in the IntelliSense user class. If computing complete completion items is expensive * servers can additional provide a handler for the resolve completion item request. This request is send when a * completion item is selected in the user class. */ -struct lsCompletionItem { - - // The label of this completion item. By default - // also the text that is inserted when selecting - // this completion. - std::string label; +struct lsCompletionItem +{ - // The kind of this completion item. Based of the kind - // an icon is chosen by the editor. - optional<lsCompletionItemKind> kind ; + // The label of this completion item. By default + // also the text that is inserted when selecting + // this completion. + std::string label; - // A human-readable string with additional information - // about this item, like type or symbol information. - optional < std::string > detail; + // The kind of this completion item. Based of the kind + // an icon is chosen by the editor. + optional<lsCompletionItemKind> kind; - // A human-readable string that represents a doc-comment. - optional< std::pair<optional< std::string> , optional<MarkupContent> > > documentation; + // A human-readable string with additional information + // about this item, like type or symbol information. + optional<std::string> detail; + // A human-readable string that represents a doc-comment. + optional<std::pair<optional<std::string>, optional<MarkupContent>>> documentation; - /** + /** * Indicates if this item is deprecated. */ - optional< bool >deprecated; + optional<bool> deprecated; - - /** + /** * Select this item when showing. * * *Note* that only one completion item can be selected and that the * tool / client decides which item that is. The rule is that the *first * item of those that match best is selected. */ - optional< bool > preselect; - - - // Internal information to order candidates. - int relevance = 0; - - // A string that shoud be used when comparing this item - // with other items. When `falsy` the label is used. - optional< std::string > sortText; - - // A string that should be used when filtering a set of - // completion items. When `falsy` the label is used. - optional<std::string> filterText; - - // A string that should be inserted a document when selecting - // this completion. When `falsy` the label is used. - optional<std::string> insertText; - - // The format of the insert text. The format applies to both the `insertText` - // property and the `newText` property of a provided `textEdit`. - optional< lsInsertTextFormat> insertTextFormat ; - - // An edit which is applied to a document when selecting this completion. When - // an edit is provided the value of `insertText` is ignored. - // - // *Note:* The range of the edit must be a single line range and it must - // contain the position at which completion has been requested. - optional<lsTextEdit> textEdit; - - // An optional array of additional text edits that are applied when - // selecting this completion. Edits must not overlap with the main edit - // nor with themselves. - // std::vector<TextEdit> additionalTextEdits; - - // An optional command that is executed *after* inserting this completion. - // *Note* that additional modifications to the current document should be - // described with the additionalTextEdits-property. Command command; - - // An data entry field that is preserved on a completion item between - // a completion and a completion resolve request. - // data ? : any - - // Use this helper to figure out what content the completion item will insert - // into the document, as it could live in either |textEdit|, |insertText|, or - // |label|. - const std::string& InsertedContent() const; - - std::string DisplayText(); - /** + optional<bool> preselect; + + // Internal information to order candidates. + int relevance = 0; + + // A string that shoud be used when comparing this item + // with other items. When `falsy` the label is used. + optional<std::string> sortText; + + // A string that should be used when filtering a set of + // completion items. When `falsy` the label is used. + optional<std::string> filterText; + + // A string that should be inserted a document when selecting + // this completion. When `falsy` the label is used. + optional<std::string> insertText; + + // The format of the insert text. The format applies to both the `insertText` + // property and the `newText` property of a provided `textEdit`. + optional<lsInsertTextFormat> insertTextFormat; + + // An edit which is applied to a document when selecting this completion. When + // an edit is provided the value of `insertText` is ignored. + // + // *Note:* The range of the edit must be a single line range and it must + // contain the position at which completion has been requested. + optional<lsTextEdit> textEdit; + + // An optional array of additional text edits that are applied when + // selecting this completion. Edits must not overlap with the main edit + // nor with themselves. + // std::vector<TextEdit> additionalTextEdits; + + // An optional command that is executed *after* inserting this completion. + // *Note* that additional modifications to the current document should be + // described with the additionalTextEdits-property. Command command; + + // An data entry field that is preserved on a completion item between + // a completion and a completion resolve request. + // data ? : any + + // Use this helper to figure out what content the completion item will insert + // into the document, as it could live in either |textEdit|, |insertText|, or + // |label|. + std::string const& InsertedContent() const; + + std::string DisplayText(); + /** * An optional array of additional text edits that are applied when * selecting this completion. Edits must not overlap (including the same insert position) * with the main edit nor with themselves. @@ -155,70 +152,50 @@ struct lsCompletionItem { * (for example adding an import statement at the top of the file if the completion item will * insert an unqualified type). */ - optional<std::vector<lsTextEdit> >additionalTextEdits; + optional<std::vector<lsTextEdit>> additionalTextEdits; - /** + /** * An optional set of characters that when pressed while this completion is active will accept it first and * then type that character. *Note* that all commit characters should have `length=1` and that superfluous * characters will be ignored. */ - optional< std::vector<std::string> > commitCharacters; + optional<std::vector<std::string>> commitCharacters; - /** + /** * An optional command that is executed *after* inserting this completion. *Note* that * additional modifications to the current document should be described with the * additionalTextEdits-property. */ - optional<lsCommandWithAny> command; + optional<lsCommandWithAny> command; - /** + /** * An data entry field that is preserved on a completion item between a completion and a completion resolve request. */ - optional<lsp::Any> data; - std::string ToString(); - MAKE_SWAP_METHOD(lsCompletionItem, - label, - kind, - detail, - documentation, - sortText, - insertText, - filterText, - insertTextFormat, - textEdit, - deprecated, preselect, additionalTextEdits, commitCharacters, - command, data); - + optional<lsp::Any> data; + std::string ToString(); + MAKE_SWAP_METHOD( + lsCompletionItem, label, kind, detail, documentation, sortText, insertText, filterText, insertTextFormat, + textEdit, deprecated, preselect, additionalTextEdits, commitCharacters, command, data + ); }; +MAKE_REFLECT_STRUCT( + lsCompletionItem, label, kind, detail, documentation, sortText, insertText, filterText, insertTextFormat, textEdit, + deprecated, preselect, additionalTextEdits, commitCharacters, command, data +); - -MAKE_REFLECT_STRUCT(lsCompletionItem, - label, - kind, - detail, - documentation, - sortText, - insertText, - filterText, - insertTextFormat, - textEdit, - deprecated, preselect, additionalTextEdits, commitCharacters, - command, data); - - - -struct CompletionList { - // This list it not complete. Further typing should result in recomputing - // this list. - bool isIncomplete = false; - // The completion items. - std::vector<lsCompletionItem> items; - - void swap(CompletionList& arg) noexcept - { - items.swap(arg.items); - std::swap(isIncomplete, arg.isIncomplete); - } +struct CompletionList +{ + // This list it not complete. Further typing should result in recomputing + // this list. + bool isIncomplete = false; + // The completion items. + std::vector<lsCompletionItem> items; + + void swap(CompletionList& arg) noexcept + { + items.swap(arg.items); + std::swap(isIncomplete, arg.isIncomplete); + } }; MAKE_REFLECT_STRUCT(CompletionList, isIncomplete, items); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_diagnostic.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_diagnostic.h index e05e816b69..5035e9e6c1 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_diagnostic.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/lsp_diagnostic.h @@ -10,15 +10,16 @@ #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" -enum class lsDiagnosticSeverity { - // Reports an error. - Error = 1, - // Reports a warning. - Warning = 2, - // Reports an information. - Information = 3, - // Reports a hint. - Hint = 4 +enum class lsDiagnosticSeverity +{ + // Reports an error. + Error = 1, + // Reports a warning. + Warning = 2, + // Reports an information. + Information = 3, + // Reports a hint. + Hint = 4 }; MAKE_REFLECT_TYPE_PROXY(lsDiagnosticSeverity); @@ -27,27 +28,26 @@ MAKE_REFLECT_TYPE_PROXY(lsDiagnosticSeverity); * * @since 3.15.0 */ -enum class DiagnosticTag :uint8_t { +enum class DiagnosticTag : uint8_t +{ - /** + /** * Unused or unnecessary code. * * Clients are allowed to render diagnostics with this tag faded out instead of having * an error squiggle. */ - Unnecessary=(1), + Unnecessary = (1), - /** + /** * Deprecated or obsolete code. * * Clients are allowed to rendered diagnostics with this tag strike through. */ - Deprecated=(2), + Deprecated = (2), }; MAKE_REFLECT_TYPE_PROXY(DiagnosticTag); - - /** * Represents a related message and source code location for a diagnostic. This should be * used to point to code locations that cause or related to a diagnostics, e.g when duplicating @@ -56,20 +56,21 @@ MAKE_REFLECT_TYPE_PROXY(DiagnosticTag); * Since 3.7.0 */ -struct DiagnosticRelatedInformation { - /** +struct DiagnosticRelatedInformation +{ + /** * The location of this related diagnostic information. */ lsLocation location; - /** + /** * The message of this related diagnostic information. */ - std::string message; + std::string message; - MAKE_SWAP_METHOD(DiagnosticRelatedInformation, location, message) + MAKE_SWAP_METHOD(DiagnosticRelatedInformation, location, message) }; MAKE_REFLECT_STRUCT(DiagnosticRelatedInformation, location, message) /** @@ -77,76 +78,73 @@ MAKE_REFLECT_STRUCT(DiagnosticRelatedInformation, location, message) * * @since 3.16.0 */ -struct DiagnosticCodeDescription { - /** +struct DiagnosticCodeDescription +{ + /** * An URI to open with more information about the diagnostic error. */ - std::string href; - MAKE_SWAP_METHOD(DiagnosticCodeDescription, href) + std::string href; + MAKE_SWAP_METHOD(DiagnosticCodeDescription, href) }; MAKE_REFLECT_STRUCT(DiagnosticCodeDescription, href) //Represents a diagnostic, such as a compiler error or warning.Diagnostic objects are only valid in the scope of a resource. -struct lsDiagnostic { - // The range at which the message applies. - lsRange range; +struct lsDiagnostic +{ + // The range at which the message applies. + lsRange range; - // The diagnostic's severity. Can be omitted. If omitted it is up to the - // client to interpret diagnostics as error, warning, info or hint. - optional<lsDiagnosticSeverity> severity; + // The diagnostic's severity. Can be omitted. If omitted it is up to the + // client to interpret diagnostics as error, warning, info or hint. + optional<lsDiagnosticSeverity> severity; - // The diagnostic's code. Can be omitted. - optional< std::pair<optional<std::string>, optional<int>> > code; + // The diagnostic's code. Can be omitted. + optional<std::pair<optional<std::string>, optional<int>>> code; - optional<DiagnosticCodeDescription> codeDescription; - // A human-readable string describing the source of this - // diagnostic, e.g. 'typescript' or 'super lint'. - optional < std::string >source ; + optional<DiagnosticCodeDescription> codeDescription; + // A human-readable string describing the source of this + // diagnostic, e.g. 'typescript' or 'super lint'. + optional<std::string> source; - // The diagnostic's message. - std::string message; + // The diagnostic's message. + std::string message; - // Non-serialized set of fixits. - std::vector<lsTextEdit> fixits_; + // Non-serialized set of fixits. + std::vector<lsTextEdit> fixits_; - /** + /** * Additional metadata about the diagnostic. * * @since 3.15.0 */ - optional<std::vector<DiagnosticTag>> tags; + optional<std::vector<DiagnosticTag>> tags; - - /** + /** * An array of related diagnostic information, e.g. when symbol-names within a scope collide * all definitions can be marked via this property. * * Since 3.7.0 */ - optional<std::vector<DiagnosticRelatedInformation>> relatedInformation; + optional<std::vector<DiagnosticRelatedInformation>> relatedInformation; - /** + /** * A data entry field that is preserved between a * `textDocument/publishDiagnostics` notification and * `textDocument/codeAction` request. * * @since 3.16.0 */ - optional<lsp::Any> data; - bool operator==(const lsDiagnostic& rhs) const; - bool operator!=(const lsDiagnostic& rhs) const; + optional<lsp::Any> data; + bool operator==(lsDiagnostic const& rhs) const; + bool operator!=(lsDiagnostic const& rhs) const; - MAKE_SWAP_METHOD(lsDiagnostic, range, severity, code, codeDescription, source, message, tags, data) + MAKE_SWAP_METHOD(lsDiagnostic, range, severity, code, codeDescription, source, message, tags, data) }; MAKE_REFLECT_STRUCT(lsDiagnostic, range, severity, code, codeDescription, source, message, tags, data) +struct Rsp_Error : ResponseError<lsResponseError, Rsp_Error> +{ - -struct Rsp_Error : ResponseError<lsResponseError, Rsp_Error> { - - MAKE_SWAP_METHOD(Rsp_Error, jsonrpc, id, error) + MAKE_SWAP_METHOD(Rsp_Error, jsonrpc, id, error) }; MAKE_REFLECT_STRUCT(Rsp_Error, jsonrpc, id, error) - - - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/method_type.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/method_type.h index dcbb4a851a..b141367e2a 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/method_type.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/method_type.h @@ -1,7 +1,4 @@ #pragma once #include <string> -using MethodType = const char* const; - - - +using MethodType = char const* const; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/out_list.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/out_list.h index 8ede0b4a60..e10da8255b 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/out_list.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/out_list.h @@ -1,22 +1,18 @@ #pragma once - #include "location_type.h" - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" - - //DEFINE_RESPONCE_TYPE(Rsp_FindLinkLocationList, std::vector<LinkLocation>); //DEFINE_RESPONCE_TYPE(Rsp_LocationList, std::vector<lsLocation>); +namespace LocationListEither +{ -namespace LocationListEither{ - - typedef std::pair< optional<std::vector<lsLocation>> , optional<std::vector<LocationLink> > > Either; +typedef std::pair<optional<std::vector<lsLocation>>, optional<std::vector<LocationLink>>> Either; }; -extern void Reflect(Reader& visitor, LocationListEither::Either& value); +extern void Reflect(Reader& visitor, LocationListEither::Either& value); //DEFINE_RESPONCE_TYPE(Rsp_LocationListEither, LocationListEither::Either); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/symbol.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/symbol.h index 216c3f7d13..b66da101c9 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/symbol.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/symbol.h @@ -1,92 +1,95 @@ #pragma once #include "LibLsp/lsp/location_type.h" - -enum class lsSymbolKind : uint8_t { - Unknown = 0, - - File = 1, - Module = 2, - Namespace = 3, - Package = 4, - Class = 5, - Method = 6, - Property = 7, - Field = 8, - Constructor = 9, - Enum = 10, - Interface = 11, - Function = 12, - Variable = 13, - Constant = 14, - String = 15, - Number = 16, - Boolean = 17, - Array = 18, - Object = 19, - Key = 20, - Null = 21, - EnumMember = 22, - Struct = 23, - Event = 24, - Operator = 25, - - // For C++, this is interpreted as "template parameter" (including - // non-type template parameters). - TypeParameter = 26, - - // cquery extensions - // See also https://github.com/Microsoft/language-server-protocol/issues/344 - // for new SymbolKind clang/Index/IndexSymbol.h clang::index::SymbolKind - TypeAlias = 252, - Parameter = 253, - StaticMethod = 254, - Macro = 255, +enum class lsSymbolKind : uint8_t +{ + Unknown = 0, + + File = 1, + Module = 2, + Namespace = 3, + Package = 4, + Class = 5, + Method = 6, + Property = 7, + Field = 8, + Constructor = 9, + Enum = 10, + Interface = 11, + Function = 12, + Variable = 13, + Constant = 14, + String = 15, + Number = 16, + Boolean = 17, + Array = 18, + Object = 19, + Key = 20, + Null = 21, + EnumMember = 22, + Struct = 23, + Event = 24, + Operator = 25, + + // For C++, this is interpreted as "template parameter" (including + // non-type template parameters). + TypeParameter = 26, + + // cquery extensions + // See also https://github.com/Microsoft/language-server-protocol/issues/344 + // for new SymbolKind clang/Index/IndexSymbol.h clang::index::SymbolKind + TypeAlias = 252, + Parameter = 253, + StaticMethod = 254, + Macro = 255, }; MAKE_REFLECT_TYPE_PROXY(lsSymbolKind); -typedef lsSymbolKind SymbolKind; +typedef lsSymbolKind SymbolKind; // A document highlight kind. -enum class lsDocumentHighlightKind { - // A textual occurrence. - Text = 1, - // Read-access of a symbol, like reading a variable. - Read = 2, - // Write-access of a symbol, like writing to a variable. - Write = 3 +enum class lsDocumentHighlightKind +{ + // A textual occurrence. + Text = 1, + // Read-access of a symbol, like reading a variable. + Read = 2, + // Write-access of a symbol, like writing to a variable. + Write = 3 }; MAKE_REFLECT_TYPE_PROXY(lsDocumentHighlightKind); // A document highlight is a range inside a text document which deserves // special attention. Usually a document highlight is visualized by changing // the background color of its range. -struct lsDocumentHighlight { - // The range this highlight applies to. - lsRange range; +struct lsDocumentHighlight +{ + // The range this highlight applies to. + lsRange range; - // The highlight kind, default is DocumentHighlightKind.Text. - optional<lsDocumentHighlightKind> kind ; + // The highlight kind, default is DocumentHighlightKind.Text. + optional<lsDocumentHighlightKind> kind; - MAKE_SWAP_METHOD(lsDocumentHighlight, range, kind) + MAKE_SWAP_METHOD(lsDocumentHighlight, range, kind) }; MAKE_REFLECT_STRUCT(lsDocumentHighlight, range, kind); -struct lsSymbolInformation { +struct lsSymbolInformation +{ -/** + /** * The name of this symbol. */ - std::string name; - /** + std::string name; + /** * The kind of this symbol. */ - lsSymbolKind kind; - /** + lsSymbolKind kind; + /** * Indicates if this symbol is deprecated. */ - optional<bool> deprecated; - /** + optional<bool> deprecated; + /** * The location of this symbol. The location's range is used by a tool * to reveal the location in the editor. If the symbol is selected in the * tool the range's start information is used to position the cursor. So @@ -97,68 +100,67 @@ struct lsSymbolInformation { * syntax tree. It can therefore not be used to re-construct a hierarchy of * the symbols. */ - lsLocation location; - /** + lsLocation location; + /** * The name of the symbol containing this symbol. This information is for * user interface purposes (e.g. to render a qualifier in the user interface * if necessary). It can't be used to re-infer a hierarchy for the document * symbols. */ - optional<std::string> containerName; - + optional<std::string> containerName; - MAKE_SWAP_METHOD(lsSymbolInformation, name, kind, deprecated, location, containerName); + MAKE_SWAP_METHOD(lsSymbolInformation, name, kind, deprecated, location, containerName); }; MAKE_REFLECT_STRUCT(lsSymbolInformation, name, kind, deprecated, location, containerName); - -struct lsDocumentSymbol { - /** +struct lsDocumentSymbol +{ + /** * The name of this symbol. */ - std::string name; + std::string name; - /** + /** * The kind of this symbol. */ - lsSymbolKind kind = lsSymbolKind::Unknown; + lsSymbolKind kind = lsSymbolKind::Unknown; - /** + /** * The range enclosing this symbol not including leading/trailing whitespace but everything else * like comments. This information is typically used to determine if the clients cursor is * inside the symbol to reveal in the symbol in the UI. */ - lsRange range; + lsRange range; - /** + /** * The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. * Must be contained by the `range`. */ - lsRange selectionRange; + lsRange selectionRange; - /** + /** * More detail for this symbol, e.g the signature of a function. If not provided the * name is used. */ - optional< std::string > detail; + optional<std::string> detail; - /** + /** * Indicates if this symbol is deprecated. */ - optional< bool > deprecated; + optional<bool> deprecated; - /** + /** * Children of this symbol, e.g. properties of a class. */ - optional < std::vector<lsDocumentSymbol> > children; + optional<std::vector<lsDocumentSymbol>> children; - //internal use - int flags=0; + //internal use + int flags = 0; - MAKE_SWAP_METHOD(lsDocumentSymbol, name, kind, range, selectionRange, detail, deprecated, children, flags); + MAKE_SWAP_METHOD(lsDocumentSymbol, name, kind, range, selectionRange, detail, deprecated, children, flags); }; MAKE_REFLECT_STRUCT(lsDocumentSymbol, name, kind, range, selectionRange, detail, deprecated, children, flags); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/SemanticTokens.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/SemanticTokens.h index 8a24ebdd45..e7ada015fd 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/SemanticTokens.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/SemanticTokens.h @@ -3,139 +3,146 @@ #include "LibLsp/lsp/lsTextDocumentIdentifier.h" #include "LibLsp/lsp/lsVersionedTextDocumentIdentifier.h" #include "LibLsp/JsonRpc/RequestInMessage.h" -enum class HighlightingKind_clangD { - Variable = 0, - LocalVariable, - Parameter, - Function, - Method, - StaticMethod, - Field, - StaticField, - Class, - Interface, - Enum, - EnumConstant, - Typedef, - Type, - Unknown, - Namespace, - TemplateParameter, - Concept, - Primitive, - Macro, +enum class HighlightingKind_clangD +{ + Variable = 0, + LocalVariable, + Parameter, + Function, + Method, + StaticMethod, + Field, + StaticField, + Class, + Interface, + Enum, + EnumConstant, + Typedef, + Type, + Unknown, + Namespace, + TemplateParameter, + Concept, + Primitive, + Macro, - // This one is different from the other kinds as it's a line style - // rather than a token style. - InactiveCode, + // This one is different from the other kinds as it's a line style + // rather than a token style. + InactiveCode, - LastKind = InactiveCode + LastKind = InactiveCode }; std::string toSemanticTokenType(HighlightingKind_clangD kind); -enum class HighlightingModifier_clangD { - Declaration, - Deprecated, - Deduced, - Readonly, - Static, - Abstract, - DependentName, - DefaultLibrary, +enum class HighlightingModifier_clangD +{ + Declaration, + Deprecated, + Deduced, + Readonly, + Static, + Abstract, + DependentName, + DefaultLibrary, - FunctionScope, - ClassScope, - FileScope, - GlobalScope, + FunctionScope, + ClassScope, + FileScope, + GlobalScope, - LastModifier = GlobalScope + LastModifier = GlobalScope }; std::string toSemanticTokenModifier(HighlightingModifier_clangD modifier); -enum SemanticTokenType { - ls_namespace=0,// 'namespace', - /** +enum SemanticTokenType +{ + ls_namespace = 0, // 'namespace', + /** * Represents a generic type. Acts as a fallback for types which * can't be mapped to a specific type like class or enum. */ - ls_type,// 'type', - ls_class,// 'class', - ls_enum,// 'enum', - ls_interface,// 'interface', - ls_struct,// 'struct', - ls_typeParameter,// 'typeParameter', - ls_parameter,// 'parameter', - ls_variable,// 'variable', - ls_property,// 'property', - ls_enumMember,// 'enumMember', - ls_event,// 'event', - ls_function,// 'function', - ls_method,// 'method', - ls_macro,// 'macro', - ls_keyword,// 'keyword', - ls_modifier,// 'modifier', - ls_comment,// 'comment', - ls_string,// 'string', - ls_number,// 'number', - ls_regexp,// 'regexp', - ls_operator,// 'operator' - lastKind = ls_operator + ls_type, // 'type', + ls_class, // 'class', + ls_enum, // 'enum', + ls_interface, // 'interface', + ls_struct, // 'struct', + ls_typeParameter, // 'typeParameter', + ls_parameter, // 'parameter', + ls_variable, // 'variable', + ls_property, // 'property', + ls_enumMember, // 'enumMember', + ls_event, // 'event', + ls_function, // 'function', + ls_method, // 'method', + ls_macro, // 'macro', + ls_keyword, // 'keyword', + ls_modifier, // 'modifier', + ls_comment, // 'comment', + ls_string, // 'string', + ls_number, // 'number', + ls_regexp, // 'regexp', + ls_operator, // 'operator' + lastKind = ls_operator }; std::string to_string(SemanticTokenType); unsigned toSemanticTokenType(std::vector<SemanticTokenType>& modifiers); -enum TokenType_JDT { - PACKAGE_JDT=0, - CLASS_JDT, - INTERFACE_JDT, - ENUM_JDT, - ENUM_MEMBER_JDT, - TYPE_JDT, - TYPE_PARAMETER_JDT, - ANNOTATION_JDT, - ANNOTATION_MEMBER_JDT, - METHOD_JDT, - PROPERTY_JDT, - VARIABLE_JDT, - PARAMETER_JDT +enum TokenType_JDT +{ + PACKAGE_JDT = 0, + CLASS_JDT, + INTERFACE_JDT, + ENUM_JDT, + ENUM_MEMBER_JDT, + TYPE_JDT, + TYPE_PARAMETER_JDT, + ANNOTATION_JDT, + ANNOTATION_MEMBER_JDT, + METHOD_JDT, + PROPERTY_JDT, + VARIABLE_JDT, + PARAMETER_JDT }; std::string to_string(TokenType_JDT); -enum SemanticTokenModifier { - ls_declaration=0,// 'declaration', - ls_definition,// 'definition', - ls_readonly,// 'readonly', - ls_static,// 'static', - ls_deprecated,// 'deprecated', - ls_abstract,// 'abstract', - ls_async,// 'async', - ls_modification,// 'modification', - ls_documentation,// 'documentation', - ls_defaultLibrary,// 'defaultLibrary' - LastModifier = ls_defaultLibrary +enum SemanticTokenModifier +{ + ls_declaration = 0, // 'declaration', + ls_definition, // 'definition', + ls_readonly, // 'readonly', + ls_static, // 'static', + ls_deprecated, // 'deprecated', + ls_abstract, // 'abstract', + ls_async, // 'async', + ls_modification, // 'modification', + ls_documentation, // 'documentation', + ls_defaultLibrary, // 'defaultLibrary' + LastModifier = ls_defaultLibrary }; std::string to_string(SemanticTokenModifier); -unsigned toSemanticTokenModifiers(std::vector<SemanticTokenModifier>&); +unsigned toSemanticTokenModifiers(std::vector<SemanticTokenModifier>&); /// Specifies a single semantic token in the document. /// This struct is not part of LSP, which just encodes lists of tokens as /// arrays of numbers directly. -struct SemanticToken { - /// token line number, relative to the previous token - unsigned deltaLine = 0; - /// token start character, relative to the previous token - /// (relative to 0 or the previous token's start if they are on the same line) - unsigned deltaStart = 0; - /// the length of the token. A token cannot be multiline - unsigned length = 0; - /// will be looked up in `SemanticTokensLegend.tokenTypes` - unsigned tokenType = 0; - /// each set bit will be looked up in `SemanticTokensLegend.tokenModifiers` - unsigned tokenModifiers = 0; +struct SemanticToken +{ + /// token line number, relative to the previous token + unsigned deltaLine = 0; + /// token start character, relative to the previous token + /// (relative to 0 or the previous token's start if they are on the same line) + unsigned deltaStart = 0; + /// the length of the token. A token cannot be multiline + unsigned length = 0; + /// will be looked up in `SemanticTokensLegend.tokenTypes` + unsigned tokenType = 0; + /// each set bit will be looked up in `SemanticTokensLegend.tokenModifiers` + unsigned tokenModifiers = 0; }; -bool operator==(const SemanticToken&, const SemanticToken&); -struct SemanticTokens{ +bool operator==(SemanticToken const&, SemanticToken const&); +struct SemanticTokens +{ - /** + /** * Tokens in a file are represented as an array of integers. The position of each token is expressed relative to * the token before it, because most tokens remain stable relative to each other when edits are made in a file. * @@ -190,78 +197,85 @@ struct SemanticTokens{ * [ 2,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] * ``` */ - std::vector<int32_t> data; - static std::vector<int32_t> encodeTokens(std::vector<SemanticToken>& tokens); + std::vector<int32_t> data; + static std::vector<int32_t> encodeTokens(std::vector<SemanticToken>& tokens); - /** + /** * An optional result id. If provided and clients support delta updating * the client will include the result id in the next semantic token request. * A server can then instead of computing all semantic tokens again simply * send a delta. */ - optional<std::string> resultId; - MAKE_SWAP_METHOD(SemanticTokens, data, resultId) + optional<std::string> resultId; + MAKE_SWAP_METHOD(SemanticTokens, data, resultId) }; MAKE_REFLECT_STRUCT(SemanticTokens, data, resultId) /// Body of textDocument/semanticTokens/full request. -struct SemanticTokensParams { - /// The text document. - lsTextDocumentIdentifier textDocument; - MAKE_REFLECT_STRUCT(SemanticTokensParams, textDocument) +struct SemanticTokensParams +{ + /// The text document. + lsTextDocumentIdentifier textDocument; + MAKE_REFLECT_STRUCT(SemanticTokensParams, textDocument) }; MAKE_REFLECT_STRUCT(SemanticTokensParams, textDocument) - /// Body of textDocument/semanticTokens/full/delta request. /// Requests the changes in semantic tokens since a previous response. -struct SemanticTokensDeltaParams { - /// The text document. - lsTextDocumentIdentifier textDocument; - /** +struct SemanticTokensDeltaParams +{ + /// The text document. + lsTextDocumentIdentifier textDocument; + /** * The result id of a previous response. The result Id can either point to * a full response or a delta response depending on what was received last. */ - std::string previousResultId; + std::string previousResultId; - MAKE_REFLECT_STRUCT(SemanticTokensDeltaParams, textDocument, previousResultId) + MAKE_REFLECT_STRUCT(SemanticTokensDeltaParams, textDocument, previousResultId) }; MAKE_REFLECT_STRUCT(SemanticTokensDeltaParams, textDocument, previousResultId) /// Describes a a replacement of a contiguous range of semanticTokens. -struct SemanticTokensEdit { - // LSP specifies `start` and `deleteCount` which are relative to the array - // encoding of the previous tokens. - // We use token counts instead, and translate when serializing this struct. - unsigned startToken = 0; - unsigned deleteTokens = 0; - std::vector<int32_t> tokens; // encoded as a flat integer array +struct SemanticTokensEdit +{ + // LSP specifies `start` and `deleteCount` which are relative to the array + // encoding of the previous tokens. + // We use token counts instead, and translate when serializing this struct. + unsigned startToken = 0; + unsigned deleteTokens = 0; + std::vector<int32_t> tokens; // encoded as a flat integer array - MAKE_REFLECT_STRUCT(SemanticTokensEdit, startToken, deleteTokens, tokens) + MAKE_REFLECT_STRUCT(SemanticTokensEdit, startToken, deleteTokens, tokens) }; MAKE_REFLECT_STRUCT(SemanticTokensEdit, startToken, deleteTokens, tokens) - /// This models LSP SemanticTokensDelta | SemanticTokens, which is the result of /// textDocument/semanticTokens/full/delta. -struct SemanticTokensOrDelta { - optional<std::string > resultId; - /// Set if we computed edits relative to a previous set of tokens. - optional< std::vector<SemanticTokensEdit> > edits; - /// Set if we computed a fresh set of tokens. - /// Set if we computed edits relative to a previous set of tokens. - optional<std::vector<int32_t>> tokens; // encoded as integer array - MAKE_REFLECT_STRUCT(SemanticTokensOrDelta, resultId, edits, tokens) +struct SemanticTokensOrDelta +{ + optional<std::string> resultId; + /// Set if we computed edits relative to a previous set of tokens. + optional<std::vector<SemanticTokensEdit>> edits; + /// Set if we computed a fresh set of tokens. + /// Set if we computed edits relative to a previous set of tokens. + optional<std::vector<int32_t>> tokens; // encoded as integer array + MAKE_REFLECT_STRUCT(SemanticTokensOrDelta, resultId, edits, tokens) }; MAKE_REFLECT_STRUCT(SemanticTokensOrDelta, resultId, edits, tokens) - -struct SemanticTokensLegend { - std::vector<std::string> tokenTypes; - std::vector<std::string> tokenModifiers; - MAKE_REFLECT_STRUCT(SemanticTokensLegend, tokenTypes, tokenModifiers) +struct SemanticTokensLegend +{ + std::vector<std::string> tokenTypes; + std::vector<std::string> tokenModifiers; + MAKE_REFLECT_STRUCT(SemanticTokensLegend, tokenTypes, tokenModifiers) }; MAKE_REFLECT_STRUCT(SemanticTokensLegend, tokenTypes, tokenModifiers) -DEFINE_REQUEST_RESPONSE_TYPE(td_semanticTokens_full, SemanticTokensParams,optional<SemanticTokens >,"textDocument/semanticTokens/full") -DEFINE_REQUEST_RESPONSE_TYPE(td_semanticTokens_full_delta, SemanticTokensDeltaParams, optional<SemanticTokensOrDelta >, "textDocument/semanticTokens/full/delta") +DEFINE_REQUEST_RESPONSE_TYPE( + td_semanticTokens_full, SemanticTokensParams, optional<SemanticTokens>, "textDocument/semanticTokens/full" +) +DEFINE_REQUEST_RESPONSE_TYPE( + td_semanticTokens_full_delta, SemanticTokensDeltaParams, optional<SemanticTokensOrDelta>, + "textDocument/semanticTokens/full/delta" +) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/callHierarchy.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/callHierarchy.h index 408767d937..c9ca161422 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/callHierarchy.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/callHierarchy.h @@ -7,115 +7,116 @@ #include "LibLsp/lsp/lsTextDocumentPositionParams.h" #include "LibLsp/lsp/lsRange.h" -enum class SymbolTag { Deprecated = 1 }; +enum class SymbolTag +{ + Deprecated = 1 +}; MAKE_REFLECT_TYPE_PROXY(SymbolTag) struct CallHierarchyPrepareParams { - lsTextDocumentIdentifier textDocument; - lsPosition position; + lsTextDocumentIdentifier textDocument; + lsPosition position; - MAKE_SWAP_METHOD(CallHierarchyPrepareParams, - textDocument, - position) + MAKE_SWAP_METHOD(CallHierarchyPrepareParams, textDocument, position) }; -MAKE_REFLECT_STRUCT(CallHierarchyPrepareParams, - textDocument, - position) - +MAKE_REFLECT_STRUCT(CallHierarchyPrepareParams, textDocument, position) +/// Represents programming constructs like functions or constructors +/// in the context of call hierarchy. +struct CallHierarchyItem +{ + /// The name of this item. + std::string name; - /// Represents programming constructs like functions or constructors - /// in the context of call hierarchy. -struct CallHierarchyItem { - /// The name of this item. - std::string name; - - /// The kind of this item. - SymbolKind kind; + /// The kind of this item. + SymbolKind kind; - /// Tags for this item. - optional<std::vector<SymbolTag>> tags; + /// Tags for this item. + optional<std::vector<SymbolTag>> tags; - /// More detaill for this item, e.g. the signature of a function. - optional<std::string> detail; + /// More detaill for this item, e.g. the signature of a function. + optional<std::string> detail; - /// The resource identifier of this item. - lsDocumentUri uri; + /// The resource identifier of this item. + lsDocumentUri uri; - /** + /** * The range enclosing this symbol not including leading/trailing whitespace * but everything else, e.g. comments and code. */ - lsRange range; + lsRange range; - /** + /** * The range that should be selected and revealed when this symbol is being * picked, e.g. the name of a function. Must be contained by the * [`range`](#CallHierarchyItem.range). */ - lsRange selectionRange; + lsRange selectionRange; - /** + /** * A data entry field that is preserved between a call hierarchy prepare and * incoming calls or outgoing calls requests. */ - optional<lsp::Any> data; - MAKE_SWAP_METHOD(CallHierarchyItem, name, kind, tags, detail, uri, range, selectionRange, data) + optional<lsp::Any> data; + MAKE_SWAP_METHOD(CallHierarchyItem, name, kind, tags, detail, uri, range, selectionRange, data) }; MAKE_REFLECT_STRUCT(CallHierarchyItem, name, kind, tags, detail, uri, range, selectionRange, data) - - /// The parameter of a `callHierarchy/incomingCalls` request. -struct CallHierarchyIncomingCallsParams { - CallHierarchyItem item; - MAKE_SWAP_METHOD(CallHierarchyIncomingCallsParams,item) +struct CallHierarchyIncomingCallsParams +{ + CallHierarchyItem item; + MAKE_SWAP_METHOD(CallHierarchyIncomingCallsParams, item) }; MAKE_REFLECT_STRUCT(CallHierarchyIncomingCallsParams, item) - /// Represents an incoming call, e.g. a caller of a method or constructor. -struct CallHierarchyIncomingCall { - /// The item that makes the call. - CallHierarchyItem from; - - /// The range at which the calls appear. - /// This is relative to the caller denoted by `From`. - std::vector<lsRange> fromRanges; - MAKE_SWAP_METHOD(CallHierarchyIncomingCall, from, fromRanges) +struct CallHierarchyIncomingCall +{ + /// The item that makes the call. + CallHierarchyItem from; + + /// The range at which the calls appear. + /// This is relative to the caller denoted by `From`. + std::vector<lsRange> fromRanges; + MAKE_SWAP_METHOD(CallHierarchyIncomingCall, from, fromRanges) }; MAKE_REFLECT_STRUCT(CallHierarchyIncomingCall, from, fromRanges) - - - /// The parameter of a `callHierarchy/outgoingCalls` request. -struct CallHierarchyOutgoingCallsParams { - CallHierarchyItem item; - MAKE_SWAP_METHOD(CallHierarchyOutgoingCallsParams, item) +struct CallHierarchyOutgoingCallsParams +{ + CallHierarchyItem item; + MAKE_SWAP_METHOD(CallHierarchyOutgoingCallsParams, item) }; MAKE_REFLECT_STRUCT(CallHierarchyOutgoingCallsParams, item) /// Represents an outgoing call, e.g. calling a getter from a method or /// a method from a constructor etc. -struct CallHierarchyOutgoingCall { - /// The item that is called. - CallHierarchyItem to; - - /// The range at which this item is called. - /// This is the range relative to the caller, and not `To`. - std::vector<lsRange> fromRanges; - MAKE_SWAP_METHOD(CallHierarchyOutgoingCall, to, fromRanges) +struct CallHierarchyOutgoingCall +{ + /// The item that is called. + CallHierarchyItem to; + + /// The range at which this item is called. + /// This is the range relative to the caller, and not `To`. + std::vector<lsRange> fromRanges; + MAKE_SWAP_METHOD(CallHierarchyOutgoingCall, to, fromRanges) }; MAKE_REFLECT_STRUCT(CallHierarchyOutgoingCall, to, fromRanges) +DEFINE_REQUEST_RESPONSE_TYPE( + td_prepareCallHierarchy, CallHierarchyPrepareParams, optional<std::vector<CallHierarchyItem>>, + "textDocument/prepareCallHierarchy" +) -DEFINE_REQUEST_RESPONSE_TYPE(td_prepareCallHierarchy, CallHierarchyPrepareParams, - optional<std::vector<CallHierarchyItem>>, "textDocument/prepareCallHierarchy") - -DEFINE_REQUEST_RESPONSE_TYPE(td_incomingCalls, CallHierarchyIncomingCallsParams, - optional<std::vector<CallHierarchyIncomingCall>>, "callHierarchy/incomingCalls") +DEFINE_REQUEST_RESPONSE_TYPE( + td_incomingCalls, CallHierarchyIncomingCallsParams, optional<std::vector<CallHierarchyIncomingCall>>, + "callHierarchy/incomingCalls" +) -DEFINE_REQUEST_RESPONSE_TYPE(td_outgoingCalls, CallHierarchyOutgoingCallsParams, - optional<std::vector<CallHierarchyOutgoingCall>>, "callHierarchy/CallHierarchyOutgoingCall") +DEFINE_REQUEST_RESPONSE_TYPE( + td_outgoingCalls, CallHierarchyOutgoingCallsParams, optional<std::vector<CallHierarchyOutgoingCall>>, + "callHierarchy/CallHierarchyOutgoingCall" +) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_action.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_action.h index e72d83af90..693b98eff1 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_action.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_action.h @@ -5,27 +5,35 @@ #include "LibLsp/lsp/lsTextDocumentIdentifier.h" #include "LibLsp/lsp/CodeActionParams.h" -namespace QuickAssistProcessor { +namespace QuickAssistProcessor +{ - extern const char* SPLIT_JOIN_VARIABLE_DECLARATION_ID;//$NON-NLS-1$ - extern const char* CONVERT_FOR_LOOP_ID;// ;// "org.eclipse.jdt.ls.correction.convertForLoop.assist"; //$NON-NLS-1$ - extern const char* ASSIGN_TO_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.assignToLocal.assist"; //$NON-NLS-1$ - extern const char* ASSIGN_TO_FIELD_ID ;// "org.eclipse.jdt.ls.correction.assignToField.assist"; //$NON-NLS-1$ - extern const char* ASSIGN_PARAM_TO_FIELD_ID ;// "org.eclipse.jdt.ls.correction.assignParamToField.assist"; //$NON-NLS-1$ - extern const char* ASSIGN_ALL_PARAMS_TO_NEW_FIELDS_ID ;// "org.eclipse.jdt.ls.correction.assignAllParamsToNewFields.assist"; //$NON-NLS-1$ - extern const char* ADD_BLOCK_ID ;// "org.eclipse.jdt.ls.correction.addBlock.assist"; //$NON-NLS-1$ - extern const char* EXTRACT_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.extractLocal.assist"; //$NON-NLS-1$ - extern const char* EXTRACT_LOCAL_NOT_REPLACE_ID ;// "org.eclipse.jdt.ls.correction.extractLocalNotReplaceOccurrences.assist"; //$NON-NLS-1$ - extern const char* EXTRACT_CONSTANT_ID ;// "org.eclipse.jdt.ls.correction.extractConstant.assist"; //$NON-NLS-1$ - extern const char* INLINE_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.inlineLocal.assist"; //$NON-NLS-1$ - extern const char* CONVERT_LOCAL_TO_FIELD_ID ;// "org.eclipse.jdt.ls.correction.convertLocalToField.assist"; //$NON-NLS-1$ - extern const char* CONVERT_ANONYMOUS_TO_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.convertAnonymousToLocal.assist"; //$NON-NLS-1$ - extern const char* CONVERT_TO_STRING_BUFFER_ID ;// "org.eclipse.jdt.ls.correction.convertToStringBuffer.assist"; //$NON-NLS-1$ - extern const char* CONVERT_TO_MESSAGE_FORMAT_ID ;// "org.eclipse.jdt.ls.correction.convertToMessageFormat.assist"; //$NON-NLS-1$; - extern const char* EXTRACT_METHOD_INPLACE_ID ;// "org.eclipse.jdt.ls.correction.extractMethodInplace.assist"; //$NON-NLS-1$; +extern char const* SPLIT_JOIN_VARIABLE_DECLARATION_ID; //$NON-NLS-1$ +extern char const* CONVERT_FOR_LOOP_ID; // ;// "org.eclipse.jdt.ls.correction.convertForLoop.assist"; //$NON-NLS-1$ +extern char const* ASSIGN_TO_LOCAL_ID; // "org.eclipse.jdt.ls.correction.assignToLocal.assist"; //$NON-NLS-1$ +extern char const* ASSIGN_TO_FIELD_ID; // "org.eclipse.jdt.ls.correction.assignToField.assist"; //$NON-NLS-1$ +extern char const* ASSIGN_PARAM_TO_FIELD_ID; // "org.eclipse.jdt.ls.correction.assignParamToField.assist"; //$NON-NLS-1$ +extern char const* + ASSIGN_ALL_PARAMS_TO_NEW_FIELDS_ID; // "org.eclipse.jdt.ls.correction.assignAllParamsToNewFields.assist"; //$NON-NLS-1$ +extern char const* ADD_BLOCK_ID; // "org.eclipse.jdt.ls.correction.addBlock.assist"; //$NON-NLS-1$ +extern char const* EXTRACT_LOCAL_ID; // "org.eclipse.jdt.ls.correction.extractLocal.assist"; //$NON-NLS-1$ +extern char const* + EXTRACT_LOCAL_NOT_REPLACE_ID; // "org.eclipse.jdt.ls.correction.extractLocalNotReplaceOccurrences.assist"; //$NON-NLS-1$ +extern char const* EXTRACT_CONSTANT_ID; // "org.eclipse.jdt.ls.correction.extractConstant.assist"; //$NON-NLS-1$ +extern char const* INLINE_LOCAL_ID; // "org.eclipse.jdt.ls.correction.inlineLocal.assist"; //$NON-NLS-1$ +extern char const* + CONVERT_LOCAL_TO_FIELD_ID; // "org.eclipse.jdt.ls.correction.convertLocalToField.assist"; //$NON-NLS-1$ +extern char const* + CONVERT_ANONYMOUS_TO_LOCAL_ID; // "org.eclipse.jdt.ls.correction.convertAnonymousToLocal.assist"; //$NON-NLS-1$ +extern char const* + CONVERT_TO_STRING_BUFFER_ID; // "org.eclipse.jdt.ls.correction.convertToStringBuffer.assist"; //$NON-NLS-1$ +extern char const* + CONVERT_TO_MESSAGE_FORMAT_ID; // "org.eclipse.jdt.ls.correction.convertToMessageFormat.assist"; //$NON-NLS-1$; +extern char const* + EXTRACT_METHOD_INPLACE_ID; // "org.eclipse.jdt.ls.correction.extractMethodInplace.assist"; //$NON-NLS-1$; - extern const char* CONVERT_ANONYMOUS_CLASS_TO_NESTED_COMMAND ;// "convertAnonymousClassToNestedCommand"; -}; +extern char const* CONVERT_ANONYMOUS_CLASS_TO_NESTED_COMMAND; // "convertAnonymousClassToNestedCommand"; +}; // namespace QuickAssistProcessor /** * The code action request is sent from the client to the server to compute * commands for a given text document and range. These commands are @@ -34,4 +42,6 @@ namespace QuickAssistProcessor { * Registration Options: TextDocumentRegistrationOptions */ -DEFINE_REQUEST_RESPONSE_TYPE(td_codeAction, lsCodeActionParams, std::vector<lsCommandWithAny>, "textDocument/codeAction"); +DEFINE_REQUEST_RESPONSE_TYPE( + td_codeAction, lsCodeActionParams, std::vector<lsCommandWithAny>, "textDocument/codeAction" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_lens.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_lens.h index b9241de06b..3c18c6e41b 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_lens.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_lens.h @@ -3,35 +3,32 @@ #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" -struct lsDocumentCodeLensParams { +struct lsDocumentCodeLensParams +{ -/** + /** * The document to request code lens for. */ - lsTextDocumentIdentifier textDocument; + lsTextDocumentIdentifier textDocument; - MAKE_SWAP_METHOD(lsDocumentCodeLensParams, textDocument); + MAKE_SWAP_METHOD(lsDocumentCodeLensParams, textDocument); }; MAKE_REFLECT_STRUCT(lsDocumentCodeLensParams, textDocument); - - - -struct lsCodeLens { - // The range in which this code lens is valid. Should only span a single line. - lsRange range; - // The command this code lens represents. - optional<lsCommandWithAny> command; - // A data entry field that is preserved on a code lens item between - // a code lens and a code lens resolve request. - optional< lsp::Any> data; - - MAKE_SWAP_METHOD(lsCodeLens, range, command, data) +struct lsCodeLens +{ + // The range in which this code lens is valid. Should only span a single line. + lsRange range; + // The command this code lens represents. + optional<lsCommandWithAny> command; + // A data entry field that is preserved on a code lens item between + // a code lens and a code lens resolve request. + optional<lsp::Any> data; + + MAKE_SWAP_METHOD(lsCodeLens, range, command, data) }; MAKE_REFLECT_STRUCT(lsCodeLens, range, command, data) - - /** * The code lens request is sent from the client to the server to compute * code lenses for a given text document. @@ -39,4 +36,3 @@ MAKE_REFLECT_STRUCT(lsCodeLens, range, command, data) * Registration Options: CodeLensRegistrationOptions */ DEFINE_REQUEST_RESPONSE_TYPE(td_codeLens, lsDocumentCodeLensParams, std::vector<lsCodeLens>, "textDocument/codeLens") - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/colorPresentation.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/colorPresentation.h index c70b6502d2..294d625fbe 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/colorPresentation.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/colorPresentation.h @@ -1,6 +1,5 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" @@ -9,55 +8,54 @@ #include "documentColor.h" #include "LibLsp/lsp/lsTextEdit.h" +struct ColorPresentationParams +{ -struct ColorPresentationParams { - - /** + /** * The text document. */ - lsTextDocumentIdentifier textDocument; + lsTextDocumentIdentifier textDocument; - /** + /** * The range in the document where this color appers. */ - lsRange range; + lsRange range; - /** + /** * The actual color value for this color range. */ - TextDocument::Color color; - MAKE_SWAP_METHOD(ColorPresentationParams, textDocument, range, color) + TextDocument::Color color; + MAKE_SWAP_METHOD(ColorPresentationParams, textDocument, range, color) }; MAKE_REFLECT_STRUCT(ColorPresentationParams, textDocument, range, color) - -struct ColorPresentation { - /** +struct ColorPresentation +{ + /** * The label of this color presentation. It will be shown on the color * picker header. By default this is also the text that is inserted when selecting * this color presentation. */ - std::string label; + std::string label; - /** + /** * An edit which is applied to a document when selecting * this presentation for the color. When `null` the label is used. */ - lsTextEdit textEdit; + lsTextEdit textEdit; - /** + /** * An optional array of additional text edits that are applied when * selecting this color presentation. Edits must not overlap with the main edit nor with themselves. */ - std::vector<lsTextEdit> additionalTextEdits; - MAKE_SWAP_METHOD(ColorPresentation, label, textEdit, additionalTextEdits) + std::vector<lsTextEdit> additionalTextEdits; + MAKE_SWAP_METHOD(ColorPresentation, label, textEdit, additionalTextEdits) }; MAKE_REFLECT_STRUCT(ColorPresentation, label, textEdit, additionalTextEdits) - - -DEFINE_REQUEST_RESPONSE_TYPE(td_colorPresentation, - ColorPresentationParams, std::vector<ColorPresentation>, "textDocument/colorPresentation") +DEFINE_REQUEST_RESPONSE_TYPE( + td_colorPresentation, ColorPresentationParams, std::vector<ColorPresentation>, "textDocument/colorPresentation" +) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/completion.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/completion.h index edcf1e1724..50fd5bb4fa 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/completion.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/completion.h @@ -1,6 +1,5 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" @@ -8,59 +7,52 @@ #include "LibLsp/lsp/lsp_completion.h" #include "LibLsp/lsp/lsTextDocumentPositionParams.h" - // How a completion was triggered -enum class lsCompletionTriggerKind { - // Completion was triggered by typing an identifier (24x7 code - // complete), manual invocation (e.g Ctrl+Space) or via API. - Invoked = 1, - - // Completion was triggered by a trigger character specified by - // the `triggerCharacters` properties of the `CompletionRegistrationOptions`. - TriggerCharacter = 2 +enum class lsCompletionTriggerKind +{ + // Completion was triggered by typing an identifier (24x7 code + // complete), manual invocation (e.g Ctrl+Space) or via API. + Invoked = 1, + + // Completion was triggered by a trigger character specified by + // the `triggerCharacters` properties of the `CompletionRegistrationOptions`. + TriggerCharacter = 2 }; MAKE_REFLECT_TYPE_PROXY(lsCompletionTriggerKind); - // Contains additional information about the context in which a completion // request is triggered. -struct lsCompletionContext { - // How the completion was triggered. - lsCompletionTriggerKind triggerKind = lsCompletionTriggerKind::Invoked; +struct lsCompletionContext +{ + // How the completion was triggered. + lsCompletionTriggerKind triggerKind = lsCompletionTriggerKind::Invoked; - // The trigger character (a single character) that has trigger code complete. - // Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` - optional<std::string> triggerCharacter; + // The trigger character (a single character) that has trigger code complete. + // Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` + optional<std::string> triggerCharacter; - MAKE_SWAP_METHOD(lsCompletionContext, triggerKind, triggerCharacter); + MAKE_SWAP_METHOD(lsCompletionContext, triggerKind, triggerCharacter); }; MAKE_REFLECT_STRUCT(lsCompletionContext, triggerKind, triggerCharacter); -struct lsCompletionParams : lsTextDocumentPositionParams { - // The completion context. This is only available it the client specifies to - // send this using - // `ClientCapabilities.textDocument.completion.contextSupport === true` - optional<lsCompletionContext> context; - - MAKE_SWAP_METHOD(lsCompletionParams, textDocument, position, context); +struct lsCompletionParams : lsTextDocumentPositionParams +{ + // The completion context. This is only available it the client specifies to + // send this using + // `ClientCapabilities.textDocument.completion.contextSupport === true` + optional<lsCompletionContext> context; + MAKE_SWAP_METHOD(lsCompletionParams, textDocument, position, context); }; MAKE_REFLECT_STRUCT(lsCompletionParams, textDocument, position, context); +namespace TextDocumentComplete +{ - - - - - - - -namespace TextDocumentComplete{ - - typedef std::pair< optional<std::vector<lsCompletionItem>>, optional<CompletionList> > Either; +typedef std::pair<optional<std::vector<lsCompletionItem>>, optional<CompletionList>> Either; }; -extern void Reflect(Reader& visitor, TextDocumentComplete::Either& value); +extern void Reflect(Reader& visitor, TextDocumentComplete::Either& value); /** * The Completion request is sent from the client to the server to compute @@ -72,11 +64,4 @@ extern void Reflect(Reader& visitor, TextDocumentComplete::Either& value); * * Registration Options: CompletionRegistrationOptions */ -DEFINE_REQUEST_RESPONSE_TYPE(td_completion, lsCompletionParams, CompletionList , "textDocument/completion") - - - - - - - +DEFINE_REQUEST_RESPONSE_TYPE(td_completion, lsCompletionParams, CompletionList, "textDocument/completion") diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/declaration_definition.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/declaration_definition.h index aa20fce046..c64e42ae18 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/declaration_definition.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/declaration_definition.h @@ -1,13 +1,11 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" #include "LibLsp/lsp/lsTextDocumentPositionParams.h" #include "LibLsp/lsp/out_list.h" - /** * The go to declaration request is sent from the client to the server to resolve * the declaration location of a symbol at a given text document position. @@ -16,7 +14,9 @@ * * Since version 3.14.0 */ -DEFINE_REQUEST_RESPONSE_TYPE(td_declaration, lsTextDocumentPositionParams, LocationListEither::Either, "textDocument/declaration"); +DEFINE_REQUEST_RESPONSE_TYPE( + td_declaration, lsTextDocumentPositionParams, LocationListEither::Either, "textDocument/declaration" +); /** * The goto definition request is sent from the client to the server to resolve @@ -24,6 +24,6 @@ DEFINE_REQUEST_RESPONSE_TYPE(td_declaration, lsTextDocumentPositionParams, Locat * * Registration Options: TextDocumentRegistrationOptions */ -DEFINE_REQUEST_RESPONSE_TYPE(td_definition, lsTextDocumentPositionParams, LocationListEither::Either, "textDocument/definition"); - - +DEFINE_REQUEST_RESPONSE_TYPE( + td_definition, lsTextDocumentPositionParams, LocationListEither::Either, "textDocument/definition" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/didRenameFiles.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/didRenameFiles.h index d88d0e1307..93fc01b5db 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/didRenameFiles.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/didRenameFiles.h @@ -6,39 +6,42 @@ #include "LibLsp/lsp/CodeActionParams.h" #include "LibLsp/lsp/lsWorkspaceEdit.h" - -class FileRenameEvent { +class FileRenameEvent +{ public: - std::string oldUri; - std::string newUri; - - FileRenameEvent() { - } - - FileRenameEvent(std::string oldUri, std::string newUri) { - this->oldUri = oldUri; - this->newUri = newUri; - } - MAKE_SWAP_METHOD(FileRenameEvent, oldUri, newUri); + std::string oldUri; + std::string newUri; + + FileRenameEvent() + { + } + + FileRenameEvent(std::string oldUri, std::string newUri) + { + this->oldUri = oldUri; + this->newUri = newUri; + } + MAKE_SWAP_METHOD(FileRenameEvent, oldUri, newUri); }; MAKE_REFLECT_STRUCT(FileRenameEvent, oldUri, newUri); -class FileRenameParams { +class FileRenameParams +{ public: - std::vector <FileRenameEvent> files; + std::vector<FileRenameEvent> files; - FileRenameParams() { - } + FileRenameParams() + { + } - FileRenameParams(std::vector<FileRenameEvent>& files) { - this->files = files; - } - MAKE_SWAP_METHOD(FileRenameParams, files); + FileRenameParams(std::vector<FileRenameEvent>& files) + { + this->files = files; + } + MAKE_SWAP_METHOD(FileRenameParams, files); }; MAKE_REFLECT_STRUCT(FileRenameParams, files); - DEFINE_REQUEST_RESPONSE_TYPE(td_didRenameFiles, FileRenameParams, optional<lsWorkspaceEdit>, "java/didRenameFiles"); - DEFINE_REQUEST_RESPONSE_TYPE(td_willRenameFiles, FileRenameParams, optional<lsWorkspaceEdit>, "java/willRenameFiles"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_change.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_change.h index 8450bd343a..714dbe0255 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_change.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_change.h @@ -1,45 +1,43 @@ #pragma once - #include "LibLsp/JsonRpc/NotificationInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" #include "LibLsp/lsp/lsVersionedTextDocumentIdentifier.h" #include "LibLsp/lsp/lsRange.h" #include "LibLsp/lsp/lsDocumentUri.h" -struct lsTextDocumentContentChangeEvent { - // The range of the document that changed. - optional<lsRange> range; - // The length of the range that got replaced. - optional<int> rangeLength; - // The new text of the range/document. - std::string text; - - MAKE_SWAP_METHOD(lsTextDocumentContentChangeEvent, range, rangeLength, text); +struct lsTextDocumentContentChangeEvent +{ + // The range of the document that changed. + optional<lsRange> range; + // The length of the range that got replaced. + optional<int> rangeLength; + // The new text of the range/document. + std::string text; + + MAKE_SWAP_METHOD(lsTextDocumentContentChangeEvent, range, rangeLength, text); }; MAKE_REFLECT_STRUCT(lsTextDocumentContentChangeEvent, range, rangeLength, text); +struct lsTextDocumentDidChangeParams +{ + lsVersionedTextDocumentIdentifier textDocument; + std::vector<lsTextDocumentContentChangeEvent> contentChanges; -struct lsTextDocumentDidChangeParams { - lsVersionedTextDocumentIdentifier textDocument; - std::vector<lsTextDocumentContentChangeEvent> contentChanges; - - /** + /** * Legacy property to support protocol version 1.0 requests. */ - optional<lsDocumentUri> uri; + optional<lsDocumentUri> uri; - void swap(lsTextDocumentDidChangeParams& arg) noexcept - { - uri.swap(arg.uri); - contentChanges.swap(arg.contentChanges); - textDocument.swap(arg.textDocument); - } + void swap(lsTextDocumentDidChangeParams& arg) noexcept + { + uri.swap(arg.uri); + contentChanges.swap(arg.contentChanges); + textDocument.swap(arg.textDocument); + } }; -MAKE_REFLECT_STRUCT(lsTextDocumentDidChangeParams, - textDocument, - contentChanges, uri); +MAKE_REFLECT_STRUCT(lsTextDocumentDidChangeParams, textDocument, contentChanges, uri); /** * The document change notification is sent from the client to the server to @@ -48,4 +46,3 @@ MAKE_REFLECT_STRUCT(lsTextDocumentDidChangeParams, * Registration Options: TextDocumentChangeRegistrationOptions */ DEFINE_NOTIFICATION_TYPE(Notify_TextDocumentDidChange, lsTextDocumentDidChangeParams, "textDocument/didChange"); - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_close.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_close.h index d064819ae9..6d17223d3e 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_close.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_close.h @@ -1,25 +1,21 @@ #pragma once - - #include "LibLsp/JsonRpc/NotificationInMessage.h" +namespace TextDocumentDidClose +{ - - -namespace TextDocumentDidClose { - - struct Params { +struct Params +{ lsTextDocumentIdentifier textDocument; - void swap(Params& arg) noexcept - { - textDocument.swap(arg.textDocument); - } - - }; - + void swap(Params& arg) noexcept + { + textDocument.swap(arg.textDocument); + } }; +}; // namespace TextDocumentDidClose + MAKE_REFLECT_STRUCT(TextDocumentDidClose::Params, textDocument); /** diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_open.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_open.h index 379f35989f..ba6bb30441 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_open.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_open.h @@ -1,28 +1,26 @@ #pragma once - #include "LibLsp/JsonRpc/NotificationInMessage.h" #include "LibLsp/lsp/lsTextDocumentItem.h" // Open, view, change, close file -namespace TextDocumentDidOpen { +namespace TextDocumentDidOpen +{ - struct Params { +struct Params +{ lsTextDocumentItem textDocument; - - - /** + /** * Legacy property to support protocol version 1.0 requests. */ optional<std::string> text; - MAKE_SWAP_METHOD(TextDocumentDidOpen::Params, textDocument, text); + MAKE_SWAP_METHOD(TextDocumentDidOpen::Params, textDocument, text); +}; - }; - -} +} // namespace TextDocumentDidOpen MAKE_REFLECT_STRUCT(TextDocumentDidOpen::Params, textDocument, text); /** @@ -32,8 +30,7 @@ MAKE_REFLECT_STRUCT(TextDocumentDidOpen::Params, textDocument, text); * using the document's uri. * * Registration Options: TextDocumentRegistrationOptions - */; - + */ +; DEFINE_NOTIFICATION_TYPE(Notify_TextDocumentDidOpen, TextDocumentDidOpen::Params, "textDocument/didOpen"); - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_save.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_save.h index 5d00af0c20..09e3311832 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_save.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_save.h @@ -1,24 +1,23 @@ #pragma once - - #include "LibLsp/JsonRpc/NotificationInMessage.h" +namespace TextDocumentDidSave +{ -namespace TextDocumentDidSave { - - struct Params { +struct Params +{ // The document that was saved. lsTextDocumentIdentifier textDocument; // Optional the content when saved. Depends on the includeText value // when the save notifcation was requested. - optional<std::string> text; - - MAKE_SWAP_METHOD(TextDocumentDidSave::Params, textDocument, text); - }; + optional<std::string> text; + MAKE_SWAP_METHOD(TextDocumentDidSave::Params, textDocument, text); }; + +}; // namespace TextDocumentDidSave MAKE_REFLECT_STRUCT(TextDocumentDidSave::Params, textDocument, text); /** @@ -28,4 +27,3 @@ MAKE_REFLECT_STRUCT(TextDocumentDidSave::Params, textDocument, text); * Registration Options: TextDocumentSaveRegistrationOptions */ DEFINE_NOTIFICATION_TYPE(Notify_TextDocumentDidSave, TextDocumentDidSave::Params, "textDocument/didSave"); - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/documentColor.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/documentColor.h index 9aeeadba05..86c6274e93 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/documentColor.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/documentColor.h @@ -6,13 +6,14 @@ #include "LibLsp/lsp/lsTextDocumentIdentifier.h" #include "LibLsp/lsp/lsRange.h" #include <vector> -struct DocumentColorParams { - /** +struct DocumentColorParams +{ + /** * The text document. */ - lsTextDocumentIdentifier textDocument; - MAKE_SWAP_METHOD(DocumentColorParams, textDocument); + lsTextDocumentIdentifier textDocument; + MAKE_SWAP_METHOD(DocumentColorParams, textDocument); }; MAKE_REFLECT_STRUCT(DocumentColorParams, textDocument); @@ -27,47 +28,51 @@ MAKE_REFLECT_STRUCT(DocumentColorParams, textDocument); * Since version 3.6.0 */ -namespace TextDocument { - struct Color { - /** +namespace TextDocument +{ +struct Color +{ + /** * The red component of this color in the range [0-1]. */ - double red = 0; + double red = 0; - /** + /** * The green component of this color in the range [0-1]. */ - double green = 0; + double green = 0; - /** + /** * The blue component of this color in the range [0-1]. */ - double blue = 0; + double blue = 0; - /** + /** * The alpha component of this color in the range [0-1]. */ - double alpha = 0; - MAKE_SWAP_METHOD(TextDocument::Color, red, green, blue, alpha) - }; -} + double alpha = 0; + MAKE_SWAP_METHOD(TextDocument::Color, red, green, blue, alpha) +}; +} // namespace TextDocument MAKE_REFLECT_STRUCT(TextDocument::Color, red, green, blue, alpha) - -struct ColorInformation { - /** +struct ColorInformation +{ + /** * The range in the document where this color appers. */ - lsRange range; + lsRange range; - /** + /** * The actual color value for this color range. */ - TextDocument::Color color; - MAKE_SWAP_METHOD(ColorInformation, range, color) + TextDocument::Color color; + MAKE_SWAP_METHOD(ColorInformation, range, color) }; -MAKE_REFLECT_STRUCT(ColorInformation,range,color) +MAKE_REFLECT_STRUCT(ColorInformation, range, color) -DEFINE_REQUEST_RESPONSE_TYPE(td_documentColor, DocumentColorParams,std::vector<ColorInformation>, "textDocument/documentColor"); +DEFINE_REQUEST_RESPONSE_TYPE( + td_documentColor, DocumentColorParams, std::vector<ColorInformation>, "textDocument/documentColor" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_link.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_link.h index 92f02b24f1..52d35bc658 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_link.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_link.h @@ -2,43 +2,43 @@ #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" +#include "LibLsp/lsp/lsTextDocumentIdentifier.h" +#include "LibLsp/lsp/lsRange.h" +#include "LibLsp/lsp/lsAny.h" +namespace TextDocumentDocumentLink +{ -namespace TextDocumentDocumentLink { - - struct Params { +struct Params +{ // The document to provide document links for. lsTextDocumentIdentifier textDocument; - MAKE_SWAP_METHOD(Params, textDocument) - }; - + MAKE_SWAP_METHOD(Params, textDocument) }; -MAKE_REFLECT_STRUCT(TextDocumentDocumentLink::Params, textDocument); - - +}; // namespace TextDocumentDocumentLink +MAKE_REFLECT_STRUCT(TextDocumentDocumentLink::Params, textDocument); // A document link is a range in a text document that links to an internal or // external resource, like another text document or a web site. -struct lsDocumentLink { - // The range this link applies to. - lsRange range; - // The uri this link points to. If missing a resolve request is sent later. - optional<lsDocumentUri> target; - - optional<lsp::Any> data; +struct lsDocumentLink +{ + // The range this link applies to. + lsRange range; + // The uri this link points to. If missing a resolve request is sent later. + optional<lsDocumentUri> target; - MAKE_SWAP_METHOD(lsDocumentLink, range, target, data) + optional<lsp::Any> data; + MAKE_SWAP_METHOD(lsDocumentLink, range, target, data) }; -MAKE_REFLECT_STRUCT(lsDocumentLink, range, target,data); - - -DEFINE_REQUEST_RESPONSE_TYPE(td_links, TextDocumentDocumentLink::Params, std::vector<lsDocumentLink>, "textDocument/documentLink"); +MAKE_REFLECT_STRUCT(lsDocumentLink, range, target, data); +DEFINE_REQUEST_RESPONSE_TYPE( + td_links, TextDocumentDocumentLink::Params, std::vector<lsDocumentLink>, "textDocument/documentLink" +); /** * The document link resolve request is sent from the client to the server to resolve the target of a given document link. */ DEFINE_REQUEST_RESPONSE_TYPE(td_linkResolve, lsDocumentLink, lsDocumentLink, "documentLink/resolve"); - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_symbol.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_symbol.h index b01ffe0dc7..400bed91df 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_symbol.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_symbol.h @@ -1,29 +1,26 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" #include "LibLsp/lsp/symbol.h" #include "LibLsp/lsp/lsTextDocumentIdentifier.h" - /** +/** * The document symbol request is sent from the client to the server to list all symbols found in a given text document. */ -struct lsDocumentSymbolParams { - lsTextDocumentIdentifier textDocument; - MAKE_SWAP_METHOD(lsDocumentSymbolParams, textDocument) +struct lsDocumentSymbolParams +{ + lsTextDocumentIdentifier textDocument; + MAKE_SWAP_METHOD(lsDocumentSymbolParams, textDocument) }; MAKE_REFLECT_STRUCT(lsDocumentSymbolParams, textDocument); - - -struct TextDocumentDocumentSymbol{ - typedef std::pair< optional<lsSymbolInformation> , optional<lsDocumentSymbol> > Either; +struct TextDocumentDocumentSymbol +{ + typedef std::pair<optional<lsSymbolInformation>, optional<lsDocumentSymbol>> Either; }; void Reflect(Reader& visitor, TextDocumentDocumentSymbol::Either& value); - - /** * The document symbol request is sent from the client to the server to list all * symbols found in a given text document. @@ -47,9 +44,6 @@ void Reflect(Reader& visitor, TextDocumentDocumentSymbol::Either& value); // std::vector<TextDocumentDocumentSymbol::Either> ); // -DEFINE_REQUEST_RESPONSE_TYPE(td_symbol, - lsDocumentSymbolParams, - std::vector< lsDocumentSymbol >,"textDocument/documentSymbol" ); - - - +DEFINE_REQUEST_RESPONSE_TYPE( + td_symbol, lsDocumentSymbolParams, std::vector<lsDocumentSymbol>, "textDocument/documentSymbol" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/foldingRange.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/foldingRange.h index f863b4991d..fa6e5000a9 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/foldingRange.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/foldingRange.h @@ -1,62 +1,61 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" #include "document_symbol.h" #include "LibLsp/lsp/lsTextDocumentIdentifier.h" - -struct FoldingRangeRequestParams { - /** +struct FoldingRangeRequestParams +{ + /** * The text document. */ - lsTextDocumentIdentifier textDocument; - MAKE_SWAP_METHOD(FoldingRangeRequestParams, textDocument) + lsTextDocumentIdentifier textDocument; + MAKE_SWAP_METHOD(FoldingRangeRequestParams, textDocument) }; MAKE_REFLECT_STRUCT(FoldingRangeRequestParams, textDocument) - -struct FoldingRange { - /** +struct FoldingRange +{ + /** * The zero-based line number from where the folded range starts. */ - int startLine; + int startLine; - /** + /** * The zero-based line number where the folded range ends. */ - int endLine; + int endLine; - /** + /** * The zero-based character offset from where the folded range starts. If not defined, defaults * to the length of the start line. */ - int startCharacter; + int startCharacter; - /** + /** * The zero-based character offset before the folded range ends. If not defined, defaults to the * length of the end line. */ - int endCharacter; + int endCharacter; - /** + /** * Describes the kind of the folding range such as `comment' or 'region'. The kind * is used to categorize folding ranges and used by commands like 'Fold all comments'. See * FoldingRangeKind for an enumeration of standardized kinds. */ - std::string kind; + std::string kind; - MAKE_SWAP_METHOD(FoldingRange, startLine, endLine, startCharacter, endCharacter, kind) + MAKE_SWAP_METHOD(FoldingRange, startLine, endLine, startCharacter, endCharacter, kind) }; -MAKE_REFLECT_STRUCT(FoldingRange,startLine,endLine,startCharacter,endCharacter,kind) - +MAKE_REFLECT_STRUCT(FoldingRange, startLine, endLine, startCharacter, endCharacter, kind) /** * The folding range request is sent from the client to the server to return all folding * ranges found in a given text document. */ -DEFINE_REQUEST_RESPONSE_TYPE(td_foldingRange, FoldingRangeRequestParams, std::vector<FoldingRange>, "textDocument/foldingRange"); - +DEFINE_REQUEST_RESPONSE_TYPE( + td_foldingRange, FoldingRangeRequestParams, std::vector<FoldingRange>, "textDocument/foldingRange" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/formatting.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/formatting.h index 49b7883b5f..2b54716353 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/formatting.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/formatting.h @@ -4,22 +4,23 @@ #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" +namespace TextDocumentFormatting +{ -namespace TextDocumentFormatting { - - struct Params { - /** +struct Params +{ + /** * The document to format. */ lsTextDocumentIdentifier textDocument; - /** + /** * The format options. */ lsFormattingOptions options; - MAKE_SWAP_METHOD(Params, textDocument, options); - }; - + MAKE_SWAP_METHOD(Params, textDocument, options); }; + +}; // namespace TextDocumentFormatting MAKE_REFLECT_STRUCT(TextDocumentFormatting::Params, textDocument, options); /** * The document formatting request is sent from the client to the server to @@ -27,6 +28,6 @@ MAKE_REFLECT_STRUCT(TextDocumentFormatting::Params, textDocument, options); * * Registration Options: TextDocumentRegistrationOptions */ -DEFINE_REQUEST_RESPONSE_TYPE(td_formatting, TextDocumentFormatting::Params, - std::vector<lsTextEdit>, "textDocument/formatting"); - +DEFINE_REQUEST_RESPONSE_TYPE( + td_formatting, TextDocumentFormatting::Params, std::vector<lsTextEdit>, "textDocument/formatting" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/highlight.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/highlight.h index 0e01416126..ed7db9a11b 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/highlight.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/highlight.h @@ -13,6 +13,6 @@ * Registration Options: TextDocumentRegistrationOptions */ -DEFINE_REQUEST_RESPONSE_TYPE(td_highlight, lsTextDocumentPositionParams, - std::vector<lsDocumentHighlight>, "textDocument/documentHighlight"); - +DEFINE_REQUEST_RESPONSE_TYPE( + td_highlight, lsTextDocumentPositionParams, std::vector<lsDocumentHighlight>, "textDocument/documentHighlight" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/hover.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/hover.h index f2c15c3c44..0724ac7933 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/hover.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/hover.h @@ -1,6 +1,5 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" @@ -16,27 +15,27 @@ namespace TextDocumentHover { - typedef optional< std::vector< std::pair<optional<std::string>, optional<lsMarkedString>> > > Left; - typedef std::pair< Left, optional<MarkupContent> > Either; - struct Result { - /** +typedef optional<std::vector<std::pair<optional<std::string>, optional<lsMarkedString>>>> Left; +typedef std::pair<Left, optional<MarkupContent>> Either; +struct Result +{ + /** * The hover's content as markdown */ - Either contents; + Either contents; - /** + /** * An optional range */ - optional<lsRange> range; + optional<lsRange> range; - MAKE_SWAP_METHOD(Result, contents, range) - }; -} + MAKE_SWAP_METHOD(Result, contents, range) +}; +} // namespace TextDocumentHover MAKE_REFLECT_STRUCT(TextDocumentHover::Result, contents, range); -extern void Reflect(Reader& visitor, std::pair<optional<std::string>, optional<lsMarkedString>>& value); -extern void Reflect(Reader& visitor, TextDocumentHover::Either& value); - +extern void Reflect(Reader& visitor, std::pair<optional<std::string>, optional<lsMarkedString>>& value); +extern void Reflect(Reader& visitor, TextDocumentHover::Either& value); DEFINE_REQUEST_RESPONSE_TYPE(td_hover, lsTextDocumentPositionParams, TextDocumentHover::Result, "textDocument/hover") @@ -52,4 +51,3 @@ DEFINE_REQUEST_RESPONSE_TYPE(td_hover, lsTextDocumentPositionParams, TextDocumen // jsonrpc, // id, // result); - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/implementation.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/implementation.h index 0d7851cb81..f0b69646dd 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/implementation.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/implementation.h @@ -1,10 +1,8 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/lsp/out_list.h" - /** * The goto implementation request is sent from the client to the server to resolve * the implementation location of a symbol at a given text document position. @@ -13,4 +11,6 @@ * * Since version 3.6.0 */ -DEFINE_REQUEST_RESPONSE_TYPE(td_implementation, lsTextDocumentPositionParams, LocationListEither::Either, "textDocument/implementation");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE( + td_implementation, lsTextDocumentPositionParams, LocationListEither::Either, "textDocument/implementation" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/inlayHint.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/inlayHint.h new file mode 100644 index 0000000000..09e75337ab --- /dev/null +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/inlayHint.h @@ -0,0 +1,169 @@ +#pragma once + +#include "LibLsp/JsonRpc/RequestInMessage.h" +#include "LibLsp/JsonRpc/lsResponseMessage.h" +#include "LibLsp/lsp/lsTextDocumentIdentifier.h" +#include "LibLsp/lsp/lsRange.h" +#include "LibLsp/lsp/location_type.h" +#include "LibLsp/lsp/lsCommand.h" +#include "LibLsp/lsp/lsTextEdit.h" +#include "LibLsp/lsp/lsAny.h" + +namespace TextDocumentInlayHint +{ + +struct Params +{ + // The text document + lsTextDocumentIdentifier textDocument; + // The visible document range for which inlay hints should be computed. + lsRange range; + + MAKE_SWAP_METHOD(Params, textDocument, range) +}; + +}; // namespace TextDocumentInlayHint +MAKE_REFLECT_STRUCT(TextDocumentInlayHint::Params, textDocument, range); + +struct lsInlayHintLabelPart +{ + + /** + * The value of this label part. + */ + std::string value; + + /** + * The tooltip text when you hover over this label part. Depending on + * the client capability `inlayHint.resolveSupport` clients might resolve + * this property late using the resolve request. + */ + optional<std::string> tooltip; + + /** + * An optional source code location that represents this + * label part. + * + * The editor will use this location for the hover and for code navigation + * features: This part will become a clickable link that resolves to the + * definition of the symbol at the given location (not necessarily the + * location itself), it shows the hover that shows at the given location, + * and it shows a context menu with further code navigation commands. + * + * Depending on the client capability `inlayHint.resolveSupport` clients + * might resolve this property late using the resolve request. + */ + optional<lsLocation> location; + + /** + * An optional command for this label part. + * + * Depending on the client capability `inlayHint.resolveSupport` clients + * might resolve this property late using the resolve request. + */ + optional<lsCommand<lsp::Any>> command; + + MAKE_SWAP_METHOD(lsInlayHintLabelPart, value, tooltip, location, command) +}; + +MAKE_REFLECT_STRUCT(lsInlayHintLabelPart, value, tooltip, location, command); + +enum class lsInlayHintKind +{ + + // An inlay hint that for a type annotation. + Type = 1, + + // An inlay hint that is for a parameter. + Parameter = 2 +}; + +MAKE_REFLECT_TYPE_PROXY(lsInlayHintKind); + +/** + * a inlay hint is displayed in the editor right next to normal code, it is only readable text + * that acts like a hint, for example parameter names in function calls are displayed in editors + * as inlay hints + */ +struct lsInlayHint +{ + + /** + * The position of this hint. + * + * If multiple hints have the same position, they will be shown in the order + * they appear in the response. + */ + lsPosition position; + + /** + * The label of this hint. A human readable string or an array of + * InlayHintLabelPart label parts. + * + * *Note* that neither the string nor the label part can be empty. + */ + std::string label; + + /** + * The kind of this hint. Can be omitted in which case the client + * should fall back to a reasonable default. + */ + optional<lsInlayHintKind> kind; + + /** + * Optional text edits that are performed when accepting this inlay hint. + * + * *Note* that edits are expected to change the document so that the inlay + * hint (or its nearest variant) is now part of the document and the inlay + * hint itself is now obsolete. + * + * Depending on the client capability `inlayHint.resolveSupport` clients + * might resolve this property late using the resolve request. + */ + optional<std::vector<lsTextEdit>> textEdits; + + /** + * The tooltip text when you hover over this item. + * + * Depending on the client capability `inlayHint.resolveSupport` clients + * might resolve this property late using the resolve request. + */ + optional<std::string> tooltip; + + /** + * Render padding before the hint. + * + * Note: Padding should use the editor's background color, not the + * background color of the hint itself. That means padding can be used + * to visually align/separate an inlay hint. + */ + optional<bool> paddingLeft; + + /** + * Render padding after the hint. + * + * Note: Padding should use the editor's background color, not the + * background color of the hint itself. That means padding can be used + * to visually align/separate an inlay hint. + */ + optional<bool> paddingRight; + + /** + * A data entry field that is preserved on an inlay hint between + * a `textDocument/inlayHint` and a `inlayHint/resolve` request. + */ + optional<lsp::Any> data; + + MAKE_SWAP_METHOD(lsInlayHint, position, label, kind, textEdits, tooltip, paddingLeft, paddingRight, data) +}; + +MAKE_REFLECT_STRUCT(lsInlayHint, position, label, kind, textEdits, tooltip, paddingLeft, paddingRight, data) + +DEFINE_REQUEST_RESPONSE_TYPE( + td_inlayHint, TextDocumentInlayHint::Params, std::vector<lsInlayHint>, "textDocument/inlayHint" +); + +/** + * The document link resolve request is sent from the client to the server to resolve the target of a given document link. + */ +DEFINE_REQUEST_RESPONSE_TYPE(td_inlayHintResolve, lsInlayHint, lsInlayHint, "inlayHint/resolve"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/linkedEditingRange.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/linkedEditingRange.h index dfac99d378..8b9b217ecb 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/linkedEditingRange.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/linkedEditingRange.h @@ -1,6 +1,5 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" #include "LibLsp/lsp/lsAny.h" @@ -8,44 +7,35 @@ #include "LibLsp/lsp/lsTextDocumentPositionParams.h" #include "LibLsp/lsp/lsRange.h" - - struct LinkedEditingRangeParams { - lsTextDocumentIdentifier textDocument; - lsPosition position; + lsTextDocumentIdentifier textDocument; + lsPosition position; - MAKE_SWAP_METHOD(LinkedEditingRangeParams, - textDocument, - position) + MAKE_SWAP_METHOD(LinkedEditingRangeParams, textDocument, position) }; -MAKE_REFLECT_STRUCT(LinkedEditingRangeParams, - textDocument, - position) - +MAKE_REFLECT_STRUCT(LinkedEditingRangeParams, textDocument, position) struct LinkedEditingRanges { - /** + /** * A list of ranges that can be renamed together. The ranges must have * identical length and contain identical text content. The ranges cannot overlap. */ - std::vector<lsRange> ranges; + std::vector<lsRange> ranges; - /** + /** * An optional word pattern (regular expression) that describes valid contents for * the given ranges. If no pattern is provided, the client configuration's word * pattern will be used. */ - optional<std::string> wordPattern; - MAKE_SWAP_METHOD(LinkedEditingRanges, - ranges, - wordPattern) + optional<std::string> wordPattern; + MAKE_SWAP_METHOD(LinkedEditingRanges, ranges, wordPattern) }; -MAKE_REFLECT_STRUCT(LinkedEditingRanges, - ranges, - wordPattern) -DEFINE_REQUEST_RESPONSE_TYPE(td_linkedEditingRange, LinkedEditingRangeParams, - optional<std::vector<LinkedEditingRanges >>,"textDocument/linkedEditingRange") +MAKE_REFLECT_STRUCT(LinkedEditingRanges, ranges, wordPattern) +DEFINE_REQUEST_RESPONSE_TYPE( + td_linkedEditingRange, LinkedEditingRangeParams, optional<std::vector<LinkedEditingRanges>>, + "textDocument/linkedEditingRange" +) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/onTypeFormatting.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/onTypeFormatting.h index ada2162d12..a4cff0264f 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/onTypeFormatting.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/onTypeFormatting.h @@ -1,6 +1,5 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" @@ -9,29 +8,22 @@ #include "LibLsp/lsp/lsRange.h" #include "LibLsp/lsp/lsTextEdit.h" - struct lsDocumentOnTypeFormattingParams { - lsTextDocumentIdentifier textDocument; - lsFormattingOptions options; + lsTextDocumentIdentifier textDocument; + lsFormattingOptions options; - lsPosition position; + lsPosition position; - /** + /** * The character that has been typed. */ - std::string ch; + std::string ch; - MAKE_SWAP_METHOD(lsDocumentOnTypeFormattingParams, - textDocument, - position, - options, ch); + MAKE_SWAP_METHOD(lsDocumentOnTypeFormattingParams, textDocument, position, options, ch); }; -MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingParams, - textDocument, - position, - options,ch); +MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingParams, textDocument, position, options, ch); /** * The document range formatting request is sent from the client to the @@ -39,6 +31,6 @@ MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingParams, * * Registration Options: TextDocumentRegistrationOptions */ -DEFINE_REQUEST_RESPONSE_TYPE(td_onTypeFormatting, - lsDocumentOnTypeFormattingParams, std::vector<lsTextEdit>, "textDocument/onTypeFormatting"); - +DEFINE_REQUEST_RESPONSE_TYPE( + td_onTypeFormatting, lsDocumentOnTypeFormattingParams, std::vector<lsTextEdit>, "textDocument/onTypeFormatting" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/prepareRename.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/prepareRename.h index 1ffe5456f7..2564928d6d 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/prepareRename.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/prepareRename.h @@ -12,29 +12,27 @@ * * Registration Options: TextDocumentRegistrationOptions */ -struct PrepareRenameResult{ - /** +struct PrepareRenameResult +{ + /** * The range of the string to rename */ - lsRange range; + lsRange range; -/** + /** * A placeholder text of the string content to be renamed. */ - std::string placeholder; - - MAKE_SWAP_METHOD(PrepareRenameResult, range, placeholder) + std::string placeholder; + MAKE_SWAP_METHOD(PrepareRenameResult, range, placeholder) }; -MAKE_REFLECT_STRUCT(PrepareRenameResult,range,placeholder) - - - -typedef std::pair< optional< lsRange>, optional<PrepareRenameResult>> TextDocumentPrepareRenameResult; -extern void Reflect(Reader& visitor, TextDocumentPrepareRenameResult& value); +MAKE_REFLECT_STRUCT(PrepareRenameResult, range, placeholder) +typedef std::pair<optional<lsRange>, optional<PrepareRenameResult>> TextDocumentPrepareRenameResult; +extern void Reflect(Reader& visitor, TextDocumentPrepareRenameResult& value); -DEFINE_REQUEST_RESPONSE_TYPE(td_prepareRename, - lsTextDocumentPositionParams, TextDocumentPrepareRenameResult, "textDocument/prepareRename"); +DEFINE_REQUEST_RESPONSE_TYPE( + td_prepareRename, lsTextDocumentPositionParams, TextDocumentPrepareRenameResult, "textDocument/prepareRename" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/publishDiagnostics.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/publishDiagnostics.h index 8272df10e8..7929e6ba0d 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/publishDiagnostics.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/publishDiagnostics.h @@ -4,25 +4,25 @@ #include "LibLsp/lsp/lsp_diagnostic.h" // Diagnostics -namespace TextDocumentPublishDiagnostics{ - struct Params { +namespace TextDocumentPublishDiagnostics +{ +struct Params +{ // The URI for which diagnostic information is reported. lsDocumentUri uri; // An array of diagnostic information items. std::vector<lsDiagnostic> diagnostics; - MAKE_SWAP_METHOD(Params,uri,diagnostics); - }; - - + MAKE_SWAP_METHOD(Params, uri, diagnostics); }; -MAKE_REFLECT_STRUCT(TextDocumentPublishDiagnostics::Params, - uri, - diagnostics); + +}; // namespace TextDocumentPublishDiagnostics +MAKE_REFLECT_STRUCT(TextDocumentPublishDiagnostics::Params, uri, diagnostics); /** * Diagnostics notifications are sent from the server to the client to * signal results of validation runs. */ -DEFINE_NOTIFICATION_TYPE(Notify_TextDocumentPublishDiagnostics, TextDocumentPublishDiagnostics::Params, "textDocument/publishDiagnostics"); - +DEFINE_NOTIFICATION_TYPE( + Notify_TextDocumentPublishDiagnostics, TextDocumentPublishDiagnostics::Params, "textDocument/publishDiagnostics" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/range_formatting.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/range_formatting.h index c3c5ff0d0b..174fa828bd 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/range_formatting.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/range_formatting.h @@ -1,26 +1,19 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" #include "LibLsp/lsp/lsFormattingOptions.h" +struct lsTextDocumentRangeFormattingParams +{ + lsTextDocumentIdentifier textDocument; + lsRange range; + lsFormattingOptions options; -struct lsTextDocumentRangeFormattingParams { - lsTextDocumentIdentifier textDocument; - lsRange range; - lsFormattingOptions options; - - MAKE_SWAP_METHOD(lsTextDocumentRangeFormattingParams, - textDocument, - range, - options) + MAKE_SWAP_METHOD(lsTextDocumentRangeFormattingParams, textDocument, range, options) }; -MAKE_REFLECT_STRUCT(lsTextDocumentRangeFormattingParams, - textDocument, - range, - options); +MAKE_REFLECT_STRUCT(lsTextDocumentRangeFormattingParams, textDocument, range, options); /** * The document range formatting request is sent from the client to the @@ -28,8 +21,6 @@ MAKE_REFLECT_STRUCT(lsTextDocumentRangeFormattingParams, * * Registration Options: TextDocumentRegistrationOptions */ -DEFINE_REQUEST_RESPONSE_TYPE(td_rangeFormatting, lsTextDocumentRangeFormattingParams, std::vector<lsTextEdit>, - "textDocument/rangeFormatting"); - - - +DEFINE_REQUEST_RESPONSE_TYPE( + td_rangeFormatting, lsTextDocumentRangeFormattingParams, std::vector<lsTextEdit>, "textDocument/rangeFormatting" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/references.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/references.h index 46782c3d6d..4977bf8e53 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/references.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/references.h @@ -1,41 +1,30 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" #include "LibLsp/lsp/symbol.h" +namespace TextDocumentReferences +{ -namespace TextDocumentReferences { - - struct lsReferenceContext { +struct lsReferenceContext +{ // Include the declaration of the current symbol. - optional<bool> includeDeclaration; - MAKE_REFLECT_STRUCT(lsReferenceContext, - includeDeclaration) - }; - struct Params { + optional<bool> includeDeclaration; + MAKE_REFLECT_STRUCT(lsReferenceContext, includeDeclaration) +}; +struct Params +{ lsTextDocumentIdentifier textDocument; lsPosition position; lsReferenceContext context; - MAKE_SWAP_METHOD(Params, - textDocument, - position, - context) - - }; - + MAKE_SWAP_METHOD(Params, textDocument, position, context) }; -MAKE_REFLECT_STRUCT(TextDocumentReferences::lsReferenceContext, - includeDeclaration); -MAKE_REFLECT_STRUCT(TextDocumentReferences::Params, - textDocument, - position, - context); - - +}; // namespace TextDocumentReferences +MAKE_REFLECT_STRUCT(TextDocumentReferences::lsReferenceContext, includeDeclaration); +MAKE_REFLECT_STRUCT(TextDocumentReferences::Params, textDocument, position, context); /** * The references request is sent from the client to the server to resolve @@ -44,5 +33,6 @@ MAKE_REFLECT_STRUCT(TextDocumentReferences::Params, * * Registration Options: TextDocumentRegistrationOptions */ -DEFINE_REQUEST_RESPONSE_TYPE(td_references, TextDocumentReferences::Params, - std::vector<lsLocation>, "textDocument/references"); +DEFINE_REQUEST_RESPONSE_TYPE( + td_references, TextDocumentReferences::Params, std::vector<lsLocation>, "textDocument/references" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/rename.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/rename.h index 8b6d085910..c928638509 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/rename.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/rename.h @@ -1,15 +1,16 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" #include "LibLsp/lsp/lsWorkspaceEdit.h" #include "LibLsp/lsp/lsTextDocumentIdentifier.h" -namespace TextDocumentRename { +namespace TextDocumentRename +{ - struct Params { +struct Params +{ // The document to format. lsTextDocumentIdentifier textDocument; @@ -20,17 +21,11 @@ namespace TextDocumentRename { // request must return a [ResponseError](#ResponseError) with an // appropriate message set. std::string newName; - MAKE_SWAP_METHOD(Params, - textDocument, - position, - newName); - }; - + MAKE_SWAP_METHOD(Params, textDocument, position, newName); }; -MAKE_REFLECT_STRUCT(TextDocumentRename::Params, - textDocument, - position, - newName); + +}; // namespace TextDocumentRename +MAKE_REFLECT_STRUCT(TextDocumentRename::Params, textDocument, position, newName); /** * The rename request is sent from the client to the server to do a * workspace wide rename of a symbol. @@ -38,4 +33,3 @@ MAKE_REFLECT_STRUCT(TextDocumentRename::Params, * Registration Options: TextDocumentRegistrationOptions */ DEFINE_REQUEST_RESPONSE_TYPE(td_rename, TextDocumentRename::Params, lsWorkspaceEdit, "textDocument/rename"); - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveCodeLens.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveCodeLens.h index 0723985160..d28be9ada2 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveCodeLens.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveCodeLens.h @@ -1,10 +1,8 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" #include "code_lens.h" DEFINE_REQUEST_RESPONSE_TYPE(codeLens_resolve, lsCodeLens, lsCodeLens, "codeLens/resolve") - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveCompletionItem.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveCompletionItem.h index f5576894ed..094bff25de 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveCompletionItem.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveCompletionItem.h @@ -1,6 +1,5 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" @@ -14,8 +13,3 @@ * information for a given completion item. */ DEFINE_REQUEST_RESPONSE_TYPE(completionItem_resolve, lsCompletionItem, lsCompletionItem, "completionItem/resolve"); - - - - - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveTypeHierarchy.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveTypeHierarchy.h index 8b5f115af7..89d60ec0e1 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveTypeHierarchy.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveTypeHierarchy.h @@ -1,31 +1,32 @@ #pragma once - - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" #include "LibLsp/lsp/symbol.h" #include "typeHierarchy.h" -struct ResolveTypeHierarchyItemParams { - /** +struct ResolveTypeHierarchyItemParams +{ + /** * The hierarchy item to resolve. */ - TypeHierarchyItem item; + TypeHierarchyItem item; - /** + /** * The number of hierarchy levels to resolve. {@code 0} indicates no hierarchy level. */ - optional<int> resolve; + optional<int> resolve; - /** + /** * The direction of the type hierarchy resolution. */ - TypeHierarchyDirection direction; - MAKE_SWAP_METHOD(ResolveTypeHierarchyItemParams, item, resolve, direction) + TypeHierarchyDirection direction; + MAKE_SWAP_METHOD(ResolveTypeHierarchyItemParams, item, resolve, direction) }; -MAKE_REFLECT_STRUCT(ResolveTypeHierarchyItemParams,item,resolve,direction) -DEFINE_REQUEST_RESPONSE_TYPE(typeHierarchy_resolve, ResolveTypeHierarchyItemParams, TypeHierarchyItem, "typeHierarchy/resolve") +MAKE_REFLECT_STRUCT(ResolveTypeHierarchyItemParams, item, resolve, direction) +DEFINE_REQUEST_RESPONSE_TYPE( + typeHierarchy_resolve, ResolveTypeHierarchyItemParams, TypeHierarchyItem, "typeHierarchy/resolve" +) diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/selectionRange.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/selectionRange.h index 2c908bd57f..f74307e4ba 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/selectionRange.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/selectionRange.h @@ -1,52 +1,53 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" #include "LibLsp/lsp/lsPosition.h" #include "LibLsp/lsp/lsTextDocumentIdentifier.h" -struct SelectionRangeParams { - /** +struct SelectionRangeParams +{ + /** * The text document. */ - lsTextDocumentIdentifier textDocument; + lsTextDocumentIdentifier textDocument; - /** + /** * The positions inside the text document. */ - std::vector<lsPosition> positions; - - MAKE_SWAP_METHOD(SelectionRangeParams, textDocument, positions) + std::vector<lsPosition> positions; + MAKE_SWAP_METHOD(SelectionRangeParams, textDocument, positions) }; MAKE_REFLECT_STRUCT(SelectionRangeParams, textDocument, positions) -struct SelectionRange { - /** +struct SelectionRange +{ + /** * The [range](#Range) of this selection range. */ - lsRange range; + lsRange range; - /** + /** * The parent selection range containing this range. Therefore `parent.range` must contain `this.range`. */ - optional<SelectionRange*> parent; - MAKE_SWAP_METHOD(SelectionRange, range, parent) + optional<SelectionRange*> parent; + MAKE_SWAP_METHOD(SelectionRange, range, parent) }; -extern void Reflect(Reader& visitor, optional<SelectionRange*>& value); +extern void Reflect(Reader& visitor, optional<SelectionRange*>& value); extern void Reflect(Writer& visitor, SelectionRange* value); -MAKE_REFLECT_STRUCT(SelectionRange,range,parent) +MAKE_REFLECT_STRUCT(SelectionRange, range, parent) /** * The {@code textDocument/selectionRange} request is sent from the client to the server to return * suggested selection ranges at an array of given positions. A selection range is a range around * the cursor position which the user might be interested in selecting. */ -DEFINE_REQUEST_RESPONSE_TYPE(td_selectionRange, SelectionRangeParams, std::vector<SelectionRange>, "textDocument/selectionRange"); - +DEFINE_REQUEST_RESPONSE_TYPE( + td_selectionRange, SelectionRangeParams, std::vector<SelectionRange>, "textDocument/selectionRange" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/semanticHighlighting.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/semanticHighlighting.h index bfb8619559..44bda39594 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/semanticHighlighting.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/semanticHighlighting.h @@ -9,20 +9,21 @@ * Represents a semantic highlighting information that has to be applied on a specific line of the text document. */ -struct SemanticHighlightingInformation { - /** +struct SemanticHighlightingInformation +{ + /** * The zero-based line position in the text document. */ - int line = 0; + int line = 0; - /** + /** * A base64 encoded string representing every single highlighted ranges in the line with its start position, length * and the "lookup table" index of of the semantic highlighting <a href="https://manual.macromates.com/en/language_grammars"> * TextMate scopes</a>. If the {@code tokens} is empty or not defined, then no highlighted positions are available for the line. */ - std::string tokens; + std::string tokens; - MAKE_SWAP_METHOD(SemanticHighlightingInformation, line, tokens) + MAKE_SWAP_METHOD(SemanticHighlightingInformation, line, tokens) }; MAKE_REFLECT_STRUCT(SemanticHighlightingInformation, line, tokens); @@ -31,21 +32,21 @@ MAKE_REFLECT_STRUCT(SemanticHighlightingInformation, line, tokens); * Parameters for the semantic highlighting (server-side) push notification. */ -struct SemanticHighlightingParams { - /** +struct SemanticHighlightingParams +{ + /** * The text document that has to be decorated with the semantic highlighting information. */ - lsVersionedTextDocumentIdentifier textDocument; + lsVersionedTextDocumentIdentifier textDocument; - /** + /** * An array of semantic highlighting information. */ - std::vector<SemanticHighlightingInformation> lines; - - MAKE_SWAP_METHOD(SemanticHighlightingParams, textDocument, lines) + std::vector<SemanticHighlightingInformation> lines; + MAKE_SWAP_METHOD(SemanticHighlightingParams, textDocument, lines) }; MAKE_REFLECT_STRUCT(SemanticHighlightingParams, textDocument, lines); /** diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/signature_help.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/signature_help.h index bb5cd1dc52..51e33dec4f 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/signature_help.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/signature_help.h @@ -1,87 +1,75 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" #include "LibLsp/lsp/lsMarkedString.h" #include "LibLsp/lsp/lsTextDocumentPositionParams.h" -extern void Reflect(Reader& visitor, - std::pair<optional<std::string>, optional<MarkupContent>>& value); - - - // Represents a parameter of a callable-signature. A parameter can // have a label and a doc-comment. -struct lsParameterInformation { - // The label of this parameter. Will be shown in - // the UI. - std::string label; +struct lsParameterInformation +{ + // The label of this parameter. Will be shown in + // the UI. + std::string label; - // The human-readable doc-comment of this parameter. Will be shown - // in the UI but can be omitted. - optional< std::pair< optional<std::string> , optional <MarkupContent> > > documentation; + // The human-readable doc-comment of this parameter. Will be shown + // in the UI but can be omitted. + optional<std::pair<optional<std::string>, optional<MarkupContent>>> documentation; - MAKE_SWAP_METHOD(lsParameterInformation, label, documentation) + MAKE_SWAP_METHOD(lsParameterInformation, label, documentation) }; MAKE_REFLECT_STRUCT(lsParameterInformation, label, documentation); // Represents the signature of something callable. A signature // can have a label, like a function-name, a doc-comment, and // a set of parameters. -struct lsSignatureInformation { - // The label of this signature. Will be shown in - // the UI. - std::string label; +struct lsSignatureInformation +{ + // The label of this signature. Will be shown in + // the UI. + std::string label; - // The human-readable doc-comment of this signature. Will be shown - // in the UI but can be omitted. - optional< std::pair< optional<std::string>, optional <MarkupContent> > > documentation; + // The human-readable doc-comment of this signature. Will be shown + // in the UI but can be omitted. + optional<std::pair<optional<std::string>, optional<MarkupContent>>> documentation; - // The parameters of this signature. - std::vector<lsParameterInformation> parameters; + // The parameters of this signature. + std::vector<lsParameterInformation> parameters; - MAKE_SWAP_METHOD(lsSignatureInformation, label, documentation, parameters) + MAKE_SWAP_METHOD(lsSignatureInformation, label, documentation, parameters) }; MAKE_REFLECT_STRUCT(lsSignatureInformation, label, documentation, parameters); // Signature help represents the signature of something // callable. There can be multiple signature but only one // active and only one active parameter. -struct lsSignatureHelp { - // One or more signatures. - std::vector<lsSignatureInformation> signatures; - - // The active signature. If omitted or the value lies outside the - // range of `signatures` the value defaults to zero or is ignored if - // `signatures.length === 0`. Whenever possible implementors should - // make an active decision about the active signature and shouldn't - // rely on a default value. - // In future version of the protocol this property might become - // mandantory to better express this. - optional<int> activeSignature; - - // The active parameter of the active signature. If omitted or the value - // lies outside the range of `signatures[activeSignature].parameters` - // defaults to 0 if the active signature has parameters. If - // the active signature has no parameters it is ignored. - // In future version of the protocol this property might become - // mandantory to better express the active parameter if the - // active signature does have any. - optional<int> activeParameter; - - - MAKE_SWAP_METHOD(lsSignatureHelp, - signatures, - activeSignature, - activeParameter) +struct lsSignatureHelp +{ + // One or more signatures. + std::vector<lsSignatureInformation> signatures; + + // The active signature. If omitted or the value lies outside the + // range of `signatures` the value defaults to zero or is ignored if + // `signatures.length === 0`. Whenever possible implementors should + // make an active decision about the active signature and shouldn't + // rely on a default value. + // In future version of the protocol this property might become + // mandantory to better express this. + optional<int> activeSignature; + + // The active parameter of the active signature. If omitted or the value + // lies outside the range of `signatures[activeSignature].parameters` + // defaults to 0 if the active signature has parameters. If + // the active signature has no parameters it is ignored. + // In future version of the protocol this property might become + // mandantory to better express the active parameter if the + // active signature does have any. + optional<int> activeParameter; + + MAKE_SWAP_METHOD(lsSignatureHelp, signatures, activeSignature, activeParameter) }; -MAKE_REFLECT_STRUCT(lsSignatureHelp, - signatures, - activeSignature, - activeParameter); - - +MAKE_REFLECT_STRUCT(lsSignatureHelp, signatures, activeSignature, activeParameter); /** * The signature help request is sent from the client to the server to @@ -89,4 +77,6 @@ MAKE_REFLECT_STRUCT(lsSignatureHelp, * * Registration Options: SignatureHelpRegistrationOptions */ -DEFINE_REQUEST_RESPONSE_TYPE(td_signatureHelp, lsTextDocumentPositionParams, lsSignatureHelp, "textDocument/signatureHelp"); +DEFINE_REQUEST_RESPONSE_TYPE( + td_signatureHelp, lsTextDocumentPositionParams, lsSignatureHelp, "textDocument/signatureHelp" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/typeHierarchy.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/typeHierarchy.h index 8fe99edd87..fac696978a 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/typeHierarchy.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/typeHierarchy.h @@ -18,77 +18,73 @@ * "https://github.com/Microsoft/vscode-languageserver-node/pull/426">{@code textDocument/typeHierarchy} * language feature</a> is not yet part of the official LSP specification. */ -enum class TypeHierarchyDirection : uint32_t{ +enum class TypeHierarchyDirection : uint32_t +{ - /** + /** * Flag for retrieving/resolving the subtypes. Value: {@code 0}. */ - Children = 0, + Children = 0, - /** + /** * Flag to use when retrieving/resolving the supertypes. Value: {@code 1}. */ - Parents =1, + Parents = 1, - /** + /** * Flag for resolving both the super- and subtypes. Value: {@code 2}. */ - Both=2 + Both = 2 }; void Reflect(Reader& reader, TypeHierarchyDirection& value); - void Reflect(Writer& writer, TypeHierarchyDirection& value); -struct TypeHierarchyParams :public lsTextDocumentPositionParams +struct TypeHierarchyParams : public lsTextDocumentPositionParams { - optional<int> resolve; - optional<TypeHierarchyDirection> direction ; + optional<int> resolve; + optional<TypeHierarchyDirection> direction; - MAKE_SWAP_METHOD(TypeHierarchyParams, textDocument, position, resolve, direction) + MAKE_SWAP_METHOD(TypeHierarchyParams, textDocument, position, resolve, direction) }; -MAKE_REFLECT_STRUCT(TypeHierarchyParams, textDocument, position, resolve, direction); - - - - +MAKE_REFLECT_STRUCT(TypeHierarchyParams, textDocument, position, resolve, direction); /** * Representation of an item that carries type information (such as class, interface, enumeration, etc) with additional parentage details. */ -struct TypeHierarchyItem { - /** +struct TypeHierarchyItem +{ + /** * The human readable name of the hierarchy item. */ - std::string name; + std::string name; - /** + /** * Optional detail for the hierarchy item. It can be, for instance, the signature of a function or method. */ - optional<std::string> - detail; + optional<std::string> detail; - /** + /** * The kind of the hierarchy item. For instance, class or interface. */ - SymbolKind kind; + SymbolKind kind; - /** + /** * {@code true} if the hierarchy item is deprecated. Otherwise, {@code false}. It is {@code false} by default. */ - optional<bool> deprecated; + optional<bool> deprecated; - /** + /** * The URI of the text document where this type hierarchy item belongs to. */ - lsDocumentUri uri; + lsDocumentUri uri; - /** + /** * The range enclosing this type hierarchy item not including leading/trailing whitespace but everything else * like comments. This information is typically used to determine if the clients cursor is inside the type * hierarchy item to reveal in the symbol in the UI. @@ -96,38 +92,40 @@ struct TypeHierarchyItem { * @see TypeHierarchyItem#selectionRange */ - lsRange range; + lsRange range; - /** + /** * The range that should be selected and revealed when this type hierarchy item is being picked, e.g the name of a function. * Must be contained by the the {@link TypeHierarchyItem#getRange range}. * * @see TypeHierarchyItem#range */ - lsRange selectionRange; + lsRange selectionRange; - /** + /** * If this type hierarchy item is resolved, it contains the direct parents. Could be empty if the item does not have any * direct parents. If not defined, the parents have not been resolved yet. */ - optional< std::vector<TypeHierarchyItem> > parents; + optional<std::vector<TypeHierarchyItem>> parents; - /** + /** * If this type hierarchy item is resolved, it contains the direct children of the current item. * Could be empty if the item does not have any descendants. If not defined, the children have not been resolved. */ - optional< std::vector<TypeHierarchyItem> > children; + optional<std::vector<TypeHierarchyItem>> children; - /** + /** * An optional data field can be used to identify a type hierarchy item in a resolve request. */ - optional<lsp::Any> data; + optional<lsp::Any> data; - MAKE_SWAP_METHOD(TypeHierarchyItem, name, detail, kind, deprecated, uri, range, selectionRange, parents, children, data) + MAKE_SWAP_METHOD( + TypeHierarchyItem, name, detail, kind, deprecated, uri, range, selectionRange, parents, children, data + ) }; -MAKE_REFLECT_STRUCT(TypeHierarchyItem, name, detail, kind, deprecated, uri, range, selectionRange, parents, children, data); - - +MAKE_REFLECT_STRUCT( + TypeHierarchyItem, name, detail, kind, deprecated, uri, range, selectionRange, parents, children, data +); DEFINE_REQUEST_RESPONSE_TYPE(td_typeHierarchy, TypeHierarchyParams, TypeHierarchyItem, "textDocument/typeHierarchy"); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/type_definition.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/type_definition.h index 196a65c5d3..f8ee982144 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/type_definition.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/type_definition.h @@ -1,6 +1,5 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/lsp/out_list.h" @@ -12,5 +11,6 @@ * * Since version 3.6.0 */ -DEFINE_REQUEST_RESPONSE_TYPE(td_typeDefinition, - lsTextDocumentPositionParams, LocationListEither::Either, "textDocument/typeDefinition"); +DEFINE_REQUEST_RESPONSE_TYPE( + td_typeDefinition, lsTextDocumentPositionParams, LocationListEither::Either, "textDocument/typeDefinition" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/willSave.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/willSave.h index 4fe33d1dcc..511b14c64c 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/willSave.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/willSave.h @@ -1,51 +1,53 @@ #pragma once - #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" #include "LibLsp/lsp/lsTextDocumentIdentifier.h" -namespace WillSaveTextDocumentParams { +namespace WillSaveTextDocumentParams +{ - /** +/** * Represents reasons why a text document is saved. */ - enum class TextDocumentSaveReason { +enum class TextDocumentSaveReason +{ - /** + /** * Manually triggered, e.g. by the user pressing save, by starting debugging, * or by an API call. */ - Manual=(1), + Manual = (1), - /** + /** * Automatic after a delay. */ - AfterDelay=(2), + AfterDelay = (2), - /** + /** * When the editor lost focus. */ - FocusOut=(3) - }; + FocusOut = (3) +}; - struct Params { - /** +struct Params +{ + /** * The document that will be saved. */ lsTextDocumentIdentifier textDocument; - /* + /* * A reason why a text document is saved. */ - optional<TextDocumentSaveReason> reason; - - MAKE_SWAP_METHOD(Params, textDocument, reason); - }; + optional<TextDocumentSaveReason> reason; + MAKE_SWAP_METHOD(Params, textDocument, reason); }; + +}; // namespace WillSaveTextDocumentParams MAKE_REFLECT_TYPE_PROXY(WillSaveTextDocumentParams::TextDocumentSaveReason); MAKE_REFLECT_STRUCT(WillSaveTextDocumentParams::Params, textDocument, reason); @@ -66,6 +68,6 @@ DEFINE_NOTIFICATION_TYPE(td_willSave, WillSaveTextDocumentParams::Params, "textD * * Registration Options: TextDocumentRegistrationOptions */ -DEFINE_REQUEST_RESPONSE_TYPE(td_willSaveWaitUntil, - WillSaveTextDocumentParams::Params, std::vector<lsTextEdit>, "textDocument/willSaveWaitUntil"); - +DEFINE_REQUEST_RESPONSE_TYPE( + td_willSaveWaitUntil, WillSaveTextDocumentParams::Params, std::vector<lsTextEdit>, "textDocument/willSaveWaitUntil" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/utils.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/utils.h index 5f1769f80a..8fd6f8276c 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/utils.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/utils.h @@ -12,64 +12,56 @@ #include "lsPosition.h" - namespace lsp { - // Returns true if |value| starts/ends with |start| or |ending|. bool StartsWith(std::string value, std::string start); bool EndsWith(std::string value, std::string ending); -bool AnyStartsWith(const std::vector<std::string>& values, - const std::string& start); -bool StartsWithAny(const std::string& value, - const std::vector<std::string>& startings); -bool EndsWithAny(const std::string& value, - const std::vector<std::string>& endings); -bool FindAnyPartial(const std::string& value, - const std::vector<std::string>& values); +bool AnyStartsWith(std::vector<std::string> const& values, std::string const& start); +bool StartsWithAny(std::string const& value, std::vector<std::string> const& startings); +bool EndsWithAny(std::string const& value, std::vector<std::string> const& endings); +bool FindAnyPartial(std::string const& value, std::vector<std::string> const& values); // Returns the dirname of |path|, i.e. "foo/bar.cc" => "foo/", "foo" => "./", // "/foo" => "/". The result always ends in '/'. std::string GetDirName(std::string path); // Returns the basename of |path|, ie, "foo/bar.cc" => "bar.cc". -std::string GetBaseName(const std::string& path); +std::string GetBaseName(std::string const& path); // Returns |path| without the filetype, ie, "foo/bar.cc" => "foo/bar". -std::string StripFileType(const std::string& path); - -std::string ReplaceAll(const std::string& source, - const std::string& from, - const std::string& to); - -std::vector<std::string> SplitString(const std::string& str, - const std::string& delimiter); - -template <typename TValues, typename TMap> -std::string StringJoinMap(const TValues& values, - const TMap& map, - const std::string& sep = ", ") { - std::string result; - bool first = true; - for (auto& entry : values) { - if (!first) - result += sep; - first = false; - result += map(entry); - } - return result; -} +std::string StripFileType(std::string const& path); + +std::string ReplaceAll(std::string const& source, std::string const& from, std::string const& to); -template <typename TValues> -std::string StringJoin(const TValues& values, const std::string& sep = ", ") { - return StringJoinMap(values, [](const std::string& entry) { return entry; }, - sep); +std::vector<std::string> SplitString(std::string const& str, std::string const& delimiter); + +template<typename TValues, typename TMap> +std::string StringJoinMap(TValues const& values, TMap const& map, std::string const& sep = ", ") +{ + std::string result; + bool first = true; + for (auto& entry : values) + { + if (!first) + { + result += sep; + } + first = false; + result += map(entry); + } + return result; } -template <typename TCollection, typename TValue> -bool ContainsValue(const TCollection& collection, const TValue& value) { - return std::find(std::begin(collection), std::end(collection), value) != - std::end(collection); +template<typename TValues> +std::string StringJoin(TValues const& values, std::string const& sep = ", ") +{ + return StringJoinMap(values, [](std::string const& entry) { return entry; }, sep); } +template<typename TCollection, typename TValue> +bool ContainsValue(TCollection const& collection, TValue const& value) +{ + return std::find(std::begin(collection), std::end(collection), value) != std::end(collection); +} // Ensures that |path| ends in a slash. void EnsureEndsInSlash(std::string& path); @@ -79,16 +71,16 @@ void EnsureEndsInSlash(std::string& path); std::string EscapeFileName(std::string path); // FIXME: Move ReadContent into ICacheManager? -bool FileExists(const std::string& filename); -optional<std::string> ReadContent(const AbsolutePath& filename); -std::vector<std::string> ReadLinesWithEnding(const AbsolutePath& filename); +bool FileExists(std::string const& filename); +optional<std::string> ReadContent(AbsolutePath const& filename); +std::vector<std::string> ReadLinesWithEnding(AbsolutePath const& filename); -bool WriteToFile(const std::string& filename, const std::string& content); +bool WriteToFile(std::string const& filename, std::string const& content); - -template <typename T, typename Fn> -void RemoveIf(std::vector<T>* vec, Fn predicate) { - vec->erase(std::remove_if(vec->begin(), vec->end(), predicate), vec->end()); +template<typename T, typename Fn> +void RemoveIf(std::vector<T>* vec, Fn predicate) +{ + vec->erase(std::remove_if(vec->begin(), vec->end(), predicate), vec->end()); } std::string FormatMicroseconds(long long microseconds); @@ -97,45 +89,35 @@ std::string FormatMicroseconds(long long microseconds); std::string UpdateToRnNewlines(std::string output); // Utility methods to check if |path| is absolute. -bool IsAbsolutePath(const std::string& path); -bool IsUnixAbsolutePath(const std::string& path); -bool IsWindowsAbsolutePath(const std::string& path); +bool IsAbsolutePath(std::string const& path); +bool IsUnixAbsolutePath(std::string const& path); +bool IsWindowsAbsolutePath(std::string const& path); -bool IsDirectory(const std::string& path); +bool IsDirectory(std::string const& path); // string <-> wstring conversion (UTF-16), e.g. for use with Window's wide APIs. - std::string ws2s(std::wstring const& wstr); - std::wstring s2ws(std::string const& str); +std::string ws2s(std::wstring const& wstr); +std::wstring s2ws(std::string const& str); -AbsolutePath NormalizePath(const std::string& path, - bool ensure_exists = true, - bool force_lower_on_windows = true); +AbsolutePath NormalizePath(std::string const& path, bool ensure_exists = true, bool force_lower_on_windows = true); - -int GetOffsetForPosition(lsPosition position, const std::string& content); +int GetOffsetForPosition(lsPosition position, std::string const& content); // Finds the position for an |offset| in |content|. -lsPosition GetPositionForOffset(int offset, const std::string& content); +lsPosition GetPositionForOffset(int offset, std::string const& content); // Utility method to find a position for the given character. -lsPosition CharPos(const std::string& search, - char character, - int character_offset = 0); - +lsPosition CharPos(std::string const& search, char character, int character_offset = 0); - void scanDirsNoRecursive(const std::wstring& rootPath, std::vector<std::wstring>& ret); +void scanDirsNoRecursive(std::wstring const& rootPath, std::vector<std::wstring>& ret); - void scanFilesUseRecursive(const std::wstring& rootPath, std::vector<std::wstring>& ret, - std::wstring strSuf = L""); +void scanFilesUseRecursive(std::wstring const& rootPath, std::vector<std::wstring>& ret, std::wstring strSuf = L""); - void scanFileNamesUseRecursive(const std::wstring& rootPath, std::vector<std::wstring>& ret, - std::wstring strSuf = L""); - void scanFileNamesUseRecursive(const std::string& rootPath, std::vector<std::string>& ret, - std::string strSuf = ""); +void scanFileNamesUseRecursive(std::wstring const& rootPath, std::vector<std::wstring>& ret, std::wstring strSuf = L""); +void scanFileNamesUseRecursive(std::string const& rootPath, std::vector<std::string>& ret, std::string strSuf = ""); - void scanFilesUseRecursive(const std::string& rootPath, std::vector<std::string>& ret, - std::string strSuf = ""); +void scanFilesUseRecursive(std::string const& rootPath, std::vector<std::string>& ret, std::string strSuf = ""); - void scanDirsUseRecursive(const std::wstring& rootPath, std::vector<std::wstring>& ret); +void scanDirsUseRecursive(std::wstring const& rootPath, std::vector<std::wstring>& ret); -} +} // namespace lsp diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h index 332fb7e2e7..567c061068 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h @@ -5,68 +5,73 @@ #include "LibLsp/JsonRpc/lsResponseMessage.h" // Show a message to the user. -enum class lsMessageType : int { Error = 1, Warning = 2, Info = 3, Log = 4 }; +enum class lsMessageType : int +{ + Error = 1, + Warning = 2, + Info = 3, + Log = 4 +}; MAKE_REFLECT_TYPE_PROXY(lsMessageType) -struct MessageParams { -/** +struct MessageParams +{ + /** * The message type. */ - lsMessageType type = lsMessageType::Error; + lsMessageType type = lsMessageType::Error; -/** + /** * The actual message. */ - std::string message; - - void swap(MessageParams& arg) noexcept { - lsMessageType temp = type; - type = arg.type; - arg.type = temp; - message.swap(arg.message); - } + std::string message; + + void swap(MessageParams& arg) noexcept + { + lsMessageType temp = type; + type = arg.type; + arg.type = temp; + message.swap(arg.message); + } }; MAKE_REFLECT_STRUCT(MessageParams, type, message) - /** +/** * The log message notification is send from the server to the client to ask * the client to log a particular message. */ DEFINE_NOTIFICATION_TYPE(Notify_LogMessage, MessageParams, "window/logMessage") - /** * The show message notification is sent from a server to a client to ask * the client to display a particular message in the user interface. */ DEFINE_NOTIFICATION_TYPE(Notify_ShowMessage, MessageParams, "window/showMessage") - - /** * The show message request is sent from a server to a client to ask the client to display a particular message in the * user class. In addition to the show message notification the request allows to pass actions and to wait for an * answer from the client. */ -struct MessageActionItem { - /** +struct MessageActionItem +{ + /** * A short title like 'Retry', 'Open Log' etc. */ - std::string title; - MAKE_SWAP_METHOD(MessageActionItem, title) + std::string title; + MAKE_SWAP_METHOD(MessageActionItem, title) }; MAKE_REFLECT_STRUCT(MessageActionItem, title); - -struct ShowMessageRequestParams :public MessageParams { - /** +struct ShowMessageRequestParams : public MessageParams +{ + /** * The message action items to present. */ - std::vector<MessageActionItem> actions; - - MAKE_SWAP_METHOD(ShowMessageRequestParams, type, message, actions) + std::vector<MessageActionItem> actions; + MAKE_SWAP_METHOD(ShowMessageRequestParams, type, message, actions) }; MAKE_REFLECT_STRUCT(ShowMessageRequestParams, type, message, actions) @@ -78,6 +83,3 @@ MAKE_REFLECT_STRUCT(ShowMessageRequestParams, type, message, actions) */ DEFINE_REQUEST_RESPONSE_TYPE(WindowShowMessage, ShowMessageRequestParams, MessageActionItem, "window/showMessage") - - - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/working_files.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/working_files.h index 916268f0fa..d4b872e5ce 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/working_files.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/working_files.h @@ -12,61 +12,66 @@ struct WorkingFiles; struct WorkingFilesData; -struct WorkingFile { +struct WorkingFile +{ int version = 0; AbsolutePath filename; Directory directory; WorkingFiles& parent; std::atomic<long long> counter; - WorkingFile(WorkingFiles& ,const AbsolutePath& filename, const std::string& buffer_content); - WorkingFile(WorkingFiles&, const AbsolutePath& filename, std::string&& buffer_content); - const std::string& GetContentNoLock() const + WorkingFile(WorkingFiles&, AbsolutePath const& filename, std::string const& buffer_content); + WorkingFile(WorkingFiles&, AbsolutePath const& filename, std::string&& buffer_content); + std::string const& GetContentNoLock() const { - return buffer_content; + return buffer_content; } + protected: friend struct WorkingFiles; std::string buffer_content; }; -struct WorkingFiles { +struct WorkingFiles +{ - WorkingFiles(); - ~WorkingFiles(); + WorkingFiles(); + ~WorkingFiles(); - void CloseFilesInDirectory(const std::vector<Directory>&); - std::shared_ptr<WorkingFile> OnOpen(lsTextDocumentItem& open); - std::shared_ptr<WorkingFile> OnChange(const lsTextDocumentDidChangeParams& change); - bool OnClose(const lsTextDocumentIdentifier& close); - std::shared_ptr<WorkingFile> OnSave(const lsTextDocumentIdentifier& _save); + void CloseFilesInDirectory(std::vector<Directory> const&); + std::shared_ptr<WorkingFile> OnOpen(lsTextDocumentItem& open); + std::shared_ptr<WorkingFile> OnChange(lsTextDocumentDidChangeParams const& change); + bool OnClose(lsTextDocumentIdentifier const& close); + std::shared_ptr<WorkingFile> OnSave(lsTextDocumentIdentifier const& _save); - bool GetFileBufferContent(const AbsolutePath& filename, std::wstring& out) - { - auto file = GetFileByFilename(filename); - if(!file) - return false; + bool GetFileBufferContent(AbsolutePath const& filename, std::wstring& out) + { + auto file = GetFileByFilename(filename); + if (!file) + { + return false; + } + return GetFileBufferContent(file, out); + } + bool GetFileBufferContent(AbsolutePath const& filename, std::string& out) + { + auto file = GetFileByFilename(filename); + if (!file) + { + return false; + } return GetFileBufferContent(file, out); - } - bool GetFileBufferContent(const AbsolutePath& filename,std::string& out) - { - auto file = GetFileByFilename(filename); - if (!file) - return false; - return GetFileBufferContent(file, out); - } - bool GetFileBufferContent(std::shared_ptr<WorkingFile>&, std::string& out); - bool GetFileBufferContent(std::shared_ptr<WorkingFile>&, std::wstring& out); + } + bool GetFileBufferContent(std::shared_ptr<WorkingFile>&, std::string& out); + bool GetFileBufferContent(std::shared_ptr<WorkingFile>&, std::wstring& out); + // Find the file with the given filename. + std::shared_ptr<WorkingFile> GetFileByFilename(AbsolutePath const& filename); - // Find the file with the given filename. - std::shared_ptr<WorkingFile> GetFileByFilename(const AbsolutePath& filename); + void Clear(); - void Clear(); private: - std::shared_ptr<WorkingFile> GetFileByFilenameNoLock(const AbsolutePath& filename); - - WorkingFilesData* d_ptr; - + std::shared_ptr<WorkingFile> GetFileByFilenameNoLock(AbsolutePath const& filename); + WorkingFilesData* d_ptr; }; diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/applyEdit.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/applyEdit.h index eb1f250b2f..4ee08a2358 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/applyEdit.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/applyEdit.h @@ -6,37 +6,36 @@ #include "LibLsp/lsp/lsDocumentUri.h" #include "LibLsp/lsp/lsWorkspaceEdit.h" -struct ApplyWorkspaceEditParams +struct ApplyWorkspaceEditParams { - /** + /** * The edits to apply. */ - lsWorkspaceEdit edit; + lsWorkspaceEdit edit; - /** + /** * An optional label of the workspace edit. This label is * presented in the user interface for example on an undo * stack to undo the workspace edit. */ - std::string label; + std::string label; - MAKE_SWAP_METHOD(ApplyWorkspaceEditParams, edit, label) + MAKE_SWAP_METHOD(ApplyWorkspaceEditParams, edit, label) }; /** * The workspace/applyEdit request is sent from the server to the client to modify resource on the client side. */ MAKE_REFLECT_STRUCT(ApplyWorkspaceEditParams, edit, label); - - -struct ApplyWorkspaceEditResponse +struct ApplyWorkspaceEditResponse { - bool applied; - optional<std::string> failureReason; - MAKE_SWAP_METHOD(ApplyWorkspaceEditResponse, applied, failureReason) + bool applied; + optional<std::string> failureReason; + MAKE_SWAP_METHOD(ApplyWorkspaceEditResponse, applied, failureReason) }; MAKE_REFLECT_STRUCT(ApplyWorkspaceEditResponse, applied, failureReason); - -DEFINE_REQUEST_RESPONSE_TYPE(WorkspaceApply, ApplyWorkspaceEditParams, ApplyWorkspaceEditResponse, "workspace/applyEdit"); +DEFINE_REQUEST_RESPONSE_TYPE( + WorkspaceApply, ApplyWorkspaceEditParams, ApplyWorkspaceEditResponse, "workspace/applyEdit" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/configuration.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/configuration.h index ad22bf0185..c545fb04ae 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/configuration.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/configuration.h @@ -5,24 +5,24 @@ #include "LibLsp/lsp/lsDocumentUri.h" - -struct ConfigurationItem { - /** +struct ConfigurationItem +{ + /** * The scope to get the configuration section for. */ - lsDocumentUri scopeUri; + lsDocumentUri scopeUri; - /** + /** * The configuration section asked for. */ - std::string section; - MAKE_SWAP_METHOD(ConfigurationItem, scopeUri, section); + std::string section; + MAKE_SWAP_METHOD(ConfigurationItem, scopeUri, section); }; MAKE_REFLECT_STRUCT(ConfigurationItem, scopeUri, section); struct ConfigurationParams { - std::vector<ConfigurationItem> items; - MAKE_SWAP_METHOD(ConfigurationParams, items) + std::vector<ConfigurationItem> items; + MAKE_SWAP_METHOD(ConfigurationParams, items) }; MAKE_REFLECT_STRUCT(ConfigurationParams, items); @@ -34,4 +34,6 @@ MAKE_REFLECT_STRUCT(ConfigurationParams, items); * order of the passed ConfigurationItems (e.g. the first item in the response is the * result for the first configuration item in the params). */ -DEFINE_REQUEST_RESPONSE_TYPE(WorkspaceConfiguration, ConfigurationParams,std::vector<lsp::Any>, "workspace/configuration"); +DEFINE_REQUEST_RESPONSE_TYPE( + WorkspaceConfiguration, ConfigurationParams, std::vector<lsp::Any>, "workspace/configuration" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/didChangeWorkspaceFolders.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/didChangeWorkspaceFolders.h index 1c6cd83b62..ee1f9b10eb 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/didChangeWorkspaceFolders.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/didChangeWorkspaceFolders.h @@ -4,35 +4,35 @@ /** * The workspace folder change event. */ -struct WorkspaceFoldersChangeEvent { - /** +struct WorkspaceFoldersChangeEvent +{ + /** * The array of added workspace folders */ - std::vector<WorkspaceFolder> added; + std::vector<WorkspaceFolder> added; - /** + /** * The array of the removed workspace folders */ - std::vector <WorkspaceFolder> removed; - MAKE_SWAP_METHOD(WorkspaceFoldersChangeEvent, added, removed); - + std::vector<WorkspaceFolder> removed; + MAKE_SWAP_METHOD(WorkspaceFoldersChangeEvent, added, removed); }; MAKE_REFLECT_STRUCT(WorkspaceFoldersChangeEvent, added, removed); -struct DidChangeWorkspaceFoldersParams { - /** +struct DidChangeWorkspaceFoldersParams +{ + /** * The actual workspace folder change event. */ - WorkspaceFoldersChangeEvent event; + WorkspaceFoldersChangeEvent event; - MAKE_SWAP_METHOD(DidChangeWorkspaceFoldersParams, event); + MAKE_SWAP_METHOD(DidChangeWorkspaceFoldersParams, event); }; MAKE_REFLECT_STRUCT(DidChangeWorkspaceFoldersParams, event); - /** * The workspace/didChangeWorkspaceFolders notification is sent from the client * to the server to inform the server about workspace folder configuration changes. @@ -40,9 +40,6 @@ MAKE_REFLECT_STRUCT(DidChangeWorkspaceFoldersParams, event); * and ClientCapabilities/workspace/workspaceFolders are true; or if the server has * registered to receive this notification it first. */ -DEFINE_NOTIFICATION_TYPE(Notify_WorkspaceDidChangeWorkspaceFolders, - DidChangeWorkspaceFoldersParams, "workspace/didChangeWorkspaceFolders"); - - - - +DEFINE_NOTIFICATION_TYPE( + Notify_WorkspaceDidChangeWorkspaceFolders, DidChangeWorkspaceFoldersParams, "workspace/didChangeWorkspaceFolders" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/did_change_configuration.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/did_change_configuration.h index 3e7ca6dded..c67da825da 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/did_change_configuration.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/did_change_configuration.h @@ -2,18 +2,15 @@ #include "LibLsp/JsonRpc/NotificationInMessage.h" - #include "workspaceFolders.h" - - - -struct lsDidChangeConfigurationParams { - /** +struct lsDidChangeConfigurationParams +{ + /** * The actual changed settings. */ - lsp::Any settings; - MAKE_SWAP_METHOD(lsDidChangeConfigurationParams, settings); + lsp::Any settings; + MAKE_SWAP_METHOD(lsDidChangeConfigurationParams, settings); }; MAKE_REFLECT_STRUCT(lsDidChangeConfigurationParams, settings); @@ -22,4 +19,6 @@ MAKE_REFLECT_STRUCT(lsDidChangeConfigurationParams, settings); * A notification sent from the client to the server to signal the change of * configuration settings. */ -DEFINE_NOTIFICATION_TYPE(Notify_WorkspaceDidChangeConfiguration, lsDidChangeConfigurationParams, "workspace/didChangeConfiguration"); +DEFINE_NOTIFICATION_TYPE( + Notify_WorkspaceDidChangeConfiguration, lsDidChangeConfigurationParams, "workspace/didChangeConfiguration" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/did_change_watched_files.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/did_change_watched_files.h index c14a7e0eda..33fa5ac55d 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/did_change_watched_files.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/did_change_watched_files.h @@ -2,13 +2,14 @@ #include "LibLsp/JsonRpc/NotificationInMessage.h" #include "LibLsp/lsp/lsDocumentUri.h" -enum class lsFileChangeType { - Created = 1, - Changed = 2, - Deleted = 3, +enum class lsFileChangeType +{ + Created = 1, + Changed = 2, + Deleted = 3, }; -#ifdef _WIN32 +#ifdef _WIN32 MAKE_REFLECT_TYPE_PROXY(lsFileChangeType); #else //#pragma clang diagnostic push @@ -17,25 +18,26 @@ MAKE_REFLECT_TYPE_PROXY(lsFileChangeType); //#pragma clang diagnostic pop #endif - /** * An event describing a file change. */ -struct lsFileEvent { - lsDocumentUri uri; - lsFileChangeType type; +struct lsFileEvent +{ + lsDocumentUri uri; + lsFileChangeType type; - MAKE_SWAP_METHOD(lsFileEvent, uri, type) + MAKE_SWAP_METHOD(lsFileEvent, uri, type) }; MAKE_REFLECT_STRUCT(lsFileEvent, uri, type); -struct lsDidChangeWatchedFilesParams { - std::vector<lsFileEvent> changes; - MAKE_SWAP_METHOD(lsDidChangeWatchedFilesParams, changes); +struct lsDidChangeWatchedFilesParams +{ + std::vector<lsFileEvent> changes; + MAKE_SWAP_METHOD(lsDidChangeWatchedFilesParams, changes); }; MAKE_REFLECT_STRUCT(lsDidChangeWatchedFilesParams, changes); - /** +/** * The workspace/didChangeWorkspaceFolders notification is sent from the client * to the server to inform the server about workspace folder configuration changes. * The notification is sent by default if both ServerCapabilities/workspaceFolders @@ -43,4 +45,6 @@ MAKE_REFLECT_STRUCT(lsDidChangeWatchedFilesParams, changes); * registered to receive this notification it first. */ -DEFINE_NOTIFICATION_TYPE(Notify_WorkspaceDidChangeWatchedFiles, lsDidChangeWatchedFilesParams, "workspace/didChangeWatchedFiles"); +DEFINE_NOTIFICATION_TYPE( + Notify_WorkspaceDidChangeWatchedFiles, lsDidChangeWatchedFilesParams, "workspace/didChangeWatchedFiles" +); diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/execute_command.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/execute_command.h index c656ee5ef7..3132ce82d4 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/execute_command.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/execute_command.h @@ -7,8 +7,6 @@ #include "LibLsp/JsonRpc/NotificationInMessage.h" - - /** * The workspace/executeCommand request is sent from the client to the * server to trigger command execution on the server. In most cases the @@ -20,5 +18,4 @@ */ DEFINE_REQUEST_RESPONSE_TYPE(wp_executeCommand, ExecuteCommandParams, lsp::Any, "workspace/executeCommand"); - -DEFINE_NOTIFICATION_TYPE(Notify_sendNotification, ExecuteCommandParams, "workspace/notify")
\ No newline at end of file +DEFINE_NOTIFICATION_TYPE(Notify_sendNotification, ExecuteCommandParams, "workspace/notify") diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/symbol.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/symbol.h index 129fb5e822..0b64270329 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/symbol.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/symbol.h @@ -13,4 +13,3 @@ */ DEFINE_REQUEST_RESPONSE_TYPE(wp_symbol, WorkspaceSymbolParams, std::vector<lsSymbolInformation>, "workspace/symbol"); - diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/workspaceFolders.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/workspaceFolders.h index 136c1d777b..159a239eaf 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/workspaceFolders.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/workspace/workspaceFolders.h @@ -4,23 +4,23 @@ #include "LibLsp/JsonRpc/lsResponseMessage.h" #include "LibLsp/lsp/lsDocumentUri.h" -struct WorkspaceFolder { - /** +struct WorkspaceFolder +{ + /** * The associated URI for this workspace folder. */ - lsDocumentUri uri; + lsDocumentUri uri; - /** + /** * The name of the workspace folder. Defaults to the uri's basename. */ - std::string name; + std::string name; - MAKE_SWAP_METHOD(WorkspaceFolder, uri, name) + MAKE_SWAP_METHOD(WorkspaceFolder, uri, name) }; MAKE_REFLECT_STRUCT(WorkspaceFolder, uri, name); - /** * The workspace/workspaceFolders request is sent from the server to the client * to fetch the current open list of workspace folders. @@ -29,6 +29,6 @@ MAKE_REFLECT_STRUCT(WorkspaceFolder, uri, name); * an empty array if a workspace is open but no folders are configured, * the workspace folders otherwise. */ -DEFINE_REQUEST_RESPONSE_TYPE(WorkspaceFolders, - optional<JsonNull>, optional<std::vector< WorkspaceFolder>>, "workspace/workspaceFolders"); - +DEFINE_REQUEST_RESPONSE_TYPE( + WorkspaceFolders, optional<JsonNull>, optional<std::vector<WorkspaceFolder>>, "workspace/workspaceFolders" +); diff --git a/graphics/asymptote/LspCpp/src/jsonrpc/Context.cpp b/graphics/asymptote/LspCpp/src/jsonrpc/Context.cpp index 8d4094b41a..20c476f9be 100644 --- a/graphics/asymptote/LspCpp/src/jsonrpc/Context.cpp +++ b/graphics/asymptote/LspCpp/src/jsonrpc/Context.cpp @@ -9,27 +9,38 @@ #include "LibLsp/JsonRpc/Context.h" #include <cassert> -namespace lsp { +namespace lsp +{ +Context Context::empty() +{ + return Context(/*dataPtr=*/nullptr); +} -Context Context::empty() { return Context(/*dataPtr=*/nullptr); } - -Context::Context(std::shared_ptr<const Data> DataPtr) - : dataPtr(std::move(DataPtr)) {} - -Context Context::clone() const { return Context(dataPtr); } +Context::Context(std::shared_ptr<Data const> DataPtr) : dataPtr(std::move(DataPtr)) +{ +} -static Context ¤tContext() { - static thread_local auto c = Context::empty(); - return c; +Context Context::clone() const +{ + return Context(dataPtr); } -const Context &Context::current() { return currentContext(); } +static Context& currentContext() +{ + static thread_local auto c = Context::empty(); + return c; +} -Context Context::swapCurrent(Context Replacement) { - std::swap(Replacement, currentContext()); - return Replacement; +Context const& Context::current() +{ + return currentContext(); } +Context Context::swapCurrent(Context Replacement) +{ + std::swap(Replacement, currentContext()); + return Replacement; +} -} // lsp clang +} // namespace lsp diff --git a/graphics/asymptote/LspCpp/src/jsonrpc/Endpoint.cpp b/graphics/asymptote/LspCpp/src/jsonrpc/Endpoint.cpp index a66108d2e5..fe80eb7081 100644 --- a/graphics/asymptote/LspCpp/src/jsonrpc/Endpoint.cpp +++ b/graphics/asymptote/LspCpp/src/jsonrpc/Endpoint.cpp @@ -1,46 +1,43 @@ #include "LibLsp/JsonRpc/Endpoint.h" #include "LibLsp/JsonRpc/message.h" - bool GenericEndpoint::notify(std::unique_ptr<LspMessage> msg) { - auto findIt = method2notification.find(msg->GetMethodType()); - - if (findIt != method2notification.end()) - { - return findIt->second(std::move(msg)); - } - std::string info = "can't find method2notification for notification:\n" + msg->ToJson() + "\n"; - log.log(lsp::Log::Level::SEVERE, info); - return false; + auto findIt = method2notification.find(msg->GetMethodType()); + + if (findIt != method2notification.end()) + { + return findIt->second(std::move(msg)); + } + std::string info = "can't find method2notification for notification:\n" + msg->ToJson() + "\n"; + log.log(lsp::Log::Level::SEVERE, info); + return false; } -bool GenericEndpoint::onResponse(const std::string& method, std::unique_ptr<LspMessage>msg) +bool GenericEndpoint::onResponse(std::string const& method, std::unique_ptr<LspMessage> msg) { - auto findIt = method2response.find(method); + auto findIt = method2response.find(method); - if (findIt != method2response.end()) - { - return findIt->second(std::move(msg)); - } + if (findIt != method2response.end()) + { + return findIt->second(std::move(msg)); + } - std::string info = "can't find method2response for response:\n" + msg->ToJson() + "\n"; - log.log(lsp::Log::Level::SEVERE, info); + std::string info = "can't find method2response for response:\n" + msg->ToJson() + "\n"; + log.log(lsp::Log::Level::SEVERE, info); - return false; + return false; } - - bool GenericEndpoint::onRequest(std::unique_ptr<LspMessage> request) { - auto findIt = method2request.find(request->GetMethodType()); - - if (findIt != method2request.end()) - { - return findIt->second(std::move(request)); - } - std::string info = "can't find method2request for request:\n" + request->ToJson() + "\n"; - log.log(lsp::Log::Level::SEVERE, info); - return false; + auto findIt = method2request.find(request->GetMethodType()); + + if (findIt != method2request.end()) + { + return findIt->second(std::move(request)); + } + std::string info = "can't find method2request for request:\n" + request->ToJson() + "\n"; + log.log(lsp::Log::Level::SEVERE, info); + return false; } diff --git a/graphics/asymptote/LspCpp/src/jsonrpc/GCThreadContext.cpp b/graphics/asymptote/LspCpp/src/jsonrpc/GCThreadContext.cpp index 8b68d329c9..8caf0c66e8 100644 --- a/graphics/asymptote/LspCpp/src/jsonrpc/GCThreadContext.cpp +++ b/graphics/asymptote/LspCpp/src/jsonrpc/GCThreadContext.cpp @@ -14,4 +14,4 @@ GCThreadContext::~GCThreadContext() #ifdef LSPCPP_USEGC GC_unregister_my_thread(); #endif -}
\ No newline at end of file +} diff --git a/graphics/asymptote/LspCpp/src/jsonrpc/MessageJsonHandler.cpp b/graphics/asymptote/LspCpp/src/jsonrpc/MessageJsonHandler.cpp index 78cf8950c2..e1413a987e 100644 --- a/graphics/asymptote/LspCpp/src/jsonrpc/MessageJsonHandler.cpp +++ b/graphics/asymptote/LspCpp/src/jsonrpc/MessageJsonHandler.cpp @@ -2,56 +2,53 @@ #include <string> #include <rapidjson/document.h> - - -std::unique_ptr<LspMessage> MessageJsonHandler::parseResponseMessage(const std::string& method, Reader& r) +std::unique_ptr<LspMessage> MessageJsonHandler::parseResponseMessage(std::string const& method, Reader& r) { - auto findIt = method2response.find(method); + auto findIt = method2response.find(method); - if( findIt != method2response.end()) - { - return findIt->second(r); - } - return nullptr; + if (findIt != method2response.end()) + { + return findIt->second(r); + } + return nullptr; } -std::unique_ptr<LspMessage> MessageJsonHandler::parseRequstMessage(const std::string& method, Reader&r) +std::unique_ptr<LspMessage> MessageJsonHandler::parseRequstMessage(std::string const& method, Reader& r) { - auto findIt = method2request.find(method); + auto findIt = method2request.find(method); - if (findIt != method2request.end()) - { - return findIt->second(r); - } - return nullptr; + if (findIt != method2request.end()) + { + return findIt->second(r); + } + return nullptr; } -bool MessageJsonHandler::resovleResponseMessage(Reader&r, std::pair<std::string, std::unique_ptr<LspMessage>>& result) +bool MessageJsonHandler::resovleResponseMessage(Reader& r, std::pair<std::string, std::unique_ptr<LspMessage>>& result) { - for (auto& handler : method2response) + for (auto& handler : method2response) + { + try + { + auto msg = handler.second(r); + result.first = handler.first; + result.second = std::move(msg); + return true; + } + catch (...) { - try - { - auto msg = handler.second(r); - result.first = handler.first; - result.second = std::move(msg); - return true; - } - catch (...) - { - - } } - return false; + } + return false; } -std::unique_ptr<LspMessage> MessageJsonHandler::parseNotificationMessage(const std::string& method, Reader& r) +std::unique_ptr<LspMessage> MessageJsonHandler::parseNotificationMessage(std::string const& method, Reader& r) { - auto findIt = method2notification.find(method); + auto findIt = method2notification.find(method); - if (findIt != method2notification.end()) - { - return findIt->second(r); - } - return nullptr; + if (findIt != method2notification.end()) + { + return findIt->second(r); + } + return nullptr; } diff --git a/graphics/asymptote/LspCpp/src/jsonrpc/RemoteEndPoint.cpp b/graphics/asymptote/LspCpp/src/jsonrpc/RemoteEndPoint.cpp index f4bd83aae9..d705013352 100644 --- a/graphics/asymptote/LspCpp/src/jsonrpc/RemoteEndPoint.cpp +++ b/graphics/asymptote/LspCpp/src/jsonrpc/RemoteEndPoint.cpp @@ -20,7 +20,8 @@ #include "LibLsp/JsonRpc/GCThreadContext.h" -namespace lsp { +namespace lsp +{ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -73,189 +74,211 @@ namespace lsp { // ways that preserve the context. (Like runAsync() or TUScheduler). // - /// A canceller requests cancellation of a task, when called. - /// Calling it again has no effect. - using Canceler = std::function<void()>; - - // We don't want a cancelable scope to "shadow" an enclosing one. - struct CancelState { - std::shared_ptr<std::atomic<int>> cancelled; - const CancelState* parent = nullptr; - lsRequestId id; - }; - static Key<CancelState> g_stateKey; - - /// Defines a new task whose cancellation may be requested. - /// The returned Context defines the scope of the task. - /// When the context is active, getCancelledMonitor() is 0 until the Canceler is - /// invoked, and equal to Reason afterwards. - /// Conventionally, Reason may be the LSP error code to return. - std::pair<Context, Canceler> cancelableTask(const lsRequestId& id,int reason = 1){ - assert(reason != 0 && "Can't detect cancellation if Reason is zero"); - CancelState state; - state.id = id; - state.cancelled = std::make_shared<std::atomic<int>>(); - state.parent = Context::current().get(g_stateKey); - return { - Context::current().derive(g_stateKey, state), - [reason, cancelled(state.cancelled)] { *cancelled = reason; }, - }; - } - /// If the current context is within a cancelled task, returns the reason. +/// A canceller requests cancellation of a task, when called. +/// Calling it again has no effect. +using Canceler = std::function<void()>; + +// We don't want a cancelable scope to "shadow" an enclosing one. +struct CancelState +{ + std::shared_ptr<std::atomic<int>> cancelled; + CancelState const* parent = nullptr; + lsRequestId id; +}; +static Key<CancelState> g_stateKey; + +/// Defines a new task whose cancellation may be requested. +/// The returned Context defines the scope of the task. +/// When the context is active, getCancelledMonitor() is 0 until the Canceler is +/// invoked, and equal to Reason afterwards. +/// Conventionally, Reason may be the LSP error code to return. +std::pair<Context, Canceler> cancelableTask(lsRequestId const& id, int reason = 1) +{ + assert(reason != 0 && "Can't detect cancellation if Reason is zero"); + CancelState state; + state.id = id; + state.cancelled = std::make_shared<std::atomic<int>>(); + state.parent = Context::current().get(g_stateKey); + return { + Context::current().derive(g_stateKey, state), + [reason, cancelled(state.cancelled)] { *cancelled = reason; }, + }; +} +/// If the current context is within a cancelled task, returns the reason. /// (If the context is within multiple nested tasks, true if any are cancelled). /// Always zero if there is no active cancelable task. /// This isn't free (context lookup) - don't call it in a tight loop. - optional<CancelMonitor> getCancelledMonitor(const lsRequestId& id, const Context& ctx = Context::current()){ - for (const CancelState* state = ctx.get(g_stateKey); state != nullptr; - state = state->parent) - { - if (id != state->id)continue; - const std::shared_ptr<std::atomic<int> > cancelled = state->cancelled; - std::function<int()> temp = [=]{ - return cancelled->load(); - }; - return std::move(temp); - } - - return {}; +optional<CancelMonitor> getCancelledMonitor(lsRequestId const& id, Context const& ctx = Context::current()) +{ + for (CancelState const* state = ctx.get(g_stateKey); state != nullptr; state = state->parent) + { + if (id != state->id) + { + continue; } + std::shared_ptr<std::atomic<int>> const cancelled = state->cancelled; + std::function<int()> temp = [=] { return cancelled->load(); }; + return std::move(temp); + } + + return {}; +} } // namespace lsp -using namespace lsp; +using namespace lsp; class PendingRequestInfo { - using RequestCallBack = std::function< bool(std::unique_ptr<LspMessage>) >; + using RequestCallBack = std::function<bool(std::unique_ptr<LspMessage>)>; + public: - PendingRequestInfo(const std::string& md, - const RequestCallBack& callback); - PendingRequestInfo(const std::string& md); - PendingRequestInfo() {} - std::string method; - RequestCallBack futureInfo; + PendingRequestInfo(std::string const& md, RequestCallBack const& callback); + PendingRequestInfo(std::string const& md); + PendingRequestInfo() + { + } + std::string method; + RequestCallBack futureInfo; }; -PendingRequestInfo::PendingRequestInfo(const std::string& _md, - const RequestCallBack& callback) : method(_md), - futureInfo(callback) +PendingRequestInfo::PendingRequestInfo(std::string const& _md, RequestCallBack const& callback) + : method(_md), futureInfo(callback) { } -PendingRequestInfo::PendingRequestInfo(const std::string& md) : method(md) +PendingRequestInfo::PendingRequestInfo(std::string const& md) : method(md) { } struct RemoteEndPoint::Data { - explicit Data(lsp::JSONStreamStyle style,uint8_t workers,lsp::Log& _log , RemoteEndPoint* owner) - : max_workers(workers), m_id(0),next_request_cookie(0), log(_log) + explicit Data(lsp::JSONStreamStyle style, uint8_t workers, lsp::Log& _log, RemoteEndPoint* owner) + : max_workers(workers), m_id(0), next_request_cookie(0), log(_log) + { + if (style == lsp::JSONStreamStyle::Standard) { - if(style == lsp::JSONStreamStyle::Standard ) - message_producer = (new LSPStreamMessageProducer(*owner)) ; - else{ - message_producer = (new DelimitedStreamMessageProducer(*owner)) ; - } + message_producer = (new LSPStreamMessageProducer(*owner)); } - ~Data() + else { - delete message_producer; + message_producer = (new DelimitedStreamMessageProducer(*owner)); } + } + ~Data() + { + delete message_producer; + } uint8_t max_workers; - std::atomic<int> m_id; + std::atomic<int> m_id; std::shared_ptr<boost::asio::thread_pool> tp; - // Method calls may be cancelled by ID, so keep track of their state. - // This needs a mutex: handlers may finish on a different thread, and that's - // when we clean up entries in the map. - mutable std::mutex request_cancelers_mutex; - - std::map< lsRequestId, std::pair<Canceler, /*Cookie*/ unsigned> > requestCancelers; - - std::atomic<unsigned> next_request_cookie; // To disambiguate reused IDs, see below. - void onCancel(Notify_Cancellation::notify* notify) { - std::lock_guard<std::mutex> Lock(request_cancelers_mutex); - const auto it = requestCancelers.find(notify->params.id); - if (it != requestCancelers.end()) - it->second.first(); // Invoke the canceler. + // Method calls may be cancelled by ID, so keep track of their state. + // This needs a mutex: handlers may finish on a different thread, and that's + // when we clean up entries in the map. + mutable std::mutex request_cancelers_mutex; + + std::map<lsRequestId, std::pair<Canceler, /*Cookie*/ unsigned>> requestCancelers; + + std::atomic<unsigned> next_request_cookie; // To disambiguate reused IDs, see below. + void onCancel(Notify_Cancellation::notify* notify) + { + std::lock_guard<std::mutex> Lock(request_cancelers_mutex); + auto const it = requestCancelers.find(notify->params.id); + if (it != requestCancelers.end()) + { + it->second.first(); // Invoke the canceler. } + } - // We run cancelable requests in a context that does two things: - // - allows cancellation using requestCancelers[ID] - // - cleans up the entry in requestCancelers when it's no longer needed - // If a client reuses an ID, the last wins and the first cannot be canceled. - Context cancelableRequestContext(lsRequestId id) { - auto task = cancelableTask(id, - /*Reason=*/static_cast<int>(lsErrorCodes::RequestCancelled)); - unsigned cookie; + // We run cancelable requests in a context that does two things: + // - allows cancellation using requestCancelers[ID] + // - cleans up the entry in requestCancelers when it's no longer needed + // If a client reuses an ID, the last wins and the first cannot be canceled. + Context cancelableRequestContext(lsRequestId id) + { + auto task = cancelableTask( + id, + /*Reason=*/static_cast<int>(lsErrorCodes::RequestCancelled) + ); + unsigned cookie; + { + std::lock_guard<std::mutex> Lock(request_cancelers_mutex); + cookie = next_request_cookie.fetch_add(1, std::memory_order_relaxed); + requestCancelers[id] = {std::move(task.second), cookie}; + } + // When the request ends, we can clean up the entry we just added. + // The cookie lets us check that it hasn't been overwritten due to ID + // reuse. + return task.first.derive(lsp::make_scope_exit( + [this, id, cookie] + { + std::lock_guard<std::mutex> lock(request_cancelers_mutex); + auto const& it = requestCancelers.find(id); + if (it != requestCancelers.end() && it->second.second == cookie) { - std::lock_guard<std::mutex> Lock(request_cancelers_mutex); - cookie = next_request_cookie.fetch_add(1, std::memory_order_relaxed); - requestCancelers[id] = { std::move(task.second), cookie }; + requestCancelers.erase(it); } - // When the request ends, we can clean up the entry we just added. - // The cookie lets us check that it hasn't been overwritten due to ID - // reuse. - return task.first.derive(lsp::make_scope_exit([this, id, cookie] { - std::lock_guard<std::mutex> lock(request_cancelers_mutex); - const auto& it = requestCancelers.find(id); - if (it != requestCancelers.end() && it->second.second == cookie) - requestCancelers.erase(it); - })); - } + } + )); + } - std::map <lsRequestId, std::shared_ptr<PendingRequestInfo>> _client_request_futures; - StreamMessageProducer* message_producer; - std::atomic<bool> quit{}; - lsp::Log& log; - std::shared_ptr<lsp::istream> input; - std::shared_ptr<lsp::ostream> output; + std::map<lsRequestId, std::shared_ptr<PendingRequestInfo>> _client_request_futures; + StreamMessageProducer* message_producer; + std::atomic<bool> quit {}; + lsp::Log& log; + std::shared_ptr<lsp::istream> input; + std::shared_ptr<lsp::ostream> output; std::mutex m_requestInfo; - bool pendingRequest(RequestInMessage& info, GenericResponseHandler&& handler) - { + bool pendingRequest(RequestInMessage& info, GenericResponseHandler&& handler) + { bool ret = true; std::lock_guard<std::mutex> lock(m_requestInfo); - if(!info.id.has_value()){ + if (!info.id.has_value()) + { auto id = getNextRequestId(); info.id.set(id); } - else{ - if(_client_request_futures.find(info.id) != _client_request_futures.end()){ - ret = false; + else + { + if (_client_request_futures.find(info.id) != _client_request_futures.end()) + { + ret = false; } } _client_request_futures[info.id] = std::make_shared<PendingRequestInfo>(info.method, handler); return ret; - } - const std::shared_ptr<const PendingRequestInfo> getRequestInfo(const lsRequestId& _id) + } + std::shared_ptr<PendingRequestInfo const> const getRequestInfo(lsRequestId const& _id) + { + std::lock_guard<std::mutex> lock(m_requestInfo); + auto findIt = _client_request_futures.find(_id); + if (findIt != _client_request_futures.end()) { - std::lock_guard<std::mutex> lock(m_requestInfo); - auto findIt = _client_request_futures.find(_id); - if (findIt != _client_request_futures.end()) - { - return findIt->second; - } - return nullptr; + return findIt->second; } + return nullptr; + } - void removeRequestInfo(const lsRequestId& _id) + void removeRequestInfo(lsRequestId const& _id) + { + std::lock_guard<std::mutex> lock(m_requestInfo); + auto findIt = _client_request_futures.find(_id); + if (findIt != _client_request_futures.end()) { - std::lock_guard<std::mutex> lock(m_requestInfo); - auto findIt = _client_request_futures.find(_id); - if (findIt != _client_request_futures.end()) - { - _client_request_futures.erase(findIt); - } + _client_request_futures.erase(findIt); } - void clear() + } + void clear() + { { - { - std::lock_guard<std::mutex> lock(m_requestInfo); - _client_request_futures.clear(); - } - if(tp){ - tp->stop(); + std::lock_guard<std::mutex> lock(m_requestInfo); + _client_request_futures.clear(); } - quit.store(true, std::memory_order_relaxed); + if (tp) + { + tp->stop(); } + quit.store(true, std::memory_order_relaxed); + } int getNextRequestId() { @@ -265,248 +288,246 @@ struct RemoteEndPoint::Data namespace { -void WriterMsg(std::shared_ptr<lsp::ostream>& output, LspMessage& msg) +void WriterMsg(std::shared_ptr<lsp::ostream>& output, LspMessage& msg) { - const auto& s = msg.ToJson(); - const auto value = - std::string("Content-Length: ") + std::to_string(s.size()) + "\r\n\r\n" + s; - output->write(value); - output->flush(); + auto const& s = msg.ToJson(); + auto const value = std::string("Content-Length: ") + std::to_string(s.size()) + "\r\n\r\n" + s; + output->write(value); + output->flush(); } bool isResponseMessage(JsonReader& visitor) { - if (!visitor.HasMember("id")) - { - return false; - } + if (!visitor.HasMember("id")) + { + return false; + } - if (!visitor.HasMember("result") && !visitor.HasMember("error")) - { - return false; - } + if (!visitor.HasMember("result") && !visitor.HasMember("error")) + { + return false; + } - return true; + return true; } bool isRequestMessage(JsonReader& visitor) { - if (!visitor.HasMember("method")) - { - return false; - } - if (!visitor["method"]->IsString()) - { - return false; - } - if (!visitor.HasMember("id")) - { - return false; - } - return true; + if (!visitor.HasMember("method")) + { + return false; + } + if (!visitor["method"]->IsString()) + { + return false; + } + if (!visitor.HasMember("id")) + { + return false; + } + return true; } bool isNotificationMessage(JsonReader& visitor) { - if (!visitor.HasMember("method")) - { - return false; - } - if (!visitor["method"]->IsString()) - { - return false; - } - if (visitor.HasMember("id")) - { - return false; - } - return true; -} + if (!visitor.HasMember("method")) + { + return false; + } + if (!visitor["method"]->IsString()) + { + return false; + } + if (visitor.HasMember("id")) + { + return false; + } + return true; } +} // namespace -CancelMonitor RemoteEndPoint::getCancelMonitor(const lsRequestId& id) +CancelMonitor RemoteEndPoint::getCancelMonitor(lsRequestId const& id) { - auto monitor = getCancelledMonitor(id); - if(monitor.has_value()) - { - return monitor.value(); - } - return [] { - return 0; - }; - + auto monitor = getCancelledMonitor(id); + if (monitor.has_value()) + { + return monitor.value(); + } + return [] { return 0; }; } RemoteEndPoint::RemoteEndPoint( - const std::shared_ptr < MessageJsonHandler >& json_handler,const std::shared_ptr < Endpoint>& localEndPoint, - lsp::Log& _log, lsp::JSONStreamStyle style, uint8_t max_workers): - d_ptr(new Data(style,max_workers,_log,this)),jsonHandler(json_handler), local_endpoint(localEndPoint) + std::shared_ptr<MessageJsonHandler> const& json_handler, std::shared_ptr<Endpoint> const& localEndPoint, + lsp::Log& _log, lsp::JSONStreamStyle style, uint8_t max_workers +) + : d_ptr(new Data(style, max_workers, _log, this)), jsonHandler(json_handler), local_endpoint(localEndPoint) { - jsonHandler->method2notification[Notify_Cancellation::notify::kMethodInfo] = [](Reader& visitor) - { - return Notify_Cancellation::notify::ReflectReader(visitor); - }; + jsonHandler->method2notification[Notify_Cancellation::notify::kMethodInfo] = [](Reader& visitor) + { return Notify_Cancellation::notify::ReflectReader(visitor); }; - d_ptr->quit.store(false, std::memory_order_relaxed); + d_ptr->quit.store(false, std::memory_order_relaxed); } RemoteEndPoint::~RemoteEndPoint() { - delete d_ptr; - d_ptr->quit.store(true, std::memory_order_relaxed); + delete d_ptr; + d_ptr->quit.store(true, std::memory_order_relaxed); } -bool RemoteEndPoint::dispatch(const std::string& content) +bool RemoteEndPoint::dispatch(std::string const& content) { - rapidjson::Document document; - document.Parse(content.c_str(), content.length()); - if (document.HasParseError()) - { - std::string info ="lsp msg format error:"; - rapidjson::GetParseErrorFunc GetParseError = rapidjson::GetParseError_En; // or whatever - info+= GetParseError(document.GetParseError()); - info += "\n"; - info += "ErrorContext offset:\n"; - info += content.substr(document.GetErrorOffset()); - d_ptr->log.log(Log::Level::SEVERE, info); - - return false; - } + rapidjson::Document document; + document.Parse(content.c_str(), content.length()); + if (document.HasParseError()) + { + std::string info = "lsp msg format error:"; + rapidjson::GetParseErrorFunc GetParseError = rapidjson::GetParseError_En; // or whatever + info += GetParseError(document.GetParseError()); + info += "\n"; + info += "ErrorContext offset:\n"; + info += content.substr(document.GetErrorOffset()); + d_ptr->log.log(Log::Level::SEVERE, info); - JsonReader visitor{ &document }; - if (!visitor.HasMember("jsonrpc") || - std::string(visitor["jsonrpc"]->GetString()) != "2.0") - { - std::string reason; - reason = "Reason:Bad or missing jsonrpc version\n"; - reason += "content:\n" + content; - d_ptr->log.log(Log::Level::SEVERE, reason); - return false; + return false; + } - } - LspMessage::Kind _kind = LspMessage::NOTIFICATION_MESSAGE; - try { - if (isRequestMessage(visitor)) - { - _kind = LspMessage::REQUEST_MESSAGE; - auto msg = jsonHandler->parseRequstMessage(visitor["method"]->GetString(), visitor); - if (msg) { - mainLoop(std::move(msg)); - } - else { - std::string info = "Unknown support request message when consumer message:\n"; - info += content; - d_ptr->log.log(Log::Level::WARNING, info); - return false; - } - } - else if (isResponseMessage(visitor)) - { - _kind = LspMessage::RESPONCE_MESSAGE; - lsRequestId id; - ReflectMember(visitor, "id", id); + JsonReader visitor {&document}; + if (!visitor.HasMember("jsonrpc") || std::string(visitor["jsonrpc"]->GetString()) != "2.0") + { + std::string reason; + reason = "Reason:Bad or missing jsonrpc version\n"; + reason += "content:\n" + content; + d_ptr->log.log(Log::Level::SEVERE, reason); + return false; + } + LspMessage::Kind _kind = LspMessage::NOTIFICATION_MESSAGE; + try + { + if (isRequestMessage(visitor)) + { + _kind = LspMessage::REQUEST_MESSAGE; + auto msg = jsonHandler->parseRequstMessage(visitor["method"]->GetString(), visitor); + if (msg) + { + mainLoop(std::move(msg)); + } + else + { + std::string info = "Unknown support request message when consumer message:\n"; + info += content; + d_ptr->log.log(Log::Level::WARNING, info); + return false; + } + } + else if (isResponseMessage(visitor)) + { + _kind = LspMessage::RESPONCE_MESSAGE; + lsRequestId id; + ReflectMember(visitor, "id", id); + + auto msgInfo = d_ptr->getRequestInfo(id); + if (!msgInfo) + { + std::string info = "Unknown response message :\n"; + info += content; + d_ptr->log.log(Log::Level::INFO, info); + } + else + { - auto msgInfo = d_ptr->getRequestInfo(id); - if (!msgInfo) - { + auto msg = jsonHandler->parseResponseMessage(msgInfo->method, visitor); + if (msg) + { + mainLoop(std::move(msg)); + } + else + { std::string info = "Unknown response message :\n"; info += content; - d_ptr->log.log(Log::Level::INFO, info); - } - else - { - - auto msg = jsonHandler->parseResponseMessage(msgInfo->method, visitor); - if (msg) { - mainLoop(std::move(msg)); - } - else - { - std::string info = "Unknown response message :\n"; - info += content; - d_ptr->log.log(Log::Level::SEVERE, info); - return false; - } - - } - } - else if (isNotificationMessage(visitor)) - { - auto msg = jsonHandler->parseNotificationMessage(visitor["method"]->GetString(), visitor); - if (!msg) - { - std::string info = "Unknown notification message :\n"; - info += content; - d_ptr->log.log(Log::Level::SEVERE, info); - return false; - } - mainLoop(std::move(msg)); - } - else - { - std::string info = "Unknown lsp message when consumer message:\n"; - info += content; - d_ptr->log.log(Log::Level::WARNING, info); - return false; - } + d_ptr->log.log(Log::Level::SEVERE, info); + return false; } - catch (std::exception& e) - { + } + } + else if (isNotificationMessage(visitor)) + { + auto msg = jsonHandler->parseNotificationMessage(visitor["method"]->GetString(), visitor); + if (!msg) + { + std::string info = "Unknown notification message :\n"; + info += content; + d_ptr->log.log(Log::Level::SEVERE, info); + return false; + } + mainLoop(std::move(msg)); + } + else + { + std::string info = "Unknown lsp message when consumer message:\n"; + info += content; + d_ptr->log.log(Log::Level::WARNING, info); + return false; + } + } + catch (std::exception& e) + { - std::string info = "Exception when process "; - if(_kind==LspMessage::REQUEST_MESSAGE) - { - info += "request"; - } - if (_kind == LspMessage::RESPONCE_MESSAGE) - { - info += "response"; - } - else - { - info += "notification"; - } - info += " message:\n"; - info += e.what(); - std::string reason = "Reason:" + info + "\n"; - reason += "content:\n" + content; - d_ptr->log.log(Log::Level::SEVERE, reason); - return false; - } - return true; + std::string info = "Exception when process "; + if (_kind == LspMessage::REQUEST_MESSAGE) + { + info += "request"; + } + if (_kind == LspMessage::RESPONCE_MESSAGE) + { + info += "response"; + } + else + { + info += "notification"; + } + info += " message:\n"; + info += e.what(); + std::string reason = "Reason:" + info + "\n"; + reason += "content:\n" + content; + d_ptr->log.log(Log::Level::SEVERE, reason); + return false; + } + return true; } - - bool RemoteEndPoint::internalSendRequest(RequestInMessage& info, GenericResponseHandler handler) { - std::lock_guard<std::mutex> lock(m_sendMutex); - if (!d_ptr->output || d_ptr->output->bad()) - { - std::string desc = "Output isn't good any more:\n"; - d_ptr->log.log(Log::Level::WARNING, desc); - return false; - } - if(!d_ptr->pendingRequest(info, std::move(handler))) + std::lock_guard<std::mutex> lock(m_sendMutex); + if (!d_ptr->output || d_ptr->output->bad()) + { + std::string desc = "Output isn't good any more:\n"; + d_ptr->log.log(Log::Level::WARNING, desc); + return false; + } + if (!d_ptr->pendingRequest(info, std::move(handler))) { std::string desc = "Duplicate id which of request:"; desc += info.ToJson(); desc += "\n"; d_ptr->log.log(Log::Level::WARNING, desc); } - WriterMsg(d_ptr->output, info); + WriterMsg(d_ptr->output, info); return true; } -int RemoteEndPoint::getNextRequestId(){ - return d_ptr->getNextRequestId(); +int RemoteEndPoint::getNextRequestId() +{ + return d_ptr->getNextRequestId(); } -bool RemoteEndPoint::cancelRequest(const lsRequestId& id){ - if(!isWorking()){ +bool RemoteEndPoint::cancelRequest(lsRequestId const& id) +{ + if (!isWorking()) + { return false; } auto msgInfo = d_ptr->getRequestInfo(id); - if (msgInfo){ + if (msgInfo) + { Notify_Cancellation::notify cancel_notify; cancel_notify.params.id = id; send(cancel_notify); @@ -516,140 +537,149 @@ bool RemoteEndPoint::cancelRequest(const lsRequestId& id){ } std::unique_ptr<LspMessage> RemoteEndPoint::internalWaitResponse(RequestInMessage& request, unsigned time_out) { - auto eventFuture = std::make_shared< Condition< LspMessage > >(); - internalSendRequest(request, [=](std::unique_ptr<LspMessage> data) + auto eventFuture = std::make_shared<Condition<LspMessage>>(); + internalSendRequest( + request, + [=](std::unique_ptr<LspMessage> data) { - eventFuture->notify(std::move(data)); - return true; - }); - return eventFuture->wait(time_out); + eventFuture->notify(std::move(data)); + return true; + } + ); + return eventFuture->wait(time_out); } -void RemoteEndPoint::mainLoop(std::unique_ptr<LspMessage>msg) +void RemoteEndPoint::mainLoop(std::unique_ptr<LspMessage> msg) { - if(d_ptr->quit.load(std::memory_order_relaxed)) - { - return; - } - const auto _kind = msg->GetKid(); - if (_kind == LspMessage::REQUEST_MESSAGE) + if (d_ptr->quit.load(std::memory_order_relaxed)) + { + return; + } + auto const _kind = msg->GetKid(); + if (_kind == LspMessage::REQUEST_MESSAGE) + { + auto req = static_cast<RequestInMessage*>(msg.get()); + // Calls can be canceled by the client. Add cancellation context. + WithContext WithCancel(d_ptr->cancelableRequestContext(req->id)); + local_endpoint->onRequest(std::move(msg)); + } + + else if (_kind == LspMessage::RESPONCE_MESSAGE) + { + auto const id = static_cast<ResponseInMessage*>(msg.get())->id; + auto msgInfo = d_ptr->getRequestInfo(id); + if (!msgInfo) { - auto req = static_cast<RequestInMessage*>(msg.get()); - // Calls can be canceled by the client. Add cancellation context. - WithContext WithCancel(d_ptr->cancelableRequestContext(req->id)); - local_endpoint->onRequest(std::move(msg)); + auto const _method_desc = msg->GetMethodType(); + local_endpoint->onResponse(_method_desc, std::move(msg)); } - - else if (_kind == LspMessage::RESPONCE_MESSAGE) + else { - const auto id = static_cast<ResponseInMessage*>(msg.get())->id; - auto msgInfo = d_ptr->getRequestInfo(id); - if (!msgInfo) + bool needLocal = true; + if (msgInfo->futureInfo) + { + if (msgInfo->futureInfo(std::move(msg))) { - const auto _method_desc = msg->GetMethodType(); - local_endpoint->onResponse(_method_desc, std::move(msg)); - } - else - { - bool needLocal = true; - if (msgInfo->futureInfo) - { - if (msgInfo->futureInfo(std::move(msg))) - { - needLocal = false; - } - } - if (needLocal) - { - local_endpoint->onResponse(msgInfo->method, std::move(msg)); - } - d_ptr->removeRequestInfo(id); + needLocal = false; } + } + if (needLocal) + { + local_endpoint->onResponse(msgInfo->method, std::move(msg)); + } + d_ptr->removeRequestInfo(id); } - else if (_kind == LspMessage::NOTIFICATION_MESSAGE) + } + else if (_kind == LspMessage::NOTIFICATION_MESSAGE) + { + if (strcmp(Notify_Cancellation::notify::kMethodInfo, msg->GetMethodType()) == 0) { - if (strcmp(Notify_Cancellation::notify::kMethodInfo, msg->GetMethodType())==0) - { - d_ptr->onCancel(static_cast<Notify_Cancellation::notify*>(msg.get())); - } - else - { - local_endpoint->notify(std::move(msg)); - } - + d_ptr->onCancel(static_cast<Notify_Cancellation::notify*>(msg.get())); } else { - std::string info = "Unknown lsp message when process message in mainLoop:\n"; - d_ptr->log.log(Log::Level::WARNING, info); + local_endpoint->notify(std::move(msg)); } + } + else + { + std::string info = "Unknown lsp message when process message in mainLoop:\n"; + d_ptr->log.log(Log::Level::WARNING, info); + } } void RemoteEndPoint::handle(std::vector<MessageIssue>&& issue) { - for(auto& it : issue) - { - d_ptr->log.log(it.code, it.text); - } + for (auto& it : issue) + { + d_ptr->log.log(it.code, it.text); + } } void RemoteEndPoint::handle(MessageIssue&& issue) { - d_ptr->log.log(issue.code, issue.text); + d_ptr->log.log(issue.code, issue.text); } - -void RemoteEndPoint::startProcessingMessages(std::shared_ptr<lsp::istream> r, - std::shared_ptr<lsp::ostream> w) +void RemoteEndPoint::startProcessingMessages(std::shared_ptr<lsp::istream> r, std::shared_ptr<lsp::ostream> w) { - d_ptr->quit.store(false, std::memory_order_relaxed); - d_ptr->input = r; - d_ptr->output = w; - d_ptr->message_producer->bind(r); + d_ptr->quit.store(false, std::memory_order_relaxed); + d_ptr->input = r; + d_ptr->output = w; + d_ptr->message_producer->bind(r); d_ptr->tp = std::make_shared<boost::asio::thread_pool>(d_ptr->max_workers); - message_producer_thread_ = std::make_shared<std::thread>([&]() - { - d_ptr->message_producer->listen([&](std::string&& content){ - const auto temp = std::make_shared<std::string>(std::move(content)); - boost::asio::post(*d_ptr->tp, - [this, temp]{ + message_producer_thread_ = std::make_shared<std::thread>( + [&]() + { + d_ptr->message_producer->listen( + [&](std::string&& content) + { + auto const temp = std::make_shared<std::string>(std::move(content)); + boost::asio::post( + *d_ptr->tp, + [this, temp] + { #ifdef LSPCPP_USEGC - GCThreadContext gcContext; + GCThreadContext gcContext; #endif - dispatch(*temp); - }); - }); - }); + dispatch(*temp); + } + ); + } + ); + } + ); } void RemoteEndPoint::stop() { - if(message_producer_thread_ && message_producer_thread_->joinable()) - { - message_producer_thread_->detach(); + if (message_producer_thread_ && message_producer_thread_->joinable()) + { + message_producer_thread_->detach(); message_producer_thread_ = nullptr; - } - d_ptr->clear(); - + } + d_ptr->clear(); } -void RemoteEndPoint::sendMsg( LspMessage& msg) +void RemoteEndPoint::sendMsg(LspMessage& msg) { - std::lock_guard<std::mutex> lock(m_sendMutex); - if (!d_ptr->output || d_ptr->output->bad()) - { - std::string info = "Output isn't good any more:\n"; - d_ptr->log.log(Log::Level::INFO, info); - return; - } - WriterMsg(d_ptr->output, msg); - + std::lock_guard<std::mutex> lock(m_sendMutex); + if (!d_ptr->output || d_ptr->output->bad()) + { + std::string info = "Output isn't good any more:\n"; + d_ptr->log.log(Log::Level::INFO, info); + return; + } + WriterMsg(d_ptr->output, msg); } -bool RemoteEndPoint::isWorking() const { +bool RemoteEndPoint::isWorking() const +{ if (message_producer_thread_ && message_producer_thread_->joinable()) + { return true; - return false; + } + return false; } diff --git a/graphics/asymptote/LspCpp/src/jsonrpc/StreamMessageProducer.cpp b/graphics/asymptote/LspCpp/src/jsonrpc/StreamMessageProducer.cpp index 695c35fe1d..731a5541d6 100644 --- a/graphics/asymptote/LspCpp/src/jsonrpc/StreamMessageProducer.cpp +++ b/graphics/asymptote/LspCpp/src/jsonrpc/StreamMessageProducer.cpp @@ -5,193 +5,207 @@ #include "LibLsp/JsonRpc/stream.h" #include "LibLsp/lsp/Markup/string_ref.h" - bool StartsWith(std::string value, std::string start); -bool StartsWith(std::string value, std::string start) { - if (start.size() > value.size()) - return false; - return std::equal(start.begin(), start.end(), value.begin()); +bool StartsWith(std::string value, std::string start) +{ + if (start.size() > value.size()) + { + return false; + } + return std::equal(start.begin(), start.end(), value.begin()); } -using namespace std; +using namespace std; namespace { - string JSONRPC_VERSION = "2.0"; - string CONTENT_LENGTH_HEADER = "Content-Length"; - string CONTENT_TYPE_HEADER = "Content-Type"; - string JSON_MIME_TYPE = "application/json"; - string CRLF = "\r\n"; - -} +string JSONRPC_VERSION = "2.0"; +string CONTENT_LENGTH_HEADER = "Content-Length"; +string CONTENT_TYPE_HEADER = "Content-Type"; +string JSON_MIME_TYPE = "application/json"; +string CRLF = "\r\n"; - void LSPStreamMessageProducer::parseHeader(std::string& line, LSPStreamMessageProducer::Headers& headers) - { - int sepIndex = line.find(':'); - if (sepIndex >= 0) { - auto key = line.substr(0, sepIndex); - if(key == CONTENT_LENGTH_HEADER) - { - headers.contentLength = atoi(line.substr(sepIndex + 1).data()); - } - else if(key == CONTENT_TYPE_HEADER) - { - int charsetIndex = line.find("charset="); - if (charsetIndex >= 0) - headers.charset = line.substr(charsetIndex + 8); - } - } - } +} // namespace +void LSPStreamMessageProducer::parseHeader(std::string& line, LSPStreamMessageProducer::Headers& headers) +{ + int sepIndex = line.find(':'); + if (sepIndex >= 0) + { + auto key = line.substr(0, sepIndex); + if (key == CONTENT_LENGTH_HEADER) + { + headers.contentLength = atoi(line.substr(sepIndex + 1).data()); + } + else if (key == CONTENT_TYPE_HEADER) + { + int charsetIndex = line.find("charset="); + if (charsetIndex >= 0) + { + headers.charset = line.substr(charsetIndex + 8); + } + } + } +} void LSPStreamMessageProducer::listen(MessageConsumer callBack) { - if(!input) - return; + if (!input) + { + return; + } - keepRunning = true; - bool newLine = false; - Headers headers; - string headerBuilder ; - string debugBuilder ; - // Read the content length. It is terminated by the "\r\n" sequence. - while (keepRunning) + keepRunning = true; + bool newLine = false; + Headers headers; + string headerBuilder; + string debugBuilder; + // Read the content length. It is terminated by the "\r\n" sequence. + while (keepRunning) + { + if (input->bad()) { - if(input->bad()) - { - std::string info = "Input stream is bad."; - auto what = input->what(); - if (what.size()) - { - info += "Reason:"; - info += input->what(); - } - MessageIssue issue(info, lsp::Log::Level::SEVERE); - issueHandler.handle(std::move(issue)); - return; - } - if(input->fail()) + std::string info = "Input stream is bad."; + auto what = input->what(); + if (what.size()) + { + info += "Reason:"; + info += input->what(); + } + MessageIssue issue(info, lsp::Log::Level::SEVERE); + issueHandler.handle(std::move(issue)); + return; + } + if (input->fail()) + { + std::string info = "Input fail."; + auto what = input->what(); + if (what.size()) + { + info += "Reason:"; + info += input->what(); + } + MessageIssue issue(info, lsp::Log::Level::WARNING); + issueHandler.handle(std::move(issue)); + if (input->need_to_clear_the_state()) + { + input->clear(); + } + else + { + return; + } + } + int c = input->get(); + if (c == EOF) + { + // End of input stream has been reached + keepRunning = false; + } + else + { + + debugBuilder.push_back((char)c); + if (c == '\n') + { + if (newLine) { - std::string info = "Input fail."; - auto what = input->what(); - if(what.size()) - { - info += "Reason:"; - info += input->what(); - } + // Two consecutive newlines have been read, which signals the start of the message content + if (headers.contentLength <= 0) + { + string info = "Unexpected token:" + debugBuilder; + info = +" (expected Content-Length: sequence);"; MessageIssue issue(info, lsp::Log::Level::WARNING); issueHandler.handle(std::move(issue)); - if(input->need_to_clear_the_state()) - input->clear(); - else - { - return; - } - } - int c = input->get(); - if (c == EOF) { - // End of input stream has been reached - keepRunning = false; - } - else - { - - debugBuilder.push_back((char)c); - if (c == '\n') + } + else { - if (newLine) { - // Two consecutive newlines have been read, which signals the start of the message content - if (headers.contentLength <= 0) - { - string info = "Unexpected token:" + debugBuilder; - info = +" (expected Content-Length: sequence);"; - MessageIssue issue(info, lsp::Log::Level::WARNING); - issueHandler.handle(std::move(issue)); - } - else { - bool result = handleMessage(headers,callBack); - if (!result) - keepRunning = false; - newLine = false; - } - headers.clear(); - debugBuilder.clear(); - } - else if (!headerBuilder.empty()) { - // A single newline ends a header line - parseHeader(headerBuilder, headers); - headerBuilder.clear(); + bool result = handleMessage(headers, callBack); + if (!result) + { + keepRunning = false; } - newLine = true; - } - else if (c != '\r') { - // Add the input to the current header line - - headerBuilder.push_back((char)c); newLine = false; } + headers.clear(); + debugBuilder.clear(); } - } + else if (!headerBuilder.empty()) + { + // A single newline ends a header line + parseHeader(headerBuilder, headers); + headerBuilder.clear(); + } + newLine = true; + } + else if (c != '\r') + { + // Add the input to the current header line + headerBuilder.push_back((char)c); + newLine = false; + } + } + } } -void LSPStreamMessageProducer::bind(std::shared_ptr<lsp::istream>_in) +void LSPStreamMessageProducer::bind(std::shared_ptr<lsp::istream> _in) { - input = _in; + input = _in; } -bool LSPStreamMessageProducer::handleMessage(Headers& headers ,MessageConsumer callBack) +bool LSPStreamMessageProducer::handleMessage(Headers& headers, MessageConsumer callBack) { - // Read content. - auto content_length = headers.contentLength; - std::string content(content_length,0); - auto data = &content[0]; - input->read(data, content_length); - if (input->bad()) - { - std::string info = "Input stream is bad."; - auto what = input->what(); - if (!what.empty()) - { - info += "Reason:"; - info += input->what(); - } - MessageIssue issue(info, lsp::Log::Level::SEVERE); - issueHandler.handle(std::move(issue)); - return false; - } + // Read content. + auto content_length = headers.contentLength; + std::string content(content_length, 0); + auto data = &content[0]; + input->read(data, content_length); + if (input->bad()) + { + std::string info = "Input stream is bad."; + auto what = input->what(); + if (!what.empty()) + { + info += "Reason:"; + info += input->what(); + } + MessageIssue issue(info, lsp::Log::Level::SEVERE); + issueHandler.handle(std::move(issue)); + return false; + } - if (input->eof()) - { - MessageIssue issue("No more input when reading content body", lsp::Log::Level::INFO); - issueHandler.handle(std::move(issue)); - return false; - } - if (input->fail()) - { - std::string info = "Input fail."; - auto what = input->what(); - if (!what.empty()) - { - info += "Reason:"; - info += input->what(); - } - MessageIssue issue(info, lsp::Log::Level::WARNING); - issueHandler.handle(std::move(issue)); - if (input->need_to_clear_the_state()) - input->clear(); - else - { - return false; - } - } + if (input->eof()) + { + MessageIssue issue("No more input when reading content body", lsp::Log::Level::INFO); + issueHandler.handle(std::move(issue)); + return false; + } + if (input->fail()) + { + std::string info = "Input fail."; + auto what = input->what(); + if (!what.empty()) + { + info += "Reason:"; + info += input->what(); + } + MessageIssue issue(info, lsp::Log::Level::WARNING); + issueHandler.handle(std::move(issue)); + if (input->need_to_clear_the_state()) + { + input->clear(); + } + else + { + return false; + } + } - callBack(std::move(content)); + callBack(std::move(content)); - return true; + return true; } - - /// For lit tests we support a simplified syntax: /// - messages are delimited by '// -----' on a line by itself /// - lines starting with // are ignored. @@ -199,15 +213,18 @@ bool LSPStreamMessageProducer::handleMessage(Headers& headers ,MessageConsumer c void DelimitedStreamMessageProducer::listen(MessageConsumer callBack) { - if(!input) + if (!input) + { return; + } keepRunning = true; - auto readLine = [&]( std::string_ref& lineBuilder) -> bool { + auto readLine = [&](std::string_ref& lineBuilder) -> bool + { while (keepRunning) { - if(input->bad()) + if (input->bad()) { std::string info = "Input stream is bad."; auto what = input->what(); @@ -220,26 +237,29 @@ void DelimitedStreamMessageProducer::listen(MessageConsumer callBack) issueHandler.handle(std::move(issue)); return false; } - if(input->fail()) + if (input->fail()) { std::string info = "Input fail."; auto what = input->what(); - if(what.size()) + if (what.size()) { info += "Reason:"; info += input->what(); } MessageIssue issue(info, lsp::Log::Level::WARNING); issueHandler.handle(std::move(issue)); - if(input->need_to_clear_the_state()) + if (input->need_to_clear_the_state()) + { input->clear(); + } else { return false; } } int c = input->get(); - if (c == EOF) { + if (c == EOF) + { // End of input stream has been reached keepRunning = false; } @@ -247,12 +267,14 @@ void DelimitedStreamMessageProducer::listen(MessageConsumer callBack) { if (c == '\n') { - if(!lineBuilder.empty()){ - lineBuilder.push_back(c); + if (!lineBuilder.empty()) + { + lineBuilder.push_back(static_cast<char>(c)); return true; } } - else if (c != '\r') { + else if (c != '\r') + { // Add the input to the current header line lineBuilder.push_back((char)c); @@ -262,15 +284,18 @@ void DelimitedStreamMessageProducer::listen(MessageConsumer callBack) return false; }; - auto getMessage = [&](std::string& json) -> bool { - std::string_ref lineBuilder ; - while (readLine(lineBuilder)){ + auto getMessage = [&](std::string& json) -> bool + { + std::string_ref lineBuilder; + while (readLine(lineBuilder)) + { lineBuilder.trim(); - if(lineBuilder.start_with("//")){ + if (lineBuilder.start_with("//")) + { // Found a delimiter for the message. if (lineBuilder == "// -----") { - return true; + return true; } } json += lineBuilder; @@ -278,20 +303,21 @@ void DelimitedStreamMessageProducer::listen(MessageConsumer callBack) return false; }; - - while (true) { + while (true) + { std::string json; - if (getMessage(json)) { + if (getMessage(json)) + { callBack(std::move(json)); - }else{ - return ; + } + else + { + return; } } } -void DelimitedStreamMessageProducer::bind(std::shared_ptr<lsp::istream>_in) +void DelimitedStreamMessageProducer::bind(std::shared_ptr<lsp::istream> _in) { input = _in; } - - diff --git a/graphics/asymptote/LspCpp/src/jsonrpc/TcpServer.cpp b/graphics/asymptote/LspCpp/src/jsonrpc/TcpServer.cpp index 4b3a9aea35..6d2a097901 100644 --- a/graphics/asymptote/LspCpp/src/jsonrpc/TcpServer.cpp +++ b/graphics/asymptote/LspCpp/src/jsonrpc/TcpServer.cpp @@ -9,111 +9,110 @@ #include "LibLsp/JsonRpc/MessageIssue.h" #include "LibLsp/JsonRpc/stream.h" +namespace lsp +{ +struct tcp_connect_session; + +class tcp_stream_wrapper : public istream, public ostream +{ +public: + tcp_stream_wrapper(tcp_connect_session& _w); + + tcp_connect_session& session; + std::atomic<bool> quit {}; + std::shared_ptr<MultiQueueWaiter> request_waiter; + ThreadedQueue<char> on_request; + std::string error_message; + + bool fail() override + { + return bad(); + } -namespace lsp { - struct tcp_connect_session; - - - class tcp_stream_wrapper :public istream, public ostream - { - public: - tcp_stream_wrapper(tcp_connect_session& _w); - - tcp_connect_session& session; - std::atomic<bool> quit{}; - std::shared_ptr < MultiQueueWaiter> request_waiter; - ThreadedQueue< char > on_request; - std::string error_message; - - - bool fail() override - { - return bad(); - } - - - - bool eof() override - { - return bad(); - } - bool good() override - { - return !bad(); - } - tcp_stream_wrapper& read(char* str, std::streamsize count) - override - { - auto some = on_request.TryDequeueSome(static_cast<size_t>( count )); - memcpy(str,some.data(),some.size()); - for (std::streamsize i = some.size(); i < count; ++i) - { - str[i] = static_cast<char>(get()); - } - - return *this; - } - int get() override - { - return on_request.Dequeue(); - } + bool eof() override + { + return bad(); + } + bool good() override + { + return !bad(); + } + tcp_stream_wrapper& read(char* str, std::streamsize count) override + { + auto some = on_request.TryDequeueSome(static_cast<size_t>(count)); + memcpy(str, some.data(), some.size()); + for (std::streamsize i = some.size(); i < count; ++i) + { + str[i] = static_cast<char>(get()); + } - bool bad() override; + return *this; + } + int get() override + { + return on_request.Dequeue(); + } - tcp_stream_wrapper& write(const std::string& c) override; + bool bad() override; - tcp_stream_wrapper& write(std::streamsize _s) override; + tcp_stream_wrapper& write(std::string const& c) override; - tcp_stream_wrapper& flush() override - { - return *this; - } - void reset_state() - { - return; - } + tcp_stream_wrapper& write(std::streamsize _s) override; - void clear() override - { + tcp_stream_wrapper& flush() override + { + return *this; + } + void reset_state() + { + return; + } - } + void clear() override + { + } - std::string what() override; - bool need_to_clear_the_state() override - { - return false; - } - }; - struct tcp_connect_session:std::enable_shared_from_this<tcp_connect_session> - { - /// Buffer for incoming data. - std::array<unsigned char, 8192> buffer_; - boost::asio::ip::tcp::socket socket_; - /// Strand to ensure the connection's handlers are not called concurrently. - boost::asio::io_context::strand strand_; - std::shared_ptr<tcp_stream_wrapper> proxy_; - explicit tcp_connect_session(boost::asio::io_context& io_context, boost::asio::ip::tcp::socket&& _socket) - : socket_(std::move(_socket)), strand_(io_context), proxy_(new tcp_stream_wrapper(*this)) - { - do_read(); - } - void do_write(const char* data, size_t size) - { - socket_.async_write_some(boost::asio::buffer(data, size), - boost::asio::bind_executor(strand_,[this](boost::system::error_code ec, std::size_t n) - { - if (!ec) - { - return; - } - proxy_->error_message = ec.message(); - - })); - } - void do_read() - { - socket_.async_read_some(boost::asio::buffer(buffer_), - boost::asio::bind_executor(strand_, + std::string what() override; + bool need_to_clear_the_state() override + { + return false; + } +}; +struct tcp_connect_session : std::enable_shared_from_this<tcp_connect_session> +{ + /// Buffer for incoming data. + std::array<unsigned char, 8192> buffer_; + boost::asio::ip::tcp::socket socket_; + /// Strand to ensure the connection's handlers are not called concurrently. + boost::asio::io_context::strand strand_; + std::shared_ptr<tcp_stream_wrapper> proxy_; + explicit tcp_connect_session(boost::asio::io_context& io_context, boost::asio::ip::tcp::socket&& _socket) + : socket_(std::move(_socket)), strand_(io_context), proxy_(new tcp_stream_wrapper(*this)) + { + do_read(); + } + void do_write(char const* data, size_t size) + { + socket_.async_write_some( + boost::asio::buffer(data, size), boost::asio::bind_executor( + strand_, + [this](boost::system::error_code ec, std::size_t) + { + if (!ec) + { + return; + } + proxy_->error_message = ec.message(); + } + ) + ); + } + void do_read() + { + socket_.async_read_some( + boost::asio::buffer(buffer_), + boost::asio::bind_executor( + strand_, [this](boost::system::error_code ec, size_t bytes_transferred) { if (!ec) @@ -124,183 +123,189 @@ namespace lsp { return; } proxy_->error_message = ec.message(); + } + ) + ); + } +}; - })); - } - }; +tcp_stream_wrapper::tcp_stream_wrapper(tcp_connect_session& _w) : session(_w) +{ +} - tcp_stream_wrapper::tcp_stream_wrapper(tcp_connect_session& _w): session(_w) - { - } +bool tcp_stream_wrapper::bad() +{ + return !session.socket_.is_open(); +} - bool tcp_stream_wrapper::bad() +tcp_stream_wrapper& tcp_stream_wrapper::write(std::string const& c) +{ + size_t off = 0; + for (; off < c.size();) { - return !session.socket_.is_open(); - } - - tcp_stream_wrapper& tcp_stream_wrapper::write(const std::string& c) + if (off + 1024 < c.size()) { - size_t off = 0; - for(;off < c.size();){ - if(off + 1024 < c.size()){ - session.do_write(c.data()+off,1024); - off += 1024; - }else{ - session.do_write(c.data()+off,c.size() - off); - break; - } - } - return *this; + session.do_write(c.data() + off, 1024); + off += 1024; } - - tcp_stream_wrapper& tcp_stream_wrapper::write(std::streamsize _s) + else + { + session.do_write(c.data() + off, c.size() - off); + break; + } + } + return *this; +} + +tcp_stream_wrapper& tcp_stream_wrapper::write(std::streamsize _s) +{ + auto s = std::to_string(_s); + session.do_write(s.data(), s.size()); + return *this; +} + +std::string tcp_stream_wrapper::what() +{ + if (error_message.size()) { - auto s = std::to_string(_s); - session.do_write(s.data(),s.size()); - return *this; + return error_message; } - std::string tcp_stream_wrapper::what() - { - if (error_message.size()) - return error_message; - - if(! session.socket_.is_open()) - { - return "Socket is not open."; - } - return {}; - } + if (!session.socket_.is_open()) + { + return "Socket is not open."; + } + return {}; +} - struct TcpServer::Data +struct TcpServer::Data +{ + Data(lsp::Log& log, uint32_t) : acceptor_(io_context_), _log(log) { - Data( - lsp::Log& log, uint32_t _max_workers) : - acceptor_(io_context_), _log(log) - { - } + } - ~Data() - { + ~Data() + { + } + /// The io_context used to perform asynchronous operations. + boost::asio::io_context io_context_; - } - /// The io_context used to perform asynchronous operations. - boost::asio::io_context io_context_; + std::shared_ptr<boost::asio::io_context::work> work; - std::shared_ptr<boost::asio::io_service::work> work; + std::shared_ptr<tcp_connect_session> _connect_session; + /// Acceptor used to listen for incoming connections. + boost::asio::ip::tcp::acceptor acceptor_; - std::shared_ptr<tcp_connect_session> _connect_session; - /// Acceptor used to listen for incoming connections. - boost::asio::ip::tcp::acceptor acceptor_; + lsp::Log& _log; +}; - lsp::Log& _log; +TcpServer::~TcpServer() +{ + delete d_ptr; +} - }; +TcpServer::TcpServer( + std::string const& address, std::string const& port, std::shared_ptr<MessageJsonHandler> json_handler, + std::shared_ptr<Endpoint> localEndPoint, lsp::Log& log, uint32_t _max_workers +) + : point(json_handler, localEndPoint, log, lsp::JSONStreamStyle::Standard, static_cast<uint8_t>(_max_workers)), + d_ptr(new Data(log, _max_workers)) - TcpServer::~TcpServer() - { - delete d_ptr; - } +{ - TcpServer::TcpServer(const std::string& address, const std::string& port, - std::shared_ptr < MessageJsonHandler> json_handler, - std::shared_ptr < Endpoint> localEndPoint, lsp::Log& log, uint32_t _max_workers) - : point(json_handler, localEndPoint, log,lsp::JSONStreamStyle::Standard, _max_workers),d_ptr(new Data( log, _max_workers)) + d_ptr->work = std::make_shared<boost::asio::io_context::work>(d_ptr->io_context_); + // Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR). + boost::asio::ip::tcp::resolver resolver(d_ptr->io_context_); + boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(address, port).begin(); + d_ptr->acceptor_.open(endpoint.protocol()); + d_ptr->acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); + try + { + d_ptr->acceptor_.bind(endpoint); + } + catch (boost::system::system_error& e) + { + std::string temp = "Socket Server bind failed."; + d_ptr->_log.log(lsp::Log::Level::INFO, temp + e.what()); + return; + } + d_ptr->acceptor_.listen(); + + do_accept(); + std::string desc = "Socket TcpServer " + address + " " + port + " start."; + d_ptr->_log.log(lsp::Log::Level::INFO, desc); +} + +void TcpServer::run() +{ + // The io_context::run() call will block until all asynchronous operations + // have finished. While the TcpServer is running, there is always at least one + // asynchronous operation outstanding: the asynchronous accept call waiting + // for new incoming connections. + d_ptr->io_context_.run(); +} + +void TcpServer::stop() +{ + try + { + if (d_ptr->work) { - - d_ptr->work = std::make_shared<boost::asio::io_service::work>(d_ptr->io_context_); - - // Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR). - boost::asio::ip::tcp::resolver resolver(d_ptr->io_context_); - boost::asio::ip::tcp::endpoint endpoint = - *resolver.resolve(address, port).begin(); - d_ptr->acceptor_.open(endpoint.protocol()); - d_ptr->acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); - try - { - d_ptr->acceptor_.bind(endpoint); - } - catch (boost::system::system_error & e) - { - std::string temp = "Socket Server bind failed."; - d_ptr->_log.log(lsp::Log::Level::INFO , temp + e.what()); - return; - } - d_ptr->acceptor_.listen(); - - do_accept(); - std::string desc = "Socket TcpServer " + address + " " + port + " start."; - d_ptr->_log.log(lsp::Log::Level::INFO, desc); + d_ptr->work.reset(); } - void TcpServer::run() - { - // The io_context::run() call will block until all asynchronous operations - // have finished. While the TcpServer is running, there is always at least one - // asynchronous operation outstanding: the asynchronous accept call waiting - // for new incoming connections. - d_ptr->io_context_.run(); - - } + do_stop(); + } + catch (...) + { + } +} - void TcpServer::stop() +void TcpServer::do_accept() +{ + d_ptr->acceptor_.async_accept( + [this](boost::system::error_code ec, boost::asio::ip::tcp::socket socket) { - try - { - if(d_ptr->work) - d_ptr->work.reset(); - - do_stop(); - } - catch (...) + // Check whether the TcpServer was stopped by a signal before this + // completion handler had a chance to run. + if (!d_ptr->acceptor_.is_open()) { + return; } - } - void TcpServer::do_accept() - { - d_ptr->acceptor_.async_accept( - [this](boost::system::error_code ec, boost::asio::ip::tcp::socket socket) + if (!ec) + { + if (d_ptr->_connect_session) { - // Check whether the TcpServer was stopped by a signal before this - // completion handler had a chance to run. - if (!d_ptr->acceptor_.is_open()) - { - return; - } - - if (!ec) + if (d_ptr->_connect_session->socket_.is_open()) { - if(d_ptr->_connect_session) - { - if(d_ptr->_connect_session->socket_.is_open()) - { - std::string desc = "Disconnect previous client " + d_ptr->_connect_session->socket_.local_endpoint().address().to_string(); - d_ptr->_log.log(lsp::Log::Level::INFO, desc); - d_ptr->_connect_session->socket_.close(); - } - - point.stop(); - } - auto local_point = socket.local_endpoint(); - - std::string desc = ("New client " + local_point.address().to_string() + " connect."); + std::string desc = "Disconnect previous client " + + d_ptr->_connect_session->socket_.local_endpoint().address().to_string(); d_ptr->_log.log(lsp::Log::Level::INFO, desc); - d_ptr->_connect_session = std::make_shared<tcp_connect_session>(d_ptr->io_context_,std::move(socket)); - - point.startProcessingMessages(d_ptr->_connect_session->proxy_, d_ptr->_connect_session->proxy_); - do_accept(); + d_ptr->_connect_session->socket_.close(); } - }); - } - void TcpServer::do_stop() - { - d_ptr->acceptor_.close(); + point.stop(); + } + auto local_point = socket.local_endpoint(); - point.stop(); + std::string desc = ("New client " + local_point.address().to_string() + " connect."); + d_ptr->_log.log(lsp::Log::Level::INFO, desc); + d_ptr->_connect_session = std::make_shared<tcp_connect_session>(d_ptr->io_context_, std::move(socket)); + point.startProcessingMessages(d_ptr->_connect_session->proxy_, d_ptr->_connect_session->proxy_); + do_accept(); + } } + ); +} + +void TcpServer::do_stop() +{ + d_ptr->acceptor_.close(); + + point.stop(); +} - } // namespace +} // namespace lsp diff --git a/graphics/asymptote/LspCpp/src/jsonrpc/WebSocketServer.cpp b/graphics/asymptote/LspCpp/src/jsonrpc/WebSocketServer.cpp index 92a25e88db..4ea92d6876 100644 --- a/graphics/asymptote/LspCpp/src/jsonrpc/WebSocketServer.cpp +++ b/graphics/asymptote/LspCpp/src/jsonrpc/WebSocketServer.cpp @@ -7,331 +7,304 @@ #include <boost/beast/core.hpp> #include <boost/beast/websocket.hpp> #include <boost/asio/dispatch.hpp> -namespace beast = boost::beast; // from <boost/beast.hpp> -namespace http = beast::http; // from <boost/beast/http.hpp> +namespace beast = boost::beast; // from <boost/beast.hpp> +namespace http = beast::http; // from <boost/beast/http.hpp> namespace websocket = beast::websocket; // from <boost/beast/websocket.hpp> -namespace net = boost::asio; // from <boost/asio.hpp> -using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp> -namespace lsp { +namespace net = boost::asio; // from <boost/asio.hpp> +using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp> +namespace lsp +{ + +// Echoes back all received WebSocket messages +class server_session : public std::enable_shared_from_this<server_session> +{ + websocket::stream<beast::tcp_stream> ws_; + + beast::flat_buffer buffer_; + std::string user_agent_; + +public: + std::shared_ptr<websocket_stream_wrapper> proxy_; + // Take ownership of the socket + explicit server_session(tcp::socket&& socket, std::string const& user_agent) + : ws_(std::move(socket)), user_agent_(user_agent) + { + proxy_ = std::make_shared<websocket_stream_wrapper>(ws_); + } - // Echoes back all received WebSocket messages - class server_session : public std::enable_shared_from_this<server_session> + // Get on the correct executor + void run() { - websocket::stream<beast::tcp_stream> ws_; - - beast::flat_buffer buffer_; - std::string user_agent_; - public: - std::shared_ptr<websocket_stream_wrapper> proxy_; - // Take ownership of the socket - explicit - server_session(tcp::socket&& socket,const std::string& user_agent) - : ws_(std::move(socket)),user_agent_(user_agent) - { - proxy_ = std::make_shared<websocket_stream_wrapper>(ws_); - } + // We need to be executing within a strand to perform async operations + // on the I/O objects in this server_session. Although not strictly necessary + // for single-threaded contexts, this example code is written to be + // thread-safe by default. + net::dispatch(ws_.get_executor(), beast::bind_front_handler(&server_session::on_run, shared_from_this())); + } - // Get on the correct executor - void - run() - { - // We need to be executing within a strand to perform async operations - // on the I/O objects in this server_session. Although not strictly necessary - // for single-threaded contexts, this example code is written to be - // thread-safe by default. - net::dispatch(ws_.get_executor(), - beast::bind_front_handler( - &server_session::on_run, - shared_from_this())); - } + // Start the asynchronous operation + void on_run() + { + // Set suggested timeout settings for the websocket + ws_.set_option(websocket::stream_base::timeout::suggested(beast::role_type::server)); + + // Set a decorator to change the Server of the handshake + ws_.set_option(websocket::stream_base::decorator([=](websocket::response_type& res) + { res.set(http::field::server, user_agent_.c_str()); })); + // Accept the websocket handshake + ws_.async_accept(beast::bind_front_handler(&server_session::on_accept, shared_from_this())); + } - // Start the asynchronous operation - void - on_run() + void on_accept(beast::error_code ec) + { + if (ec) { - // Set suggested timeout settings for the websocket - ws_.set_option( - websocket::stream_base::timeout::suggested( - beast::role_type::server)); - - // Set a decorator to change the Server of the handshake - ws_.set_option(websocket::stream_base::decorator( - [=](websocket::response_type& res) - { - res.set(http::field::server, user_agent_.c_str()); - })); - // Accept the websocket handshake - ws_.async_accept( - beast::bind_front_handler( - &server_session::on_accept, - shared_from_this())); + return; } - void - on_accept(beast::error_code ec) - { - if (ec) - return ; + // Read a message + // Read a message into our buffer + ws_.async_read(buffer_, beast::bind_front_handler(&server_session::on_read, shared_from_this())); + } - // Read a message - // Read a message into our buffer - ws_.async_read( - buffer_, - beast::bind_front_handler( - &server_session::on_read, - shared_from_this())); - } + void on_read(beast::error_code ec, std::size_t bytes_transferred) + { + if (!ec) + { + char* data = reinterpret_cast<char*>(buffer_.data().data()); + std::vector<char> elements(data, data + bytes_transferred); + buffer_.clear(); + proxy_->on_request.EnqueueAll(std::move(elements), false); - void - on_read( - beast::error_code ec, - std::size_t bytes_transferred) + // Read a message into our buffer + ws_.async_read(buffer_, beast::bind_front_handler(&server_session::on_read, shared_from_this())); + return; + } + if (ec) { - - if(!ec) - { - char* data = reinterpret_cast<char*>(buffer_.data().data()); - std::vector<char> elements(data, data + bytes_transferred); - - buffer_.clear(); - proxy_->on_request.EnqueueAll(std::move(elements), false); - - // Read a message into our buffer - ws_.async_read( - buffer_, - beast::bind_front_handler( - &server_session::on_read, - shared_from_this())); - return; - } - if (ec){ - proxy_->error_message = ec.message(); - } + proxy_->error_message = ec.message(); } + } - - - void close() + void close() + { + if (ws_.is_open()) { - if(ws_.is_open()) - { - boost::system::error_code ec; - ws_.close(websocket::close_code::normal, ec); - } - + boost::system::error_code ec; + ws_.close(websocket::close_code::normal, ec); } - }; - - //------------------------------------------------------------------------------ + } +}; - struct WebSocketServer::Data - { - Data(const std::string& user_agent, lsp::Log& log) : - acceptor_(io_context_), user_agent_(user_agent), _log(log) +//------------------------------------------------------------------------------ - { - } +struct WebSocketServer::Data +{ + Data(std::string const& user_agent, lsp::Log& log) : acceptor_(io_context_), user_agent_(user_agent), _log(log) - ~Data() - { - - } - /// The io_context used to perform asynchronous operations. - boost::asio::io_context io_context_; + { + } - std::shared_ptr<boost::asio::io_service::work> work; + ~Data() + { + } + /// The io_context used to perform asynchronous operations. + boost::asio::io_context io_context_; - /// Acceptor used to listen for incoming connections. - boost::asio::ip::tcp::acceptor acceptor_; + std::shared_ptr<boost::asio::io_context::work> work; - std::shared_ptr < server_session> _server_session; + /// Acceptor used to listen for incoming connections. + boost::asio::ip::tcp::acceptor acceptor_; - std::string user_agent_; - lsp::Log& _log; + std::shared_ptr<server_session> _server_session; - }; + std::string user_agent_; + lsp::Log& _log; +}; - websocket_stream_wrapper::websocket_stream_wrapper(boost::beast::websocket::stream<boost::beast::tcp_stream>& _w): - ws_(_w), request_waiter(new MultiQueueWaiter()), - on_request(request_waiter) - { - } +websocket_stream_wrapper::websocket_stream_wrapper(boost::beast::websocket::stream<boost::beast::tcp_stream>& _w) + : ws_(_w), request_waiter(new MultiQueueWaiter()), on_request(request_waiter) +{ +} - bool websocket_stream_wrapper::fail() - { - return bad(); - } +bool websocket_stream_wrapper::fail() +{ + return bad(); +} - bool websocket_stream_wrapper::eof() - { - return bad(); - } +bool websocket_stream_wrapper::eof() +{ + return bad(); +} - bool websocket_stream_wrapper::good() - { - return !bad(); - } +bool websocket_stream_wrapper::good() +{ + return !bad(); +} - websocket_stream_wrapper& websocket_stream_wrapper::read(char* str, std::streamsize count) +websocket_stream_wrapper& websocket_stream_wrapper::read(char* str, std::streamsize count) +{ + auto some = on_request.TryDequeueSome(static_cast<size_t>(count)); + memcpy(str, some.data(), some.size()); + for (std::streamsize i = some.size(); i < count; ++i) { - auto some = on_request.TryDequeueSome(static_cast<size_t>(count)); - memcpy(str,some.data(),some.size()); - for (std::streamsize i = some.size(); i < count; ++i) - { - str[i] = static_cast<char>(get()); - } - return *this; + str[i] = static_cast<char>(get()); } - - int websocket_stream_wrapper::get() + return *this; +} + +int websocket_stream_wrapper::get() +{ + return on_request.Dequeue(); +} + +bool websocket_stream_wrapper::bad() +{ + return !ws_.next_layer().socket().is_open(); +} + +websocket_stream_wrapper& websocket_stream_wrapper::write(std::string const& c) +{ + ws_.write(boost::asio::buffer(std::string(c))); + return *this; +} + +websocket_stream_wrapper& websocket_stream_wrapper::write(std::streamsize _s) +{ + std::ostringstream temp; + temp << _s; + ws_.write(boost::asio::buffer(temp.str())); + return *this; +} + +websocket_stream_wrapper& websocket_stream_wrapper::flush() +{ + return *this; +} + +void websocket_stream_wrapper::clear() +{ +} + +std::string websocket_stream_wrapper::what() +{ + if (!error_message.empty()) { - return on_request.Dequeue(); + return error_message; } - bool websocket_stream_wrapper::bad() + if (!ws_.next_layer().socket().is_open()) { - return !ws_.next_layer().socket().is_open(); + return "Socket is not open."; } - - websocket_stream_wrapper& websocket_stream_wrapper::write(const std::string& c) + return {}; +} + +WebSocketServer::~WebSocketServer() +{ + delete d_ptr; +} + +WebSocketServer::WebSocketServer( + std::string const& user_agent, std::string const& address, std::string const& port, + std::shared_ptr<MessageJsonHandler> json_handler, std::shared_ptr<Endpoint> localEndPoint, lsp::Log& log, + uint32_t _max_workers +) + : point(json_handler, localEndPoint, log, lsp::JSONStreamStyle::Standard, static_cast<uint8_t>(_max_workers)), + d_ptr(new Data(user_agent, log)) + +{ + + d_ptr->work = std::make_shared<boost::asio::io_context::work>(d_ptr->io_context_); + + // Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR). + boost::asio::ip::tcp::resolver resolver(d_ptr->io_context_); + boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(address, port).begin(); + d_ptr->acceptor_.open(endpoint.protocol()); + d_ptr->acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); + try { - ws_.write(boost::asio::buffer(std::string(c))); - return *this; + d_ptr->acceptor_.bind(endpoint); } - - - websocket_stream_wrapper& websocket_stream_wrapper::write(std::streamsize _s) + catch (boost::system::system_error& e) { - std::ostringstream temp; - temp << _s; - ws_.write(boost::asio::buffer(temp.str())); - return *this; + std::string temp = "Socket Server blid faild."; + d_ptr->_log.log(lsp::Log::Level::INFO, temp + e.what()); + return; } - - websocket_stream_wrapper& websocket_stream_wrapper::flush() + d_ptr->acceptor_.listen(); + + do_accept(); + std::string desc = "Socket WebSocketServer " + address + " " + port + " start."; + d_ptr->_log.log(lsp::Log::Level::INFO, desc); +} + +void WebSocketServer::run() +{ + // The io_context::run() call will block until all asynchronous operations + // have finished. While the WebSocketServer is running, there is always at least one + // asynchronous operation outstanding: the asynchronous accept call waiting + // for new incoming connections. + d_ptr->io_context_.run(); +} + +void WebSocketServer::stop() +{ + try { - return *this; - } + if (d_ptr->work) + { + d_ptr->work.reset(); + } - void websocket_stream_wrapper::clear() - { + do_stop(); } - - std::string websocket_stream_wrapper::what() + catch (...) { - if (!error_message.empty()) - return error_message; - - if (!ws_.next_layer().socket().is_open()) - { - return "Socket is not open."; - } - return {}; } +} - WebSocketServer::~WebSocketServer() - { - delete d_ptr; - } - - WebSocketServer::WebSocketServer(const std::string& user_agent, const std::string& address, const std::string& port, - std::shared_ptr < MessageJsonHandler> json_handler, - std::shared_ptr < Endpoint> localEndPoint, lsp::Log& log, uint32_t _max_workers) - : point(json_handler,localEndPoint,log,lsp::JSONStreamStyle::Standard, _max_workers),d_ptr(new Data(user_agent,log)) - +void WebSocketServer::do_accept() +{ + d_ptr->acceptor_.async_accept( + [this](boost::system::error_code ec, boost::asio::ip::tcp::socket socket) { - - d_ptr->work = std::make_shared<boost::asio::io_service::work>(d_ptr->io_context_); - - // Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR). - boost::asio::ip::tcp::resolver resolver(d_ptr->io_context_); - boost::asio::ip::tcp::endpoint endpoint = - *resolver.resolve(address, port).begin(); - d_ptr->acceptor_.open(endpoint.protocol()); - d_ptr->acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); - try - { - d_ptr->acceptor_.bind(endpoint); - } - catch (boost::system::system_error & e) + // Check whether the WebSocketServer was stopped by a signal before this + // completion handler had a chance to run. + if (!d_ptr->acceptor_.is_open()) { - std::string temp = "Socket Server blid faild."; - d_ptr->_log.log(lsp::Log::Level::INFO , temp + e.what()); return; } - d_ptr->acceptor_.listen(); - - do_accept(); - std::string desc = "Socket WebSocketServer " + address + " " + port + " start."; - d_ptr->_log.log(lsp::Log::Level::INFO, desc); - } - - void WebSocketServer::run() - { - // The io_context::run() call will block until all asynchronous operations - // have finished. While the WebSocketServer is running, there is always at least one - // asynchronous operation outstanding: the asynchronous accept call waiting - // for new incoming connections. - d_ptr->io_context_.run(); - - } - - void WebSocketServer::stop() - { - try + if (!ec) { - if(d_ptr->work) - d_ptr->work.reset(); - - do_stop(); - } - catch (...) - { - } - } - - void WebSocketServer::do_accept() - { - d_ptr->acceptor_.async_accept( - [this](boost::system::error_code ec, boost::asio::ip::tcp::socket socket) + if (d_ptr->_server_session) { - // Check whether the WebSocketServer was stopped by a signal before this - // completion handler had a chance to run. - if (!d_ptr->acceptor_.is_open()) + try { - return; + d_ptr->_server_session->close(); + point.stop(); } - if (!ec) + catch (...) { - if(d_ptr->_server_session) - { - try - { - d_ptr->_server_session->close(); - point.stop(); - } - catch (...) - { - } - } - d_ptr->_server_session = std::make_shared<server_session>(std::move(socket), d_ptr->user_agent_); - d_ptr->_server_session->run(); - - point.startProcessingMessages(d_ptr->_server_session->proxy_, d_ptr->_server_session->proxy_); - do_accept(); } + } + d_ptr->_server_session = std::make_shared<server_session>(std::move(socket), d_ptr->user_agent_); + d_ptr->_server_session->run(); - }); + point.startProcessingMessages(d_ptr->_server_session->proxy_, d_ptr->_server_session->proxy_); + do_accept(); + } } + ); +} - void WebSocketServer::do_stop() - { - d_ptr->acceptor_.close(); +void WebSocketServer::do_stop() +{ + d_ptr->acceptor_.close(); - point.stop(); - - } + point.stop(); +} - } // namespace +} // namespace lsp diff --git a/graphics/asymptote/LspCpp/src/jsonrpc/message.cpp b/graphics/asymptote/LspCpp/src/jsonrpc/message.cpp index a9e7736cd7..da04e8d10d 100644 --- a/graphics/asymptote/LspCpp/src/jsonrpc/message.cpp +++ b/graphics/asymptote/LspCpp/src/jsonrpc/message.cpp @@ -7,82 +7,92 @@ #include "LibLsp/JsonRpc/Condition.h" #include "LibLsp/JsonRpc/json.h" -void LspMessage::Write(std::ostream& out) { - rapidjson::StringBuffer output; - rapidjson::Writer<rapidjson::StringBuffer> writer(output); - JsonWriter json_writer{ &writer }; - ReflectWriter(json_writer); +void LspMessage::Write(std::ostream& out) +{ + rapidjson::StringBuffer output; + rapidjson::Writer<rapidjson::StringBuffer> writer(output); + JsonWriter json_writer {&writer}; + ReflectWriter(json_writer); - const auto value = std::string("Content-Length: ") + std::to_string(output.GetSize()) + "\r\n\r\n" + output.GetString(); - out << value; - out.flush(); + auto const value = + std::string("Content-Length: ") + std::to_string(output.GetSize()) + "\r\n\r\n" + output.GetString(); + out << value; + out.flush(); } -std::string LspMessage::ToJson() { - rapidjson::StringBuffer output; - rapidjson::Writer<rapidjson::StringBuffer> writer(output); - JsonWriter json_writer{ &writer }; - this->ReflectWriter(json_writer); - return output.GetString(); +std::string LspMessage::ToJson() +{ + rapidjson::StringBuffer output; + rapidjson::Writer<rapidjson::StringBuffer> writer(output); + JsonWriter json_writer {&writer}; + this->ReflectWriter(json_writer); + return output.GetString(); } -void Reflect(Reader& visitor, lsRequestId& value) { - if (visitor.IsInt()) { - value.type = lsRequestId::kInt; - value.value = visitor.GetInt(); - } - else if (visitor.IsInt64()) { - value.type = lsRequestId::kInt; - // `lsRequestId.value` is an `int`, so we're forced to truncate. - value.value = static_cast<int>(visitor.GetInt64()); - } - else if (visitor.IsString()) { - value.type = lsRequestId::kString; - value.k_string = visitor.GetString(); - value.value = atoi(value.k_string.c_str()); - - } - else { - value.type = lsRequestId::kNone; - value.value = -1; - } +void Reflect(Reader& visitor, lsRequestId& value) +{ + if (visitor.IsInt()) + { + value.type = lsRequestId::kInt; + value.value = visitor.GetInt(); + } + else if (visitor.IsInt64()) + { + value.type = lsRequestId::kInt; + // `lsRequestId.value` is an `int`, so we're forced to truncate. + value.value = static_cast<int>(visitor.GetInt64()); + } + else if (visitor.IsString()) + { + value.type = lsRequestId::kString; + value.k_string = visitor.GetString(); + value.value = atoi(value.k_string.c_str()); + } + else + { + value.type = lsRequestId::kNone; + value.value = -1; + } } -void Reflect(Writer& visitor, lsRequestId& value) { - switch (value.type) { - case lsRequestId::kNone: - visitor.Null(); - break; - case lsRequestId::kInt: - visitor.Int(value.value); - break; - case lsRequestId::kString: +void Reflect(Writer& visitor, lsRequestId& value) +{ + switch (value.type) + { + case lsRequestId::kNone: + visitor.Null(); + break; + case lsRequestId::kInt: + visitor.Int(value.value); + break; + case lsRequestId::kString: - if(value.k_string.empty()) - { - std::string str = std::to_string(value.value); - visitor.String(str.c_str(), str.length()); - } - else - { - visitor.String(value.k_string.c_str(), value.k_string.length()); - } - break; + if (value.k_string.empty()) + { + std::string str = std::to_string(value.value); + visitor.String(str.c_str(), str.length()); + } + else + { + visitor.String(value.k_string.c_str(), value.k_string.length()); } + break; + } } -std::string ToString(const lsRequestId& id) { - if (id.type != lsRequestId::kNone) +std::string ToString(lsRequestId const& id) +{ + if (id.type != lsRequestId::kNone) + { + if (id.type == lsRequestId::kString) { - if(id.type == lsRequestId::kString) - { - if (!id.k_string.empty()) - return id.k_string; - } - return std::to_string(id.value); + if (!id.k_string.empty()) + { + return id.k_string; + } } + return std::to_string(id.value); + } - return ""; + return ""; } - - diff --git a/graphics/asymptote/LspCpp/src/jsonrpc/serializer.cpp b/graphics/asymptote/LspCpp/src/jsonrpc/serializer.cpp index 8c5beba83e..259b900e72 100644 --- a/graphics/asymptote/LspCpp/src/jsonrpc/serializer.cpp +++ b/graphics/asymptote/LspCpp/src/jsonrpc/serializer.cpp @@ -3,212 +3,261 @@ #include <rapidjson/allocators.h> #include "LibLsp/JsonRpc/json.h" - - //// Elementary types -void JsonNull::swap(JsonNull& arg) noexcept +void JsonNull::swap(JsonNull&) noexcept { } - -void Reflect(Reader& visitor, uint8_t& value) { - if (!visitor.IsInt()) - throw std::invalid_argument("uint8_t"); - value = (uint8_t)visitor.GetInt(); +void Reflect(Reader& visitor, uint8_t& value) +{ + if (!visitor.IsInt()) + { + throw std::invalid_argument("uint8_t"); + } + value = (uint8_t)visitor.GetInt(); } -void Reflect(Writer& visitor, uint8_t& value) { - visitor.Int(value); +void Reflect(Writer& visitor, uint8_t& value) +{ + visitor.Int(value); } -void Reflect(Reader& visitor, short& value) { - if (!visitor.IsInt()) - throw std::invalid_argument("short"); - value = (short)visitor.GetInt(); +void Reflect(Reader& visitor, short& value) +{ + if (!visitor.IsInt()) + { + throw std::invalid_argument("short"); + } + value = (short)visitor.GetInt(); } -void Reflect(Writer& visitor, short& value) { - visitor.Int(value); +void Reflect(Writer& visitor, short& value) +{ + visitor.Int(value); } -void Reflect(Reader& visitor, unsigned short& value) { - if (!visitor.IsInt()) - throw std::invalid_argument("unsigned short"); - value = (unsigned short)visitor.GetInt(); +void Reflect(Reader& visitor, unsigned short& value) +{ + if (!visitor.IsInt()) + { + throw std::invalid_argument("unsigned short"); + } + value = (unsigned short)visitor.GetInt(); } -void Reflect(Writer& visitor, unsigned short& value) { - visitor.Int(value); +void Reflect(Writer& visitor, unsigned short& value) +{ + visitor.Int(value); } -void Reflect(Reader& visitor, int& value) { - if (!visitor.IsInt()) - throw std::invalid_argument("int"); - value = visitor.GetInt(); +void Reflect(Reader& visitor, int& value) +{ + if (!visitor.IsInt()) + { + throw std::invalid_argument("int"); + } + value = visitor.GetInt(); } -void Reflect(Writer& visitor, int& value) { - visitor.Int(value); +void Reflect(Writer& visitor, int& value) +{ + visitor.Int(value); } -void Reflect(Reader& visitor, unsigned& value) { - if (!visitor.IsUint64()) - throw std::invalid_argument("unsigned"); - value = visitor.GetUint32(); +void Reflect(Reader& visitor, unsigned& value) +{ + if (!visitor.IsUint64()) + { + throw std::invalid_argument("unsigned"); + } + value = visitor.GetUint32(); } -void Reflect(Writer& visitor, unsigned& value) { - visitor.Uint32(value); +void Reflect(Writer& visitor, unsigned& value) +{ + visitor.Uint32(value); } -void Reflect(Reader& visitor, long& value) { - if (!visitor.IsInt64()) - throw std::invalid_argument("long"); - value = long(visitor.GetInt64()); +void Reflect(Reader& visitor, long& value) +{ + if (!visitor.IsInt64()) + { + throw std::invalid_argument("long"); + } + value = long(visitor.GetInt64()); } -void Reflect(Writer& visitor, long& value) { - visitor.Int64(value); +void Reflect(Writer& visitor, long& value) +{ + visitor.Int64(value); } -void Reflect(Reader& visitor, unsigned long& value) { - if (!visitor.IsUint64()) - throw std::invalid_argument("unsigned long"); - value = (unsigned long)visitor.GetUint64(); +void Reflect(Reader& visitor, unsigned long& value) +{ + if (!visitor.IsUint64()) + { + throw std::invalid_argument("unsigned long"); + } + value = (unsigned long)visitor.GetUint64(); } -void Reflect(Writer& visitor, unsigned long& value) { - visitor.Uint64(value); +void Reflect(Writer& visitor, unsigned long& value) +{ + visitor.Uint64(value); } -void Reflect(Reader& visitor, long long& value) { - if (!visitor.IsInt64()) - throw std::invalid_argument("long long"); - value = visitor.GetInt64(); +void Reflect(Reader& visitor, long long& value) +{ + if (!visitor.IsInt64()) + { + throw std::invalid_argument("long long"); + } + value = visitor.GetInt64(); } -void Reflect(Writer& visitor, long long& value) { - visitor.Int64(value); +void Reflect(Writer& visitor, long long& value) +{ + visitor.Int64(value); } -void Reflect(Reader& visitor, unsigned long long& value) { - if (!visitor.IsUint64()) - throw std::invalid_argument("unsigned long long"); - value = visitor.GetUint64(); +void Reflect(Reader& visitor, unsigned long long& value) +{ + if (!visitor.IsUint64()) + { + throw std::invalid_argument("unsigned long long"); + } + value = visitor.GetUint64(); } -void Reflect(Writer& visitor, unsigned long long& value) { - visitor.Uint64(value); +void Reflect(Writer& visitor, unsigned long long& value) +{ + visitor.Uint64(value); } -void Reflect(Reader& visitor, double& value) { - if (!visitor.IsNumber()) - throw std::invalid_argument("double"); - value = visitor.GetDouble(); +void Reflect(Reader& visitor, double& value) +{ + if (!visitor.IsNumber()) + { + throw std::invalid_argument("double"); + } + value = visitor.GetDouble(); } -void Reflect(Writer& visitor, double& value) { - visitor.Double(value); +void Reflect(Writer& visitor, double& value) +{ + visitor.Double(value); } -void Reflect(Reader& visitor, bool& value) { - if (!visitor.IsBool()) - throw std::invalid_argument("bool"); - value = visitor.GetBool(); +void Reflect(Reader& visitor, bool& value) +{ + if (!visitor.IsBool()) + { + throw std::invalid_argument("bool"); + } + value = visitor.GetBool(); } -void Reflect(Writer& visitor, bool& value) { - visitor.Bool(value); +void Reflect(Writer& visitor, bool& value) +{ + visitor.Bool(value); } -void Reflect(Reader& visitor, std::string& value) { - if (!visitor.IsString()) - throw std::invalid_argument("std::string"); - value = visitor.GetString(); +void Reflect(Reader& visitor, std::string& value) +{ + if (!visitor.IsString()) + { + throw std::invalid_argument("std::string"); + } + value = visitor.GetString(); } -void Reflect(Writer& visitor, std::string& value) { - visitor.String(value.c_str(), (rapidjson::SizeType)value.size()); +void Reflect(Writer& visitor, std::string& value) +{ + visitor.String(value.c_str(), (rapidjson::SizeType)value.size()); } -void Reflect(Reader& visitor, JsonNull& value) { - visitor.GetNull(); +void Reflect(Reader& visitor, JsonNull&) +{ + visitor.GetNull(); } -void Reflect(Writer& visitor, JsonNull& value) { - visitor.Null(); +void Reflect(Writer& visitor, JsonNull&) +{ + visitor.Null(); } - -void Reflect(Reader& visitor, SerializeFormat& value) { - std::string fmt = visitor.GetString(); - value = fmt[0] == 'm' ? SerializeFormat::MessagePack : SerializeFormat::Json; +void Reflect(Reader& visitor, SerializeFormat& value) +{ + std::string fmt = visitor.GetString(); + value = fmt[0] == 'm' ? SerializeFormat::MessagePack : SerializeFormat::Json; } -void Reflect(Writer& visitor, SerializeFormat& value) { - switch (value) { +void Reflect(Writer& visitor, SerializeFormat& value) +{ + switch (value) + { case SerializeFormat::Json: - visitor.String("json"); - break; + visitor.String("json"); + break; case SerializeFormat::MessagePack: - visitor.String("msgpack"); - break; - } + visitor.String("msgpack"); + break; + } } - std::string JsonReader::ToString() const { - rapidjson::StringBuffer strBuf; - strBuf.Clear(); - rapidjson::Writer<rapidjson::StringBuffer> writer(strBuf); - m_->Accept(writer); - std::string strJson = strBuf.GetString(); - return strJson; + rapidjson::StringBuffer strBuf; + strBuf.Clear(); + rapidjson::Writer<rapidjson::StringBuffer> writer(strBuf); + m_->Accept(writer); + std::string strJson = strBuf.GetString(); + return strJson; } -void JsonReader::IterMap(std::function<void(const char*, Reader&)> fn) +void JsonReader::IterMap(std::function<void(char const*, Reader&)> fn) { - path_.push_back("0"); - for (auto& entry : m_->GetObject()) - { - auto saved = m_; - m_ = &(entry.value); + path_.push_back("0"); + for (auto& entry : m_->GetObject()) + { + auto saved = m_; + m_ = &(entry.value); - fn(entry.name.GetString(), *this); - m_ = saved; - } - path_.pop_back(); + fn(entry.name.GetString(), *this); + m_ = saved; + } + path_.pop_back(); } - void JsonReader::IterArray(std::function<void(Reader&)> fn) +void JsonReader::IterArray(std::function<void(Reader&)> fn) { - if (!m_->IsArray()) - throw std::invalid_argument("array"); - // Use "0" to indicate any element for now. - path_.push_back("0"); - for (auto& entry : m_->GetArray()) - { - auto saved = m_; - m_ = &entry; - fn(*this); - m_ = saved; - } - path_.pop_back(); + if (!m_->IsArray()) + { + throw std::invalid_argument("array"); + } + // Use "0" to indicate any element for now. + path_.push_back("0"); + for (auto& entry : m_->GetArray()) + { + auto saved = m_; + m_ = &entry; + fn(*this); + m_ = saved; + } + path_.pop_back(); } -void JsonReader::DoMember(const char* name, std::function<void(Reader&)> fn) +void JsonReader::DoMember(char const* name, std::function<void(Reader&)> fn) { - path_.push_back(name); - auto it = m_->FindMember(name); - if (it != m_->MemberEnd()) - { - auto saved = m_; - m_ = &it->value; - fn(*this); - m_ = saved; - } - path_.pop_back(); + path_.push_back(name); + auto it = m_->FindMember(name); + if (it != m_->MemberEnd()) + { + auto saved = m_; + m_ = &it->value; + fn(*this); + m_ = saved; + } + path_.pop_back(); } std::string JsonReader::GetPath() const { - std::string ret; - for (auto& t : path_) - { - ret += '/'; - ret += t; - } - ret.pop_back(); - return ret; + std::string ret; + for (auto& t : path_) + { + ret += '/'; + ret += t; + } + ret.pop_back(); + return ret; } - diff --git a/graphics/asymptote/LspCpp/src/jsonrpc/threaded_queue.cpp b/graphics/asymptote/LspCpp/src/jsonrpc/threaded_queue.cpp index 1f9a02ac0d..615bcf9ceb 100644 --- a/graphics/asymptote/LspCpp/src/jsonrpc/threaded_queue.cpp +++ b/graphics/asymptote/LspCpp/src/jsonrpc/threaded_queue.cpp @@ -1,20 +1,26 @@ #include "LibLsp/JsonRpc/threaded_queue.h" // static -bool MultiQueueWaiter::HasState( - std::initializer_list<BaseThreadQueue*> queues) { - for (BaseThreadQueue* queue : queues) { - if (!queue->IsEmpty()) - return true; - } - return false; +bool MultiQueueWaiter::HasState(std::initializer_list<BaseThreadQueue*> queues) +{ + for (BaseThreadQueue* queue : queues) + { + if (!queue->IsEmpty()) + { + return true; + } + } + return false; } -bool MultiQueueWaiter::ValidateWaiter( - std::initializer_list<BaseThreadQueue*> queues) { - for (BaseThreadQueue* queue : queues) { - if (queue->waiter.get() != this) - return false; - } - return true; +bool MultiQueueWaiter::ValidateWaiter(std::initializer_list<BaseThreadQueue*> queues) +{ + for (BaseThreadQueue* queue : queues) + { + if (queue->waiter.get() != this) + { + return false; + } + } + return true; } diff --git a/graphics/asymptote/LspCpp/src/lsp/Markup.cpp b/graphics/asymptote/LspCpp/src/lsp/Markup.cpp index f22baac95d..6907df4f76 100644 --- a/graphics/asymptote/LspCpp/src/lsp/Markup.cpp +++ b/graphics/asymptote/LspCpp/src/lsp/Markup.cpp @@ -16,443 +16,572 @@ #include <vector> #include <boost/algorithm/string.hpp> -namespace lsp { - - /// hexdigit - Return the hexadecimal character for the - /// given number \p X (which should be less than 16). - inline char hexdigit(unsigned X, bool LowerCase = false) { - const char HexChar = LowerCase ? 'a' : 'A'; - return X < 10 ? '0' + X : HexChar + X - 10; - } - - /// Given an array of c-style strings terminated by a null pointer, construct - /// a vector of StringRefs representing the same strings without the terminating - /// null string. - inline std::vector< std::string_ref> toStringRefArray(const char* const* Strings) { - std::vector< std::string_ref> Result; - while (*Strings) - Result.push_back(*Strings++); - return Result; +namespace lsp +{ + +/// hexdigit - Return the hexadecimal character for the +/// given number \p X (which should be less than 16). +inline char hexdigit(unsigned X, bool LowerCase = false) +{ + char const HexChar = LowerCase ? 'a' : 'A'; + auto const castedX = static_cast<char>(X); + return X < 10 ? '0' + castedX : HexChar + castedX - 10; +} + +/// Given an array of c-style strings terminated by a null pointer, construct +/// a vector of StringRefs representing the same strings without the terminating +/// null string. +inline std::vector<std::string_ref> toStringRefArray(char const* const* Strings) +{ + std::vector<std::string_ref> Result; + while (*Strings) + { + Result.push_back(*Strings++); } + return Result; +} + +/// Construct a string ref from a boolean. +inline std::string_ref toStringRef(bool B) +{ + return std::string_ref(B ? "true" : "false"); +} + +/// Construct a string ref from an array ref of unsigned chars. +inline std::string_ref toStringRef(std::vector<uint8_t> const& Input) +{ + return std::string_ref(Input.begin(), Input.end()); +} - /// Construct a string ref from a boolean. - inline std::string_ref toStringRef(bool B) { return std::string_ref(B ? "true" : "false"); } - - /// Construct a string ref from an array ref of unsigned chars. - inline std::string_ref toStringRef(const std::vector<uint8_t>& Input) { - return std::string_ref(Input.begin(), Input.end()); - } - - /// Construct a string ref from an array ref of unsigned chars. - inline std::vector<uint8_t> arrayRefFromStringRef(const std::string_ref& Input) { - return { Input.begin(), Input.end() }; - } - - /// Interpret the given character \p C as a hexadecimal digit and return its - /// value. - /// - /// If \p C is not a valid hex digit, -1U is returned. - inline unsigned hexDigitValue(char C) { - struct HexTable { - unsigned LUT[255] = {}; - constexpr HexTable() { - // Default initialize everything to invalid. - for (int i = 0; i < 255; ++i) - LUT[i] = ~0U; - // Initialize `0`-`9`. - for (int i = 0; i < 10; ++i) - LUT['0' + i] = i; - // Initialize `A`-`F` and `a`-`f`. - for (int i = 0; i < 6; ++i) - LUT['A' + i] = LUT['a' + i] = 10 + i; +/// Construct a string ref from an array ref of unsigned chars. +inline std::vector<uint8_t> arrayRefFromStringRef(std::string_ref const& Input) +{ + return {Input.begin(), Input.end()}; +} + +/// Interpret the given character \p C as a hexadecimal digit and return its +/// value. +/// +/// If \p C is not a valid hex digit, -1U is returned. +inline unsigned hexDigitValue(char C) +{ + struct HexTable + { + unsigned LUT[255] = {}; + constexpr HexTable() + { + // Default initialize everything to invalid. + for (int i = 0; i < 255; ++i) + { + LUT[i] = ~0U; } - }; - constexpr HexTable Table; - return Table.LUT[static_cast<unsigned char>(C)]; - } + // Initialize `0`-`9`. + for (int i = 0; i < 10; ++i) + { + LUT['0' + i] = i; + } + // Initialize `A`-`F` and `a`-`f`. + for (int i = 0; i < 6; ++i) + { + LUT['A' + i] = LUT['a' + i] = 10 + i; + } + } + }; + constexpr HexTable Table; + return Table.LUT[static_cast<unsigned char>(C)]; +} - /// Checks if character \p C is one of the 10 decimal digits. - inline bool isDigit(char C) { return C >= '0' && C <= '9'; } +/// Checks if character \p C is one of the 10 decimal digits. +inline bool isDigit(char C) +{ + return C >= '0' && C <= '9'; +} - /// Checks if character \p C is a hexadecimal numeric character. - inline bool isHexDigit(char C) { return hexDigitValue(C) != ~0U; } +/// Checks if character \p C is a hexadecimal numeric character. +inline bool isHexDigit(char C) +{ + return hexDigitValue(C) != ~0U; +} - /// Checks if character \p C is a valid letter as classified by "C" locale. - inline bool isAlpha(char C) { - return ('a' <= C && C <= 'z') || ('A' <= C && C <= 'Z'); - } +/// Checks if character \p C is a valid letter as classified by "C" locale. +inline bool isAlpha(char C) +{ + return ('a' <= C && C <= 'z') || ('A' <= C && C <= 'Z'); +} - /// Checks whether character \p C is either a decimal digit or an uppercase or - /// lowercase letter as classified by "C" locale. - inline bool isAlnum(char C) { return isAlpha(C) || isDigit(C); } +/// Checks whether character \p C is either a decimal digit or an uppercase or +/// lowercase letter as classified by "C" locale. +inline bool isAlnum(char C) +{ + return isAlpha(C) || isDigit(C); +} - /// Checks whether character \p C is valid ASCII (high bit is zero). - inline bool isASCII(char C) { return static_cast<unsigned char>(C) <= 127; } +/// Checks whether character \p C is valid ASCII (high bit is zero). +inline bool isASCII(char C) +{ + return static_cast<unsigned char>(C) <= 127; +} - /// Checks whether all characters in S are ASCII. - inline bool isASCII(std::string_ref S) { - for (char C : S) +/// Checks whether all characters in S are ASCII. +inline bool isASCII(std::string_ref S) +{ + for (char C : S) + { + if (!isASCII(C)) { - if(!isASCII(C))return true; + return true; } - return true; } + return true; +} - /// Checks whether character \p C is printable. - /// - /// Locale-independent version of the C standard library isprint whose results - /// may differ on different platforms. - inline bool isPrint(char C) { - unsigned char UC = static_cast<unsigned char>(C); - return (0x20 <= UC) && (UC <= 0x7E); - } +/// Checks whether character \p C is printable. +/// +/// Locale-independent version of the C standard library isprint whose results +/// may differ on different platforms. +inline bool isPrint(char C) +{ + unsigned char UC = static_cast<unsigned char>(C); + return (0x20 <= UC) && (UC <= 0x7E); +} + +/// Checks whether character \p C is whitespace in the "C" locale. +/// +/// Locale-independent version of the C standard library isspace. +inline bool isSpace(char C) +{ + return C == ' ' || C == '\f' || C == '\n' || C == '\r' || C == '\t' || C == '\v'; +} - /// Checks whether character \p C is whitespace in the "C" locale. - /// - /// Locale-independent version of the C standard library isspace. - inline bool isSpace(char C) { - return C == ' ' || C == '\f' || C == '\n' || C == '\r' || C == '\t' || - C == '\v'; +/// Returns the corresponding lowercase character if \p x is uppercase. +inline char toLower(char x) +{ + if (x >= 'A' && x <= 'Z') + { + return x - 'A' + 'a'; } + return x; +} - /// Returns the corresponding lowercase character if \p x is uppercase. - inline char toLower(char x) { - if (x >= 'A' && x <= 'Z') - return x - 'A' + 'a'; - return x; +/// Returns the corresponding uppercase character if \p x is lowercase. +inline char toUpper(char x) +{ + if (x >= 'a' && x <= 'z') + { + return x - 'a' + 'A'; } + return x; +} + +inline std::string utohexstr(uint64_t X, bool LowerCase = false) +{ + char Buffer[17]; + char* BufPtr = std::end(Buffer); - /// Returns the corresponding uppercase character if \p x is lowercase. - inline char toUpper(char x) { - if (x >= 'a' && x <= 'z') - return x - 'a' + 'A'; - return x; + if (X == 0) + { + *--BufPtr = '0'; } - inline std::string utohexstr(uint64_t X, bool LowerCase = false) { - char Buffer[17]; - char* BufPtr = std::end(Buffer); + while (X) + { + unsigned char Mod = static_cast<unsigned char>(X) & 15; + *--BufPtr = hexdigit(Mod, LowerCase); + X >>= 4; + } - if (X == 0) *--BufPtr = '0'; + return std::string(BufPtr, std::end(Buffer)); +} - while (X) { - unsigned char Mod = static_cast<unsigned char>(X) & 15; - *--BufPtr = hexdigit(Mod, LowerCase); - X >>= 4; - } +/// Convert buffer \p Input to its hexadecimal representation. +/// The returned string is double the size of \p Input. +inline std::string toHex(std::string_ref Input, bool LowerCase = false) +{ + static char const* const LUT = "0123456789ABCDEF"; + uint8_t const Offset = LowerCase ? 32 : 0; + size_t Length = Input.size(); - return std::string(BufPtr, std::end(Buffer)); + std::string Output; + Output.reserve(2 * Length); + for (size_t i = 0; i < Length; ++i) + { + unsigned char const c = Input[i]; + Output.push_back(LUT[c >> 4] | Offset); + Output.push_back(LUT[c & 15] | Offset); } + return Output; +} - /// Convert buffer \p Input to its hexadecimal representation. - /// The returned string is double the size of \p Input. - inline std::string toHex( std::string_ref Input, bool LowerCase = false) { - static const char* const LUT = "0123456789ABCDEF"; - const uint8_t Offset = LowerCase ? 32 : 0; - size_t Length = Input.size(); +inline std::string toHex(std::vector<uint8_t> Input, bool LowerCase = false) +{ + return toHex(toStringRef(Input), LowerCase); +} - std::string Output; - Output.reserve(2 * Length); - for (size_t i = 0; i < Length; ++i) { - const unsigned char c = Input[i]; - Output.push_back(LUT[c >> 4] | Offset); - Output.push_back(LUT[c & 15] | Offset); - } - return Output; +/// Store the binary representation of the two provided values, \p MSB and +/// \p LSB, that make up the nibbles of a hexadecimal digit. If \p MSB or \p LSB +/// do not correspond to proper nibbles of a hexadecimal digit, this method +/// returns false. Otherwise, returns true. +inline bool tryGetHexFromNibbles(char MSB, char LSB, uint8_t& Hex) +{ + unsigned U1 = hexDigitValue(MSB); + unsigned U2 = hexDigitValue(LSB); + if (U1 == ~0U || U2 == ~0U) + { + return false; } - inline std::string toHex(std::vector<uint8_t> Input, bool LowerCase = false) { - return toHex(toStringRef(Input), LowerCase); - } + Hex = static_cast<uint8_t>((U1 << 4) | U2); + return true; +} - /// Store the binary representation of the two provided values, \p MSB and - /// \p LSB, that make up the nibbles of a hexadecimal digit. If \p MSB or \p LSB - /// do not correspond to proper nibbles of a hexadecimal digit, this method - /// returns false. Otherwise, returns true. - inline bool tryGetHexFromNibbles(char MSB, char LSB, uint8_t& Hex) { - unsigned U1 = hexDigitValue(MSB); - unsigned U2 = hexDigitValue(LSB); - if (U1 == ~0U || U2 == ~0U) - return false; +/// Return the binary representation of the two provided values, \p MSB and +/// \p LSB, that make up the nibbles of a hexadecimal digit. +inline uint8_t hexFromNibbles(char MSB, char LSB) +{ + uint8_t Hex = 0; + bool GotHex = tryGetHexFromNibbles(MSB, LSB, Hex); + (void)GotHex; + assert(GotHex && "MSB and/or LSB do not correspond to hex digits"); + return Hex; +} - Hex = static_cast<uint8_t>((U1 << 4) | U2); +/// Convert hexadecimal string \p Input to its binary representation and store +/// the result in \p Output. Returns true if the binary representation could be +/// converted from the hexadecimal string. Returns false if \p Input contains +/// non-hexadecimal digits. The output string is half the size of \p Input. +inline bool tryGetFromHex(std::string_ref Input, std::string& Output) +{ + if (Input.empty()) + { return true; } - /// Return the binary representation of the two provided values, \p MSB and - /// \p LSB, that make up the nibbles of a hexadecimal digit. - inline uint8_t hexFromNibbles(char MSB, char LSB) { + Output.reserve((Input.size() + 1) / 2); + if (Input.size() % 2 == 1) + { uint8_t Hex = 0; - bool GotHex = tryGetHexFromNibbles(MSB, LSB, Hex); - (void)GotHex; - assert(GotHex && "MSB and/or LSB do not correspond to hex digits"); - return Hex; - } - - /// Convert hexadecimal string \p Input to its binary representation and store - /// the result in \p Output. Returns true if the binary representation could be - /// converted from the hexadecimal string. Returns false if \p Input contains - /// non-hexadecimal digits. The output string is half the size of \p Input. - inline bool tryGetFromHex( std::string_ref Input, std::string& Output) { - if (Input.empty()) - return true; - - Output.reserve((Input.size() + 1) / 2); - if (Input.size() % 2 == 1) { - uint8_t Hex = 0; - if (!tryGetHexFromNibbles('0', Input.front(), Hex)) - return false; - - Output.push_back(Hex); - Input = Input.drop_front(); + if (!tryGetHexFromNibbles('0', Input.front(), Hex)) + { + return false; } - assert(Input.size() % 2 == 0); - while (!Input.empty()) { - uint8_t Hex = 0; - if (!tryGetHexFromNibbles(Input[0], Input[1], Hex)) - return false; + Output.push_back(Hex); + Input = Input.drop_front(); + } - Output.push_back(Hex); - Input = Input.drop_front(2); + assert(Input.size() % 2 == 0); + while (!Input.empty()) + { + uint8_t Hex = 0; + if (!tryGetHexFromNibbles(Input[0], Input[1], Hex)) + { + return false; } - return true; - } - /// Convert hexadecimal string \p Input to its binary representation. - /// The return string is half the size of \p Input. - inline std::string fromHex( std::string_ref Input) { - std::string Hex; - bool GotHex = tryGetFromHex(Input, Hex); - (void)GotHex; - assert(GotHex && "Input contains non hex digits"); - return Hex; + Output.push_back(Hex); + Input = Input.drop_front(2); } + return true; +} +/// Convert hexadecimal string \p Input to its binary representation. +/// The return string is half the size of \p Input. +inline std::string fromHex(std::string_ref Input) +{ + std::string Hex; + bool GotHex = tryGetFromHex(Input, Hex); + (void)GotHex; + assert(GotHex && "Input contains non hex digits"); + return Hex; +} +inline std::string utostr(uint64_t X, bool isNeg = false) +{ + char Buffer[21]; + char* BufPtr = std::end(Buffer); - inline std::string utostr(uint64_t X, bool isNeg = false) { - char Buffer[21]; - char* BufPtr = std::end(Buffer); - - if (X == 0) *--BufPtr = '0'; // Handle special case... - - while (X) { - *--BufPtr = '0' + char(X % 10); - X /= 10; - } - - if (isNeg) *--BufPtr = '-'; // Add negative sign... - return std::string(BufPtr, std::end(Buffer)); + if (X == 0) + { + *--BufPtr = '0'; // Handle special case... } - inline std::string itostr(int64_t X) { - if (X < 0) - return utostr(static_cast<uint64_t>(1) + ~static_cast<uint64_t>(X), true); - else - return utostr(static_cast<uint64_t>(X)); + while (X) + { + *--BufPtr = '0' + char(X % 10); + X /= 10; } - /// StrInStrNoCase - Portable version of strcasestr. Locates the first - /// occurrence of string 's1' in string 's2', ignoring case. Returns - /// the offset of s2 in s1 or npos if s2 cannot be found. - std::string_ref::size_type StrInStrNoCase( std::string_ref s1, std::string_ref s2); - - /// getToken - This function extracts one token from source, ignoring any - /// leading characters that appear in the Delimiters string, and ending the - /// token at any of the characters that appear in the Delimiters string. If - /// there are no tokens in the source string, an empty string is returned. - /// The function returns a pair containing the extracted token and the - /// remaining tail string. - std::pair< std::string_ref, std::string_ref> getToken( std::string_ref Source, - std::string_ref Delimiters = " \t\n\v\f\r"); - + if (isNeg) + { + *--BufPtr = '-'; // Add negative sign... + } + return std::string(BufPtr, std::end(Buffer)); +} +inline std::string itostr(int64_t X) +{ + if (X < 0) + { + return utostr(static_cast<uint64_t>(1) + ~static_cast<uint64_t>(X), true); + } + else + { + return utostr(static_cast<uint64_t>(X)); + } +} - /// Returns the English suffix for an ordinal integer (-st, -nd, -rd, -th). - inline std::string_ref getOrdinalSuffix(unsigned Val) { - // It is critically important that we do this perfectly for - // user-written sequences with over 100 elements. - switch (Val % 100) { - case 11: - case 12: - case 13: - return "th"; +/// StrInStrNoCase - Portable version of strcasestr. Locates the first +/// occurrence of string 's1' in string 's2', ignoring case. Returns +/// the offset of s2 in s1 or npos if s2 cannot be found. +std::string_ref::size_type StrInStrNoCase(std::string_ref s1, std::string_ref s2); + +/// getToken - This function extracts one token from source, ignoring any +/// leading characters that appear in the Delimiters string, and ending the +/// token at any of the characters that appear in the Delimiters string. If +/// there are no tokens in the source string, an empty string is returned. +/// The function returns a pair containing the extracted token and the +/// remaining tail string. +std::pair<std::string_ref, std::string_ref> getToken( + std::string_ref Source, std::string_ref Delimiters = " \t\n\v\f\r" +); + +/// Returns the English suffix for an ordinal integer (-st, -nd, -rd, -th). +inline std::string_ref getOrdinalSuffix(unsigned Val) +{ + // It is critically important that we do this perfectly for + // user-written sequences with over 100 elements. + switch (Val % 100) + { + case 11: + case 12: + case 13: + return "th"; + default: + switch (Val % 10) + { + case 1: + return "st"; + case 2: + return "nd"; + case 3: + return "rd"; default: - switch (Val % 10) { - case 1: return "st"; - case 2: return "nd"; - case 3: return "rd"; - default: return "th"; - } + return "th"; } } +} - namespace detail { +namespace detail +{ - template <typename IteratorT> - inline std::string join_impl(IteratorT Begin, IteratorT End, - std::string_ref Separator, std::input_iterator_tag) { - std::string S; - if (Begin == End) - return S; + template<typename IteratorT> + inline std::string join_impl(IteratorT Begin, IteratorT End, std::string_ref Separator, std::input_iterator_tag) + { + std::string S; + if (Begin == End) + { + return S; + } + S += (*Begin); + while (++Begin != End) + { + S += Separator; S += (*Begin); - while (++Begin != End) { - S += Separator; - S += (*Begin); - } + } + return S; + } + + template<typename IteratorT> + inline std::string join_impl(IteratorT Begin, IteratorT End, std::string_ref Separator, std::forward_iterator_tag) + { + std::string S; + if (Begin == End) + { return S; } - template <typename IteratorT> - inline std::string join_impl(IteratorT Begin, IteratorT End, - std::string_ref Separator, std::forward_iterator_tag) { - std::string S; - if (Begin == End) - return S; - - size_t Len = (std::distance(Begin, End) - 1) * Separator.size(); - for (IteratorT I = Begin; I != End; ++I) - Len += (*I).size(); - S.reserve(Len); - size_t PrevCapacity = S.capacity(); - (void)PrevCapacity; + size_t Len = (std::distance(Begin, End) - 1) * Separator.size(); + for (IteratorT I = Begin; I != End; ++I) + { + Len += (*I).size(); + } + S.reserve(Len); + size_t PrevCapacity = S.capacity(); + (void)PrevCapacity; + S += (*Begin); + while (++Begin != End) + { + S += Separator; S += (*Begin); - while (++Begin != End) { - S += Separator; - S += (*Begin); - } - assert(PrevCapacity == S.capacity() && "String grew during building"); - return S; } + assert(PrevCapacity == S.capacity() && "String grew during building"); + return S; + } - template <typename Sep> - inline void join_items_impl(std::string& Result, Sep Separator) {} + template<typename Sep> + inline void join_items_impl(std::string& Result, Sep Separator) + { + } - template <typename Sep, typename Arg> - inline void join_items_impl(std::string& Result, Sep Separator, - const Arg& Item) { - Result += Item; - } + template<typename Sep, typename Arg> + inline void join_items_impl(std::string& Result, Sep Separator, Arg const& Item) + { + Result += Item; + } - template <typename Sep, typename Arg1, typename... Args> - inline void join_items_impl(std::string& Result, Sep Separator, const Arg1& A1, - Args &&... Items) { - Result += A1; - Result += Separator; - join_items_impl(Result, Separator, std::forward<Args>(Items)...); - } + template<typename Sep, typename Arg1, typename... Args> + inline void join_items_impl(std::string& Result, Sep Separator, Arg1 const& A1, Args&&... Items) + { + Result += A1; + Result += Separator; + join_items_impl(Result, Separator, std::forward<Args>(Items)...); + } + + inline size_t join_one_item_size(char) + { + return 1; + } + inline size_t join_one_item_size(char const* S) + { + return S ? ::strlen(S) : 0; + } - inline size_t join_one_item_size(char) { return 1; } - inline size_t join_one_item_size(const char* S) { return S ? ::strlen(S) : 0; } + template<typename T> + inline size_t join_one_item_size(T const& Str) + { + return Str.size(); + } - template <typename T> inline size_t join_one_item_size(const T& Str) { - return Str.size(); - } + inline size_t join_items_size() + { + return 0; + } - inline size_t join_items_size() { return 0; } + template<typename A1> + inline size_t join_items_size(const A1& A) + { + return join_one_item_size(A); + } + template<typename A1, typename... Args> + inline size_t join_items_size(const A1& A, Args&&... Items) + { + return join_one_item_size(A) + join_items_size(std::forward<Args>(Items)...); + } - template <typename A1> inline size_t join_items_size(const A1& A) { - return join_one_item_size(A); - } - template <typename A1, typename... Args> - inline size_t join_items_size(const A1& A, Args &&... Items) { - return join_one_item_size(A) + join_items_size(std::forward<Args>(Items)...); - } +} // end namespace detail - } // end namespace detail - - /// Joins the strings in the range [Begin, End), adding Separator between - /// the elements. - template <typename IteratorT> - inline std::string join(IteratorT Begin, IteratorT End, std::string_ref Separator) { - using tag = typename std::iterator_traits<IteratorT>::iterator_category; - return detail::join_impl(Begin, End, Separator, tag()); - } - - /// Joins the strings in the range [R.begin(), R.end()), adding Separator - /// between the elements. - template <typename Range> - inline std::string join(Range&& R, std::string_ref Separator) { - return join(R.begin(), R.end(), Separator); - } - - /// Joins the strings in the parameter pack \p Items, adding \p Separator - /// between the elements. All arguments must be implicitly convertible to - /// std::string, or there should be an overload of std::string::operator+=() - /// that accepts the argument explicitly. - template <typename Sep, typename... Args> - inline std::string join_items(Sep Separator, Args &&... Items) { - std::string Result; - if (sizeof...(Items) == 0) - return Result; - - size_t NS = detail::join_one_item_size(Separator); - size_t NI = detail::join_items_size(std::forward<Args>(Items)...); - Result.reserve(NI + (sizeof...(Items) - 1) * NS + 1); - detail::join_items_impl(Result, Separator, std::forward<Args>(Items)...); +/// Joins the strings in the range [Begin, End), adding Separator between +/// the elements. +template<typename IteratorT> +inline std::string join(IteratorT Begin, IteratorT End, std::string_ref Separator) +{ + using tag = typename std::iterator_traits<IteratorT>::iterator_category; + return detail::join_impl(Begin, End, Separator, tag()); +} + +/// Joins the strings in the range [R.begin(), R.end()), adding Separator +/// between the elements. +template<typename Range> +inline std::string join(Range&& R, std::string_ref Separator) +{ + return join(R.begin(), R.end(), Separator); +} + +/// Joins the strings in the parameter pack \p Items, adding \p Separator +/// between the elements. All arguments must be implicitly convertible to +/// std::string, or there should be an overload of std::string::operator+=() +/// that accepts the argument explicitly. +template<typename Sep, typename... Args> +inline std::string join_items(Sep Separator, Args&&... Items) +{ + std::string Result; + if (sizeof...(Items) == 0) + { return Result; } - /// A helper class to return the specified delimiter string after the first - /// invocation of operator std::string_ref(). Used to generate a comma-separated - /// list from a loop like so: - /// - /// \code - /// ListSeparator LS; - /// for (auto &I : C) - /// OS << LS << I.getName(); - /// \end - class ListSeparator { - bool First = true; - std::string_ref Separator; - - public: - ListSeparator( std::string_ref Separator = ", ") : Separator(Separator) {} - operator std::string_ref() { - if (First) { - First = false; - return {}; - } - return Separator; + size_t NS = detail::join_one_item_size(Separator); + size_t NI = detail::join_items_size(std::forward<Args>(Items)...); + Result.reserve(NI + (sizeof...(Items) - 1) * NS + 1); + detail::join_items_impl(Result, Separator, std::forward<Args>(Items)...); + return Result; +} + +/// A helper class to return the specified delimiter string after the first +/// invocation of operator std::string_ref(). Used to generate a comma-separated +/// list from a loop like so: +/// +/// \code +/// ListSeparator LS; +/// for (auto &I : C) +/// OS << LS << I.getName(); +/// \end +class ListSeparator +{ + bool First = true; + std::string_ref Separator; + +public: + ListSeparator(std::string_ref Separator = ", ") : Separator(Separator) + { + } + operator std::string_ref() + { + if (First) + { + First = false; + return {}; } - }; + return Separator; + } +}; } // end namespace lsp -namespace lsp{ +namespace lsp +{ // Is <contents a plausible start to an HTML tag? // Contents may not be the rest of the line, but it's the rest of the plain // text, so we expect to see at least the tag name. -bool looksLikeTag(std::string_ref& Contents) { - if (Contents.empty()) - return false; - if (Contents.front() == '!' || Contents.front() == '?' || - Contents.front() == '/') - return true; - // Check the start of the tag name. - if (!lsp::isAlpha(Contents.front())) - return false; - // Drop rest of the tag name, and following whitespace. - Contents = Contents - .drop_while([](char C) { - return lsp::isAlnum(C) || C == '-' || C == '_' || C == ':'; - }) - .drop_while(lsp::isSpace); - // The rest of the tag consists of attributes, which have restrictive names. - // If we hit '=', all bets are off (attribute values can contain anything). - for (; !Contents.empty(); Contents = Contents.drop_front()) { - if (lsp::isAlnum(Contents.front()) || lsp::isSpace(Contents.front())) - continue; - if (Contents.front() == '>' || Contents.start_with("/>")) - return true; // May close the tag. - if (Contents.front() == '=') - return true; // Don't try to parse attribute values. - return false; // Random punctuation means this isn't a tag. - } - return true; // Potentially incomplete tag. +bool looksLikeTag(std::string_ref& Contents) +{ + if (Contents.empty()) + { + return false; + } + if (Contents.front() == '!' || Contents.front() == '?' || Contents.front() == '/') + { + return true; + } + // Check the start of the tag name. + if (!lsp::isAlpha(Contents.front())) + { + return false; + } + // Drop rest of the tag name, and following whitespace. + Contents = Contents.drop_while([](char C) { return lsp::isAlnum(C) || C == '-' || C == '_' || C == ':'; } + ).drop_while(lsp::isSpace); + // The rest of the tag consists of attributes, which have restrictive names. + // If we hit '=', all bets are off (attribute values can contain anything). + for (; !Contents.empty(); Contents = Contents.drop_front()) + { + if (lsp::isAlnum(Contents.front()) || lsp::isSpace(Contents.front())) + { + continue; + } + if (Contents.front() == '>' || Contents.start_with("/>")) + { + return true; // May close the tag. + } + if (Contents.front() == '=') + { + return true; // Don't try to parse attribute values. + } + return false; // Random punctuation means this isn't a tag. + } + return true; // Potentially incomplete tag. } // Tests whether C should be backslash-escaped in markdown. @@ -463,480 +592,556 @@ bool looksLikeTag(std::string_ref& Contents) { // It's always safe to escape punctuation, but want minimal escaping. // The strategy is to escape the first character of anything that might start // a markdown grammar construct. -bool needsLeadingEscape(char C, std::string_ref Before, std::string_ref After, - bool StartsLine) { - - auto RulerLength = [&]() -> /*Length*/ unsigned { - if (!StartsLine || !Before.empty()) - return false; - std::string_ref A = After.trim_right(); - return std::all_of(A.begin(),A.end(), [C](char D) { return C == D; }) ? 1 + A.size() : 0; - }; - auto IsBullet = [&]() { - return StartsLine && Before.empty() && - (After.empty() || After.start_with(" ")); - }; - auto SpaceSurrounds = [&]() { - return (After.empty() || std::isspace(After.front())) && - (Before.empty() || std::isspace(Before.back())); - }; - - auto WordSurrounds = [&]() { - return (!After.empty() && std::isalnum(After.front())) && - (!Before.empty() && std::isalnum(Before.back())); - }; - - switch (C) { - case '\\': // Escaped character. - return true; - case '`': // Code block or inline code - // Any number of backticks can delimit an inline code block that can end - // anywhere (including on another line). We must escape them all. - return true; - case '~': // Code block - return StartsLine && Before.empty() && After.start_with("~~"); - case '#': { // ATX heading. - if (!StartsLine || !Before.empty()) - return false; - std::string_ref& Rest = After.trim_left(C); - return Rest.empty() || Rest.start_with(" "); - } - case ']': // Link or link reference. - // We escape ] rather than [ here, because it's more constrained: - // ](...) is an in-line link - // ]: is a link reference - // The following are only links if the link reference exists: - // ] by itself is a shortcut link - // ][...] is an out-of-line link - // Because we never emit link references, we don't need to handle these. - return After.start_with(":") || After.start_with("("); - case '=': // Setex heading. - return RulerLength() > 0; - case '_': // Horizontal ruler or matched delimiter. - if (RulerLength() >= 3) - return true; - // Not a delimiter if surrounded by space, or inside a word. - // (The rules at word boundaries are subtle). - return !(SpaceSurrounds() || WordSurrounds()); - case '-': // Setex heading, horizontal ruler, or bullet. - if (RulerLength() > 0) - return true; - return IsBullet(); - case '+': // Bullet list. - return IsBullet(); - case '*': // Bullet list, horizontal ruler, or delimiter. - return IsBullet() || RulerLength() >= 3 || !SpaceSurrounds(); - case '<': // HTML tag (or autolink, which we choose not to escape) - return looksLikeTag(After); - case '>': // Quote marker. Needs escaping at start of line. - return StartsLine && Before.empty(); - case '&': { // HTML entity reference - auto End = After.find(';'); - if (End == std::string_ref::npos) - return false; - std::string_ref Content = After.substr(0, End); - if (Content.consume_front("#")) - { - if (Content.consume_front("x") || Content.consume_front("X")) - { - return std::all_of(Content.begin(),Content.end(), lsp::isHexDigit); - } - - return std::all_of(Content.begin(), Content.end(), [](char c) - { - return lsp::isDigit(c); - }); - } - return std::all_of(Content.begin(), Content.end(), [](char c) +bool needsLeadingEscape(char C, std::string_ref Before, std::string_ref After, bool StartsLine) +{ + + auto RulerLength = [&]() -> /*Length*/ unsigned + { + if (!StartsLine || !Before.empty()) + { + return false; + } + std::string_ref A = After.trim_right(); + return std::all_of(A.begin(), A.end(), [C](char D) { return C == D; }) ? 1 + A.size() : 0; + }; + auto IsBullet = [&]() { return StartsLine && Before.empty() && (After.empty() || After.start_with(" ")); }; + auto SpaceSurrounds = [&]() + { return (After.empty() || std::isspace(After.front())) && (Before.empty() || std::isspace(Before.back())); }; + + auto WordSurrounds = [&]() + { return (!After.empty() && std::isalnum(After.front())) && (!Before.empty() && std::isalnum(Before.back())); }; + + switch (C) + { + case '\\': // Escaped character. + return true; + case '`': // Code block or inline code + // Any number of backticks can delimit an inline code block that can end + // anywhere (including on another line). We must escape them all. + return true; + case '~': // Code block + return StartsLine && Before.empty() && After.start_with("~~"); + case '#': + { // ATX heading. + if (!StartsLine || !Before.empty()) { - return lsp::isAlpha(c); - }); - } - case '.': // Numbered list indicator. Escape 12. -> 12\. at start of line. - case ')': - return StartsLine && !Before.empty() && - std::all_of(Before.begin(), Before.end(), [](char c) - { - return lsp::isDigit(c); - }) && After.start_with(" "); - default: - return false; - } + return false; + } + std::string_ref& Rest = After.trim_left(C); + return Rest.empty() || Rest.start_with(" "); + } + case ']': // Link or link reference. + // We escape ] rather than [ here, because it's more constrained: + // ](...) is an in-line link + // ]: is a link reference + // The following are only links if the link reference exists: + // ] by itself is a shortcut link + // ][...] is an out-of-line link + // Because we never emit link references, we don't need to handle these. + return After.start_with(":") || After.start_with("("); + case '=': // Setex heading. + return RulerLength() > 0; + case '_': // Horizontal ruler or matched delimiter. + if (RulerLength() >= 3) + { + return true; + } + // Not a delimiter if surrounded by space, or inside a word. + // (The rules at word boundaries are subtle). + return !(SpaceSurrounds() || WordSurrounds()); + case '-': // Setex heading, horizontal ruler, or bullet. + if (RulerLength() > 0) + { + return true; + } + return IsBullet(); + case '+': // Bullet list. + return IsBullet(); + case '*': // Bullet list, horizontal ruler, or delimiter. + return IsBullet() || RulerLength() >= 3 || !SpaceSurrounds(); + case '<': // HTML tag (or autolink, which we choose not to escape) + return looksLikeTag(After); + case '>': // Quote marker. Needs escaping at start of line. + return StartsLine && Before.empty(); + case '&': + { // HTML entity reference + auto End = After.find(';'); + if (End == std::string_ref::npos) + { + return false; + } + std::string_ref Content = After.substr(0, End); + if (Content.consume_front("#")) + { + if (Content.consume_front("x") || Content.consume_front("X")) + { + return std::all_of(Content.begin(), Content.end(), lsp::isHexDigit); + } + + return std::all_of(Content.begin(), Content.end(), [](char c) { return lsp::isDigit(c); }); + } + return std::all_of(Content.begin(), Content.end(), [](char c) { return lsp::isAlpha(c); }); + } + case '.': // Numbered list indicator. Escape 12. -> 12\. at start of line. + case ')': + return StartsLine && !Before.empty() + && std::all_of(Before.begin(), Before.end(), [](char c) { return lsp::isDigit(c); }) + && After.start_with(" "); + default: + return false; + } } /// Escape a markdown text block. Ensures the punctuation will not introduce /// any of the markdown constructs. - std::string_ref renderText(const std::string_ref& Input, bool StartsLine) { - std::string_ref R; - for (unsigned I = 0; I < Input.size(); ++I) { - if (needsLeadingEscape(Input[I], Input.substr(0, I), Input.substr(I + 1), - StartsLine)) - R.push_back('\\'); - R.push_back(Input[I]); - } - return R; +std::string_ref renderText(std::string_ref const& Input, bool StartsLine) +{ + std::string_ref R; + for (unsigned I = 0; I < Input.size(); ++I) + { + if (needsLeadingEscape(Input[I], Input.substr(0, I), Input.substr(I + 1), StartsLine)) + { + R.push_back('\\'); + } + R.push_back(Input[I]); + } + return R; } /// Renders \p Input as an inline block of code in markdown. The returned value /// is surrounded by backticks and the inner contents are properly escaped. - std::string_ref renderInlineBlock(const std::string_ref& Input) { - std::string_ref R; - // Double all backticks to make sure we don't close the inline block early. - for (size_t From = 0; From < Input.size();) { - size_t Next = Input.find("`", From); - R += Input.substr(From, Next - From); - if (Next == std::string_ref::npos) - break; - R += "``"; // double the found backtick. - - From = Next + 1; - } - // If results starts with a backtick, add spaces on both sides. The spaces - // are ignored by markdown renderers. - if (std::string_ref(R).start_with("`") || std::string_ref(R).end_with("`")) - return "` " + std::move(R) + " `"; - // Markdown render should ignore first and last space if both are there. We - // add an extra pair of spaces in that case to make sure we render what the - // user intended. - if (std::string_ref(R).start_with(" ") && std::string_ref(R).end_with(" ")) - return "` " + std::move(R) + " `"; - return "`" + std::move(R) + "`"; +std::string_ref renderInlineBlock(std::string_ref const& Input) +{ + std::string_ref R; + // Double all backticks to make sure we don't close the inline block early. + for (size_t From = 0; From < Input.size();) + { + size_t Next = Input.find("`", From); + R += Input.substr(From, Next - From); + if (Next == std::string_ref::npos) + { + break; + } + R += "``"; // double the found backtick. + + From = Next + 1; + } + // If results starts with a backtick, add spaces on both sides. The spaces + // are ignored by markdown renderers. + if (std::string_ref(R).start_with("`") || std::string_ref(R).end_with("`")) + { + return "` " + std::move(R) + " `"; + } + // Markdown render should ignore first and last space if both are there. We + // add an extra pair of spaces in that case to make sure we render what the + // user intended. + if (std::string_ref(R).start_with(" ") && std::string_ref(R).end_with(" ")) + { + return "` " + std::move(R) + " `"; + } + return "`" + std::move(R) + "`"; } /// Get marker required for \p Input to represent a markdown codeblock. It /// consists of at least 3 backticks(`). Although markdown also allows to use /// tilde(~) for code blocks, they are never used. - std::string_ref getMarkerForCodeBlock(const std::string_ref& Input) { - // Count the maximum number of consecutive backticks in \p Input. We need to - // start and end the code block with more. - unsigned MaxBackticks = 0; - unsigned Backticks = 0; - for (char C : Input) { - if (C == '`') { - ++Backticks; - continue; - } - MaxBackticks = std::max(MaxBackticks, Backticks); - Backticks = 0; - } - MaxBackticks = std::max(Backticks, MaxBackticks); - // Use the corresponding number of backticks to start and end a code block. - return std::string_ref(/*Repeat=*/std::max(3u, MaxBackticks + 1), '`'); -} - - /// SplitString - Split up the specified string according to the specified -/// delimiters, appending the result fragments to the output list. - void SplitString(const std::string& Source, - std::vector<std::string_ref>& OutFragments, - std::string Delimiters = " \t\n\v\f\r") +std::string_ref getMarkerForCodeBlock(std::string_ref const& Input) { - boost::split(OutFragments, Source, boost::is_any_of(Delimiters)); + // Count the maximum number of consecutive backticks in \p Input. We need to + // start and end the code block with more. + unsigned MaxBackticks = 0; + unsigned Backticks = 0; + for (char C : Input) + { + if (C == '`') + { + ++Backticks; + continue; + } + MaxBackticks = std::max(MaxBackticks, Backticks); + Backticks = 0; + } + MaxBackticks = std::max(Backticks, MaxBackticks); + // Use the corresponding number of backticks to start and end a code block. + return std::string_ref(/*Repeat=*/std::max(3u, MaxBackticks + 1), '`'); } +/// SplitString - Split up the specified string according to the specified +/// delimiters, appending the result fragments to the output list. +void SplitString( + std::string const& Source, std::vector<std::string_ref>& OutFragments, std::string Delimiters = " \t\n\v\f\r" +) +{ + boost::split(OutFragments, Source, boost::is_any_of(Delimiters)); +} // Trims the input and concatenates whitespace blocks into a single ` `. - std::string_ref canonicalizeSpaces(const std::string_ref& Input) { - std::vector<std::string_ref> Words; - SplitString(Input, Words); - - return lsp::join(Words, " "); -} - - - std::string_ref renderBlocks( std::vector<Block*>&& Children, - void (Block::* RenderFunc)(std::ostringstream&) const) { - std::string_ref R; - std::ostringstream OS(R); - - std::vector<int> v{ 1, 2, 3 }; - - // Trim rulers. - Children.erase(std::remove_if(Children.begin(), Children.end(), [](const Block* C) - { - return C->isRuler(); - }), Children.end()); - - bool LastBlockWasRuler = true; - for (const auto& C : Children) { - if (C->isRuler() && LastBlockWasRuler) - continue; - LastBlockWasRuler = C->isRuler(); - ((*C).*RenderFunc)(OS); - } - - // Get rid of redundant empty lines introduced in plaintext while imitating - // padding in markdown. - std::string_ref AdjustedResult; - std::string_ref TrimmedText(OS.str()); - TrimmedText = TrimmedText.trim(); - - std::copy_if(TrimmedText.begin(), TrimmedText.end(), - std::back_inserter(AdjustedResult), - [&TrimmedText](const char& C) { - return !std::string_ref(TrimmedText.data(), - &C - TrimmedText.data() + 1) - // We allow at most two newlines. - .end_with("\n\n\n"); - }); - - return AdjustedResult; - }; - std::string_ref renderBlocks(const std::vector<std::unique_ptr<Block> >& children, - void (Block::* renderFunc)(std::ostringstream&) const) - { - std::vector<Block*> temp(children.size(), nullptr); - for(size_t i = 0 ; i < children.size() ; ++i) +std::string_ref canonicalizeSpaces(std::string_ref const& Input) +{ + std::vector<std::string_ref> Words; + SplitString(Input, Words); + + return lsp::join(Words, " "); +} + +std::string_ref renderBlocks(std::vector<Block*>&& Children, void (Block::*RenderFunc)(std::ostringstream&) const) +{ + std::string_ref R; + std::ostringstream OS(R); + + std::vector<int> v {1, 2, 3}; + + // Trim rulers. + Children.erase( + std::remove_if(Children.begin(), Children.end(), [](Block const* C) { return C->isRuler(); }), Children.end() + ); + + bool LastBlockWasRuler = true; + for (auto const& C : Children) + { + if (C->isRuler() && LastBlockWasRuler) + { + continue; + } + LastBlockWasRuler = C->isRuler(); + ((*C).*RenderFunc)(OS); + } + + // Get rid of redundant empty lines introduced in plaintext while imitating + // padding in markdown. + std::string_ref AdjustedResult; + std::string_ref TrimmedText(OS.str()); + TrimmedText = TrimmedText.trim(); + + std::copy_if( + TrimmedText.begin(), TrimmedText.end(), std::back_inserter(AdjustedResult), + [&TrimmedText](char const& C) { - temp[i]=(children[i].get()); + return !std::string_ref(TrimmedText.data(), &C - TrimmedText.data() + 1) + // We allow at most two newlines. + .end_with("\n\n\n"); } + ); + + return AdjustedResult; +}; +std::string_ref renderBlocks( + std::vector<std::unique_ptr<Block>> const& children, void (Block::*renderFunc)(std::ostringstream&) const +) +{ + std::vector<Block*> temp(children.size(), nullptr); + for (size_t i = 0; i < children.size(); ++i) + { + temp[i] = (children[i].get()); + } return renderBlocks(std::move(temp), renderFunc); - } +} // Separates two blocks with extra spacing. Note that it might render strangely // in vscode if the trailing block is a codeblock, see // https://github.com/microsoft/vscode/issues/88416 for details. -class Ruler : public Block { +class Ruler : public Block +{ public: - void renderMarkdown(std::ostringstream &OS) const override { - // Note that we need an extra new line before the ruler, otherwise we might - // make previous block a title instead of introducing a ruler. - OS << "\n---\n"; - } - void renderPlainText(std::ostringstream &OS) const override { OS << '\n'; } - std::unique_ptr<Block> clone() const override { - return std::make_unique<Ruler>(*this); - } - bool isRuler() const override { return true; } + void renderMarkdown(std::ostringstream& OS) const override + { + // Note that we need an extra new line before the ruler, otherwise we might + // make previous block a title instead of introducing a ruler. + OS << "\n---\n"; + } + void renderPlainText(std::ostringstream& OS) const override + { + OS << '\n'; + } + std::unique_ptr<Block> clone() const override + { + return std::make_unique<Ruler>(*this); + } + bool isRuler() const override + { + return true; + } }; -class CodeBlock : public Block { +class CodeBlock : public Block +{ public: - void renderMarkdown(std::ostringstream &OS) const override { - std::string_ref Marker = getMarkerForCodeBlock(Contents); - // No need to pad from previous blocks, as they should end with a new line. - OS << Marker << Language << '\n' << Contents << '\n' << Marker << '\n'; - } + void renderMarkdown(std::ostringstream& OS) const override + { + std::string_ref Marker = getMarkerForCodeBlock(Contents); + // No need to pad from previous blocks, as they should end with a new line. + OS << Marker << Language << '\n' << Contents << '\n' << Marker << '\n'; + } - void renderPlainText(std::ostringstream &OS) const override { - // In plaintext we want one empty line before and after codeblocks. - OS << '\n' << Contents << "\n\n"; - } + void renderPlainText(std::ostringstream& OS) const override + { + // In plaintext we want one empty line before and after codeblocks. + OS << '\n' << Contents << "\n\n"; + } - std::unique_ptr<Block> clone() const override { - return std::make_unique<CodeBlock>(*this); - } + std::unique_ptr<Block> clone() const override + { + return std::make_unique<CodeBlock>(*this); + } - CodeBlock( std::string_ref Contents, std::string_ref Language) - : Contents(std::move(Contents)), Language(std::move(Language)) {} + CodeBlock(std::string_ref Contents, std::string_ref Language) + : Contents(std::move(Contents)), Language(std::move(Language)) + { + } private: - - std::string_ref Contents; - std::string_ref Language; + std::string_ref Contents; + std::string_ref Language; }; // Inserts two spaces after each `\n` to indent each line. First line is not // indented. - std::string_ref indentLines(const std::string_ref& Input) { - assert(!Input.end_with("\n") && "Input should've been trimmed."); - std::string_ref IndentedR; - // We'll add 2 spaces after each new line. - IndentedR.reserve(Input.size() + Input.count("\n") * 2); - for (char C : Input) { - IndentedR += C; - if (C == '\n') - IndentedR.append(" "); - } - return IndentedR; -} - -class Heading : public Paragraph { +std::string_ref indentLines(std::string_ref const& Input) +{ + assert(!Input.end_with("\n") && "Input should've been trimmed."); + std::string_ref IndentedR; + // We'll add 2 spaces after each new line. + IndentedR.reserve(Input.size() + Input.count("\n") * 2); + for (char C : Input) + { + IndentedR += C; + if (C == '\n') + { + IndentedR.append(" "); + } + } + return IndentedR; +} + +class Heading : public Paragraph +{ public: - Heading(size_t Level) : Level(Level) {} - void renderMarkdown(std::ostringstream &OS) const override { - OS << std::string_ref(Level, '#') << ' '; - Paragraph::renderMarkdown(OS); - } + Heading(size_t Level) : Level(Level) + { + } + void renderMarkdown(std::ostringstream& OS) const override + { + OS << std::string_ref(Level, '#') << ' '; + Paragraph::renderMarkdown(OS); + } private: - size_t Level; + size_t Level; }; +std::string_ref Block::asMarkdown() const +{ + std::string_ref R; + std::ostringstream OS(R); + renderMarkdown(OS); + return std::string_ref(OS.str()).trim(); +} + +std::string_ref Block::asPlainText() const +{ + std::string_ref R; + std::ostringstream OS(R); + renderPlainText(OS); + return std::string_ref(OS.str()).trim().c_str(); +} + +void Paragraph::renderMarkdown(std::ostringstream& OS) const +{ + bool NeedsSpace = false; + bool HasChunks = false; + for (auto& C : Chunks) + { + if (C.SpaceBefore || NeedsSpace) + { + OS << " "; + } + switch (C.Kind) + { + case Chunk::PlainText: + OS << renderText(C.Contents, !HasChunks); + break; + case Chunk::InlineCode: + OS << renderInlineBlock(C.Contents); + break; + } + HasChunks = true; + NeedsSpace = C.SpaceAfter; + } + // Paragraphs are translated into markdown lines, not markdown paragraphs. + // Therefore it only has a single linebreak afterwards. + // VSCode requires two spaces at the end of line to start a new one. + OS << " \n"; +} + +std::unique_ptr<Block> Paragraph::clone() const +{ + return std::make_unique<Paragraph>(*this); +} + +/// Choose a marker to delimit `Text` from a prioritized list of options. +/// This is more readable than escaping for plain-text. +std::string_ref chooseMarker(std::vector<std::string_ref> Options, std::string_ref const& Text) +{ + // Prefer a delimiter whose characters don't appear in the text. + for (std::string_ref& S : Options) + { + if (Text.find_first_of(S) == std::string_ref::npos) + { + return S; + } + } + return Options.front(); +} + +void Paragraph::renderPlainText(std::ostringstream& OS) const +{ + bool NeedsSpace = false; + for (auto& C : Chunks) + { + if (C.SpaceBefore || NeedsSpace) + { + OS << " "; + } + std::string_ref Marker = ""; + if (C.Preserve && C.Kind == Chunk::InlineCode) + { + Marker = chooseMarker({"`", "'", "\""}, C.Contents); + } + OS << Marker << C.Contents << Marker; + NeedsSpace = C.SpaceAfter; + } + OS << '\n'; +} + +void BulletList::renderMarkdown(std::ostringstream& OS) const +{ + for (auto& D : Items) + { + // Instead of doing this we might prefer passing Indent to children to get + // rid of the copies, if it turns out to be a bottleneck. + + OS << "- "; + OS << indentLines(D.asMarkdown()) << '\n'; + } + // We need a new line after list to terminate it in markdown. + OS << '\n'; +} + +void BulletList::renderPlainText(std::ostringstream& OS) const +{ + for (auto& D : Items) + { + // Instead of doing this we might prefer passing Indent to children to get + // rid of the copies, if it turns out to be a bottleneck. + OS << "- " << indentLines(D.asPlainText()) << '\n'; + } +} + +Paragraph& Paragraph::appendSpace() +{ + if (!Chunks.empty()) + { + Chunks.back().SpaceAfter = true; + } + return *this; +} + +Paragraph& Paragraph::appendText(std::string_ref const& Text) +{ + std::string_ref Norm = canonicalizeSpaces(Text); + if (Norm.empty()) + { + return *this; + } + Chunks.emplace_back(); + Chunk& C = Chunks.back(); + C.Contents = std::move(Norm); + C.Kind = Chunk::PlainText; + + C.SpaceBefore = std::isspace(Text.front()); + C.SpaceAfter = std::isspace(Text.back()); + return *this; +} + +Paragraph& Paragraph::appendCode(std::string_ref const& Code, bool Preserve) +{ + bool AdjacentCode = !Chunks.empty() && Chunks.back().Kind == Chunk::InlineCode; + std::string_ref Norm = canonicalizeSpaces(Code); + if (Norm.empty()) + { + return *this; + } + Chunks.emplace_back(); + Chunk& C = Chunks.back(); + C.Contents = std::move(Norm); + C.Kind = Chunk::InlineCode; + C.Preserve = Preserve; + // Disallow adjacent code spans without spaces, markdown can't render them. + C.SpaceBefore = AdjacentCode; + return *this; +} + +std::unique_ptr<Block> BulletList::clone() const +{ + return std::make_unique<BulletList>(*this); +} + +class Document& BulletList::addItem() +{ + Items.emplace_back(); + return Items.back(); +} +Document& Document::operator=(Document const& Other) +{ + Children.clear(); + for (auto const& C : Other.Children) + { + Children.push_back(C->clone()); + } + return *this; +} +void Document::append(Document Other) +{ + std::move(Other.Children.begin(), Other.Children.end(), std::back_inserter(Children)); +} +Paragraph& Document::addParagraph() +{ + Children.push_back(std::make_unique<Paragraph>()); + return *static_cast<Paragraph*>(Children.back().get()); +} + +void Document::addRuler() +{ + Children.push_back(std::make_unique<Ruler>()); +} - std::string_ref Block::asMarkdown() const { - std::string_ref R; - std::ostringstream OS(R); - renderMarkdown(OS); - return std::string_ref(OS.str()).trim(); -} - - std::string_ref Block::asPlainText() const { - std::string_ref R; - std::ostringstream OS(R); - renderPlainText(OS); - return std::string_ref(OS.str()).trim().c_str(); -} - - void Paragraph::renderMarkdown(std::ostringstream& OS) const { - bool NeedsSpace = false; - bool HasChunks = false; - for (auto& C : Chunks) { - if (C.SpaceBefore || NeedsSpace) - OS << " "; - switch (C.Kind) { - case Chunk::PlainText: - OS << renderText(C.Contents, !HasChunks); - break; - case Chunk::InlineCode: - OS << renderInlineBlock(C.Contents); - break; - } - HasChunks = true; - NeedsSpace = C.SpaceAfter; - } - // Paragraphs are translated into markdown lines, not markdown paragraphs. - // Therefore it only has a single linebreak afterwards. - // VSCode requires two spaces at the end of line to start a new one. - OS << " \n"; - } - - std::unique_ptr<Block> Paragraph::clone() const { - return std::make_unique<Paragraph>(*this); - } - - /// Choose a marker to delimit `Text` from a prioritized list of options. - /// This is more readable than escaping for plain-text. - std::string_ref chooseMarker(std::vector<std::string_ref> Options, - const std::string_ref& Text) - { - // Prefer a delimiter whose characters don't appear in the text. - for (std::string_ref& S : Options) - if (Text.find_first_of(S) == std::string_ref::npos) - return S; - return Options.front(); - } - - void Paragraph::renderPlainText(std::ostringstream& OS) const { - bool NeedsSpace = false; - for (auto& C : Chunks) { - if (C.SpaceBefore || NeedsSpace) - OS << " "; - std::string_ref Marker = ""; - if (C.Preserve && C.Kind == Chunk::InlineCode) - Marker = chooseMarker({ "`", "'", "\"" }, C.Contents); - OS << Marker << C.Contents << Marker; - NeedsSpace = C.SpaceAfter; - } - OS << '\n'; - } - - void BulletList::renderMarkdown(std::ostringstream& OS) const { - for (auto& D : Items) { - // Instead of doing this we might prefer passing Indent to children to get - // rid of the copies, if it turns out to be a bottleneck. - - OS << "- "; - OS << indentLines(D.asMarkdown()) << '\n'; - } - // We need a new line after list to terminate it in markdown. - OS << '\n'; - } - - void BulletList::renderPlainText(std::ostringstream& OS) const { - for (auto& D : Items) { - // Instead of doing this we might prefer passing Indent to children to get - // rid of the copies, if it turns out to be a bottleneck. - OS << "- " << indentLines(D.asPlainText()) << '\n'; - } - } - - Paragraph& Paragraph::appendSpace() { - if (!Chunks.empty()) - Chunks.back().SpaceAfter = true; - return *this; - } - - Paragraph& Paragraph::appendText(const std::string_ref& Text) { - std::string_ref Norm = canonicalizeSpaces(Text); - if (Norm.empty()) - return *this; - Chunks.emplace_back(); - Chunk& C = Chunks.back(); - C.Contents = std::move(Norm); - C.Kind = Chunk::PlainText; - - C.SpaceBefore = std::isspace(Text.front()); - C.SpaceAfter = std::isspace(Text.back()); - return *this; - } - - Paragraph& Paragraph::appendCode(const std::string_ref& Code, bool Preserve) { - bool AdjacentCode = - !Chunks.empty() && Chunks.back().Kind == Chunk::InlineCode; - std::string_ref Norm = canonicalizeSpaces(Code); - if (Norm.empty()) - return *this; - Chunks.emplace_back(); - Chunk& C = Chunks.back(); - C.Contents = std::move(Norm); - C.Kind = Chunk::InlineCode; - C.Preserve = Preserve; - // Disallow adjacent code spans without spaces, markdown can't render them. - C.SpaceBefore = AdjacentCode; - return *this; - } - - std::unique_ptr<Block> BulletList::clone() const { - return std::make_unique<BulletList>(*this); - } - - class Document& BulletList::addItem() { - Items.emplace_back(); - return Items.back(); - } - - Document& Document::operator=(const Document& Other) { - Children.clear(); - for (const auto& C : Other.Children) - Children.push_back(C->clone()); - return *this; - } - - void Document::append(Document Other) { - std::move(Other.Children.begin(), Other.Children.end(), - std::back_inserter(Children)); - } - - Paragraph& Document::addParagraph() { - Children.push_back(std::make_unique<Paragraph>()); - return *static_cast<Paragraph*>(Children.back().get()); - } - - void Document::addRuler() { Children.push_back(std::make_unique<Ruler>()); } - - void Document::addCodeBlock(std::string_ref Code, std::string_ref Language) { - Children.emplace_back( - std::make_unique<CodeBlock>(std::move(Code), std::move(Language))); - } - - std::string_ref Document::asMarkdown() const { - return renderBlocks(Children, &Block::renderMarkdown); - } - - std::string_ref Document::asPlainText() const { - return renderBlocks(Children, &Block::renderPlainText); - } - - BulletList& Document::addBulletList() { - Children.emplace_back(std::make_unique<BulletList>()); - return *static_cast<BulletList*>(Children.back().get()); - } - - Paragraph& Document::addHeading(size_t Level) { - assert(Level > 0); - Children.emplace_back(std::make_unique<Heading>(Level)); - return *static_cast<Paragraph*>(Children.back().get()); - } - }; +void Document::addCodeBlock(std::string_ref Code, std::string_ref Language) +{ + Children.emplace_back(std::make_unique<CodeBlock>(std::move(Code), std::move(Language))); +} + +std::string_ref Document::asMarkdown() const +{ + return renderBlocks(Children, &Block::renderMarkdown); +} + +std::string_ref Document::asPlainText() const +{ + return renderBlocks(Children, &Block::renderPlainText); +} + +BulletList& Document::addBulletList() +{ + Children.emplace_back(std::make_unique<BulletList>()); + return *static_cast<BulletList*>(Children.back().get()); +} + +Paragraph& Document::addHeading(size_t Level) +{ + assert(Level > 0); + Children.emplace_back(std::make_unique<Heading>(Level)); + return *static_cast<Paragraph*>(Children.back().get()); +} +}; // namespace lsp diff --git a/graphics/asymptote/LspCpp/src/lsp/ParentProcessWatcher.cpp b/graphics/asymptote/LspCpp/src/lsp/ParentProcessWatcher.cpp index c698a3157e..ee4147b76b 100644 --- a/graphics/asymptote/LspCpp/src/lsp/ParentProcessWatcher.cpp +++ b/graphics/asymptote/LspCpp/src/lsp/ParentProcessWatcher.cpp @@ -3,7 +3,7 @@ #include <boost/process.hpp> #ifdef _WIN32 -#include <boost/process/windows.hpp> +#include <boost/process/v1/windows.hpp> #endif #include <boost/filesystem.hpp> @@ -13,95 +13,103 @@ #include "LibLsp/lsp/ProcessIoService.h" #include "LibLsp/lsp/SimpleTimer.h" - using namespace boost::asio::ip; using namespace std; struct ParentProcessWatcher::ParentProcessWatcherData : std::enable_shared_from_this<ParentProcessWatcherData> { - std::unique_ptr<SimpleTimer<boost::posix_time::seconds>> timer; - lsp::Log& _log; - std::function<void()> on_exit; - lsp::ProcessIoService asio_io; - std::shared_ptr < boost::process::opstream> write_to_service; - std::shared_ptr< boost::process::ipstream > read_from_service; - int pid; - const int _poll_delay_secs /*= 10*/; - std::string command; - std::shared_ptr<boost::process::child> c; + std::unique_ptr<SimpleTimer<boost::posix_time::seconds>> timer; + lsp::Log& _log; + std::function<void()> on_exit; + lsp::ProcessIoService asio_io; + std::shared_ptr<boost::process::opstream> write_to_service; + std::shared_ptr<boost::process::ipstream> read_from_service; + int pid; + int const _poll_delay_secs /*= 10*/; + std::string command; + std::shared_ptr<boost::process::child> c; - ParentProcessWatcherData(lsp::Log& log, int _pid, - const std::function<void()>&& callback, uint32_t poll_delay_secs) : - _log(log), on_exit(callback), pid(_pid), _poll_delay_secs(poll_delay_secs) - { + ParentProcessWatcherData(lsp::Log& log, int _pid, std::function<void()> const&& callback, uint32_t poll_delay_secs) + : _log(log), on_exit(callback), pid(_pid), _poll_delay_secs(poll_delay_secs) + { #ifdef _WIN32 - command = "cmd /c \"tasklist /FI \"PID eq " + std::to_string(pid) + "\" | findstr " + - std::to_string(pid) + "\""; + command = + "cmd /c \"tasklist /FI \"PID eq " + std::to_string(pid) + "\" | findstr " + std::to_string(pid) + "\""; #else - command = "ps -p " + std::to_string(pid); + command = "ps -p " + std::to_string(pid); #endif + } - } - - void run() - { - write_to_service = std::make_shared<boost::process::opstream>(); - read_from_service = std::make_shared<boost::process::ipstream>(); + void run() + { + write_to_service = std::make_shared<boost::process::opstream>(); + read_from_service = std::make_shared<boost::process::ipstream>(); -// const uint32_t POLL_DELAY_SECS = _poll_delay_secs; - auto self(shared_from_this()); - std::error_code ec; - namespace bp = boost::process; - c = std::make_shared<bp::child>(asio_io.getIOService(), command, - ec, + // const uint32_t POLL_DELAY_SECS = _poll_delay_secs; + auto self(shared_from_this()); + std::error_code ec; + namespace bp = boost::process; + c = std::make_shared<bp::child>( + asio_io.getIOService(), command, ec, #ifdef _WIN32 - bp::windows::hide, + bp::windows::hide, #endif - bp::std_out > *read_from_service, - bp::std_in < *write_to_service, - bp::on_exit([self](int exit_code, const std::error_code& ec_in) { - // the tasklist command should return 0 (parent process exists) or 1 (parent process doesn't exist) - if (exit_code == 1)// - { - if (self->on_exit) - { + bp::std_out > *read_from_service, bp::std_in < *write_to_service, + bp::on_exit( + [self](int exit_code, std::error_code const&) + { + // the tasklist command should return 0 (parent process exists) or 1 (parent process doesn't exist) + if (exit_code == 1) // + { + if (self->on_exit) + { - std::thread([=]() - { - std::this_thread::sleep_for(std::chrono::seconds(3)); - self->on_exit(); - }).detach(); - } - } - else + std::thread( + [=]() { - if (exit_code > 1) - { - self->_log.log(lsp::Log::Level::WARNING, "The tasklist command: '" + self->command + "' returns " + std::to_string(exit_code)); - } - - self->timer = std::make_unique<SimpleTimer<boost::posix_time::seconds>>(self->_poll_delay_secs, [=]() { - self->run(); - }); + std::this_thread::sleep_for(std::chrono::seconds(3)); + self->on_exit(); } + ).detach(); + } + } + else + { + if (exit_code > 1) + { + self->_log.log( + lsp::Log::Level::WARNING, + "The tasklist command: '" + self->command + "' returns " + std::to_string(exit_code) + ); + } - })); - if (ec) - { - // fail - _log.log(lsp::Log::Level::SEVERE, "Start parent process watcher failed."); + self->timer = std::make_unique<SimpleTimer<boost::posix_time::seconds>>( + self->_poll_delay_secs, [=]() { self->run(); } + ); + } } + ) + ); + if (ec) + { + // fail + _log.log(lsp::Log::Level::SEVERE, "Start parent process watcher failed."); } + } }; -ParentProcessWatcher::ParentProcessWatcher(lsp::Log& log, int pid, - const std::function<void()>&& callback, uint32_t poll_delay_secs) : d_ptr(new ParentProcessWatcherData(log, pid, std::move(callback), poll_delay_secs)) +ParentProcessWatcher::ParentProcessWatcher( + lsp::Log& log, int pid, std::function<void()> const&& callback, uint32_t poll_delay_secs +) + : d_ptr(new ParentProcessWatcherData(log, pid, std::move(callback), poll_delay_secs)) { - d_ptr->run(); + d_ptr->run(); } ParentProcessWatcher::~ParentProcessWatcher() { - if (d_ptr->timer) - d_ptr->timer->Stop(); + if (d_ptr->timer) + { + d_ptr->timer->Stop(); + } } diff --git a/graphics/asymptote/LspCpp/src/lsp/ProtocolJsonHandler.cpp b/graphics/asymptote/LspCpp/src/lsp/ProtocolJsonHandler.cpp index c860b555af..123a580c5c 100644 --- a/graphics/asymptote/LspCpp/src/lsp/ProtocolJsonHandler.cpp +++ b/graphics/asymptote/LspCpp/src/lsp/ProtocolJsonHandler.cpp @@ -5,7 +5,6 @@ #include "LibLsp/lsp/textDocument/code_lens.h" #include "LibLsp/lsp/textDocument/completion.h" - #include "LibLsp/lsp/textDocument/did_close.h" #include "LibLsp/lsp/textDocument/highlight.h" @@ -70,647 +69,639 @@ #include "LibLsp/lsp/textDocument/semanticHighlighting.h" #include "LibLsp/lsp/workspace/configuration.h" - void AddStadardResponseJsonRpcMethod(MessageJsonHandler& handler) { - handler.method2response[td_initialize::request::kMethodInfo] = [](Reader& visitor) - { - if(visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - - return td_initialize::response::ReflectReader(visitor); - }; - - handler.method2response[td_shutdown::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_shutdown::response::ReflectReader(visitor); - }; - handler.method2response[td_codeAction::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - - return td_codeAction::response::ReflectReader(visitor); - }; - handler.method2response[td_codeLens::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_codeLens::response::ReflectReader(visitor); - }; - handler.method2response[td_completion::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_completion::response::ReflectReader(visitor); - }; - - handler.method2response[td_definition::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_definition::response::ReflectReader(visitor); - }; - handler.method2response[td_declaration::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_declaration::response::ReflectReader(visitor); - }; - handler.method2response[td_willSaveWaitUntil::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_willSaveWaitUntil::response::ReflectReader(visitor); - }; - - handler.method2response[td_highlight::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_highlight::response::ReflectReader(visitor); - }; - - handler.method2response[td_links::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_links::response::ReflectReader(visitor); - }; - - handler.method2response[td_linkResolve::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_linkResolve::response::ReflectReader(visitor); - }; - - handler.method2response[td_symbol::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_symbol::response::ReflectReader(visitor); - }; - - handler.method2response[td_formatting::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_formatting::response::ReflectReader(visitor); - }; - - handler.method2response[td_hover::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_hover::response::ReflectReader(visitor); - - }; - - handler.method2response[td_implementation::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_implementation::response::ReflectReader(visitor); - }; - - handler.method2response[td_rangeFormatting::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_rangeFormatting::response::ReflectReader(visitor); - }; - - handler.method2response[td_references::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_references::response::ReflectReader(visitor); - }; - - handler.method2response[td_rename::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_rename::response::ReflectReader(visitor); - }; - - - handler.method2response[td_signatureHelp::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_signatureHelp::response::ReflectReader(visitor); - }; - - handler.method2response[td_typeDefinition::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_typeDefinition::response::ReflectReader(visitor); - }; - - handler.method2response[wp_executeCommand::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return wp_executeCommand::response::ReflectReader(visitor); - }; - - handler.method2response[wp_symbol::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return wp_symbol::response::ReflectReader(visitor); - }; - handler.method2response[td_typeHierarchy::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_typeHierarchy::response::ReflectReader(visitor); - }; - handler.method2response[completionItem_resolve::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return completionItem_resolve::response::ReflectReader(visitor); - }; - - handler.method2response[codeLens_resolve::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - - return codeLens_resolve::response::ReflectReader(visitor); - - }; - - handler.method2response[td_colorPresentation::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - - return td_colorPresentation::response::ReflectReader(visitor); - - }; - handler.method2response[td_documentColor::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - - return td_documentColor::response::ReflectReader(visitor); - - }; - handler.method2response[td_foldingRange::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - - return td_foldingRange::response::ReflectReader(visitor); - - }; - handler.method2response[td_prepareRename::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - - return td_prepareRename::response::ReflectReader(visitor); - - }; - handler.method2response[typeHierarchy_resolve::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - - return typeHierarchy_resolve::response::ReflectReader(visitor); - - }; - - handler.method2response[td_selectionRange::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - - return td_selectionRange::response::ReflectReader(visitor); - - }; - handler.method2response[td_didRenameFiles::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - - return td_didRenameFiles::response::ReflectReader(visitor); - - }; - handler.method2response[td_willRenameFiles::request::kMethodInfo] = [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - - return td_willRenameFiles::response::ReflectReader(visitor); - - }; - + handler.method2response[td_initialize::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + + return td_initialize::response::ReflectReader(visitor); + }; + + handler.method2response[td_shutdown::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_shutdown::response::ReflectReader(visitor); + }; + handler.method2response[td_codeAction::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + + return td_codeAction::response::ReflectReader(visitor); + }; + handler.method2response[td_codeLens::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_codeLens::response::ReflectReader(visitor); + }; + handler.method2response[td_completion::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_completion::response::ReflectReader(visitor); + }; + + handler.method2response[td_definition::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_definition::response::ReflectReader(visitor); + }; + handler.method2response[td_declaration::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_declaration::response::ReflectReader(visitor); + }; + handler.method2response[td_willSaveWaitUntil::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_willSaveWaitUntil::response::ReflectReader(visitor); + }; + + handler.method2response[td_highlight::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_highlight::response::ReflectReader(visitor); + }; + + handler.method2response[td_links::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_links::response::ReflectReader(visitor); + }; + + handler.method2response[td_linkResolve::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_linkResolve::response::ReflectReader(visitor); + }; + + handler.method2response[td_symbol::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_symbol::response::ReflectReader(visitor); + }; + + handler.method2response[td_formatting::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_formatting::response::ReflectReader(visitor); + }; + + handler.method2response[td_hover::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_hover::response::ReflectReader(visitor); + }; + + handler.method2response[td_implementation::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_implementation::response::ReflectReader(visitor); + }; + + handler.method2response[td_rangeFormatting::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_rangeFormatting::response::ReflectReader(visitor); + }; + + handler.method2response[td_references::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_references::response::ReflectReader(visitor); + }; + + handler.method2response[td_rename::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_rename::response::ReflectReader(visitor); + }; + + handler.method2response[td_signatureHelp::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_signatureHelp::response::ReflectReader(visitor); + }; + + handler.method2response[td_typeDefinition::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_typeDefinition::response::ReflectReader(visitor); + }; + + handler.method2response[wp_executeCommand::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return wp_executeCommand::response::ReflectReader(visitor); + }; + + handler.method2response[wp_symbol::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return wp_symbol::response::ReflectReader(visitor); + }; + handler.method2response[td_typeHierarchy::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return td_typeHierarchy::response::ReflectReader(visitor); + }; + handler.method2response[completionItem_resolve::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + return completionItem_resolve::response::ReflectReader(visitor); + }; + + handler.method2response[codeLens_resolve::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + + return codeLens_resolve::response::ReflectReader(visitor); + }; + + handler.method2response[td_colorPresentation::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + + return td_colorPresentation::response::ReflectReader(visitor); + }; + handler.method2response[td_documentColor::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + + return td_documentColor::response::ReflectReader(visitor); + }; + handler.method2response[td_foldingRange::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + + return td_foldingRange::response::ReflectReader(visitor); + }; + handler.method2response[td_prepareRename::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + + return td_prepareRename::response::ReflectReader(visitor); + }; + handler.method2response[typeHierarchy_resolve::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + + return typeHierarchy_resolve::response::ReflectReader(visitor); + }; + + handler.method2response[td_selectionRange::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + + return td_selectionRange::response::ReflectReader(visitor); + }; + handler.method2response[td_didRenameFiles::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + + return td_didRenameFiles::response::ReflectReader(visitor); + }; + handler.method2response[td_willRenameFiles::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) + { + return Rsp_Error::ReflectReader(visitor); + } + + return td_willRenameFiles::response::ReflectReader(visitor); + }; } - void AddJavaExtentionResponseJsonRpcMethod(MessageJsonHandler& handler) { - handler.method2response[java_classFileContents::request::kMethodInfo] = [](Reader& visitor) + handler.method2response[java_classFileContents::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_classFileContents::response::ReflectReader(visitor); - }; - handler.method2response[java_buildWorkspace::request::kMethodInfo] = [](Reader& visitor) + return java_classFileContents::response::ReflectReader(visitor); + }; + handler.method2response[java_buildWorkspace::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_buildWorkspace::response::ReflectReader(visitor); - }; - handler.method2response[java_listOverridableMethods::request::kMethodInfo] = [](Reader& visitor) + return java_buildWorkspace::response::ReflectReader(visitor); + }; + handler.method2response[java_listOverridableMethods::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_listOverridableMethods::response::ReflectReader(visitor); - }; - handler.method2response[java_listOverridableMethods::request::kMethodInfo] = [](Reader& visitor) + return java_listOverridableMethods::response::ReflectReader(visitor); + }; + handler.method2response[java_listOverridableMethods::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_listOverridableMethods::response::ReflectReader(visitor); - }; + return java_listOverridableMethods::response::ReflectReader(visitor); + }; - handler.method2response[java_checkHashCodeEqualsStatus::request::kMethodInfo] = [](Reader& visitor) + handler.method2response[java_checkHashCodeEqualsStatus::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - - return java_checkHashCodeEqualsStatus::response::ReflectReader(visitor); - }; + return Rsp_Error::ReflectReader(visitor); + } + return java_checkHashCodeEqualsStatus::response::ReflectReader(visitor); + }; - handler.method2response[java_addOverridableMethods::request::kMethodInfo] = [](Reader& visitor) + handler.method2response[java_addOverridableMethods::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_addOverridableMethods::response::ReflectReader(visitor); - }; + return java_addOverridableMethods::response::ReflectReader(visitor); + }; - handler.method2response[java_checkConstructorsStatus::request::kMethodInfo] = [](Reader& visitor) + handler.method2response[java_checkConstructorsStatus::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_checkConstructorsStatus::response::ReflectReader(visitor); - }; + return java_checkConstructorsStatus::response::ReflectReader(visitor); + }; - - handler.method2response[java_checkDelegateMethodsStatus::request::kMethodInfo] = [](Reader& visitor) + handler.method2response[java_checkDelegateMethodsStatus::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_checkDelegateMethodsStatus::response::ReflectReader(visitor); - }; - handler.method2response[java_checkToStringStatus::request::kMethodInfo] = [](Reader& visitor) + return java_checkDelegateMethodsStatus::response::ReflectReader(visitor); + }; + handler.method2response[java_checkToStringStatus::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - - return java_checkToStringStatus::response::ReflectReader(visitor); - }; + return Rsp_Error::ReflectReader(visitor); + } + return java_checkToStringStatus::response::ReflectReader(visitor); + }; - handler.method2response[java_generateAccessors::request::kMethodInfo] = [](Reader& visitor) + handler.method2response[java_generateAccessors::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_generateAccessors::response::ReflectReader(visitor); - }; - handler.method2response[java_generateConstructors::request::kMethodInfo] = [](Reader& visitor) + return java_generateAccessors::response::ReflectReader(visitor); + }; + handler.method2response[java_generateConstructors::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_generateConstructors::response::ReflectReader(visitor); - }; - handler.method2response[java_generateDelegateMethods::request::kMethodInfo] = [](Reader& visitor) + return java_generateConstructors::response::ReflectReader(visitor); + }; + handler.method2response[java_generateDelegateMethods::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_generateDelegateMethods::response::ReflectReader(visitor); - }; + return java_generateDelegateMethods::response::ReflectReader(visitor); + }; - handler.method2response[java_generateHashCodeEquals::request::kMethodInfo] = [](Reader& visitor) + handler.method2response[java_generateHashCodeEquals::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_generateHashCodeEquals::response::ReflectReader(visitor); - }; - handler.method2response[java_generateToString::request::kMethodInfo] = [](Reader& visitor) + return java_generateHashCodeEquals::response::ReflectReader(visitor); + }; + handler.method2response[java_generateToString::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_generateToString::response::ReflectReader(visitor); - }; + return java_generateToString::response::ReflectReader(visitor); + }; - handler.method2response[java_generateToString::request::kMethodInfo] = [](Reader& visitor) + handler.method2response[java_generateToString::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_generateToString::response::ReflectReader(visitor); - }; + return java_generateToString::response::ReflectReader(visitor); + }; - handler.method2response[java_getMoveDestinations::request::kMethodInfo] = [](Reader& visitor) + handler.method2response[java_getMoveDestinations::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_getMoveDestinations::response::ReflectReader(visitor); - }; + return java_getMoveDestinations::response::ReflectReader(visitor); + }; - handler.method2response[java_getRefactorEdit::request::kMethodInfo] = [](Reader& visitor) + handler.method2response[java_getRefactorEdit::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_getRefactorEdit::response::ReflectReader(visitor); - }; + return java_getRefactorEdit::response::ReflectReader(visitor); + }; - handler.method2response[java_move::request::kMethodInfo] = [](Reader& visitor) + handler.method2response[java_move::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_move::response ::ReflectReader(visitor); - }; + return java_move::response ::ReflectReader(visitor); + }; - handler.method2response[java_organizeImports::request::kMethodInfo] = [](Reader& visitor) + handler.method2response[java_organizeImports::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_organizeImports::response::ReflectReader(visitor); - }; + return java_organizeImports::response::ReflectReader(visitor); + }; - handler.method2response[java_resolveUnimplementedAccessors::request::kMethodInfo] = [](Reader& visitor) + handler.method2response[java_resolveUnimplementedAccessors::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_resolveUnimplementedAccessors::response::ReflectReader(visitor); - }; + return java_resolveUnimplementedAccessors::response::ReflectReader(visitor); + }; - handler.method2response[java_searchSymbols::request::kMethodInfo] = [](Reader& visitor) + handler.method2response[java_searchSymbols::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); + return Rsp_Error::ReflectReader(visitor); + } - return java_searchSymbols::response::ReflectReader(visitor); - }; - - handler.method2request[WorkspaceConfiguration::request::kMethodInfo] = [](Reader& visitor) - { - return WorkspaceConfiguration::request::ReflectReader(visitor); - }; - handler.method2request[WorkspaceFolders::request::kMethodInfo] = [](Reader& visitor) - { - return WorkspaceFolders::request::ReflectReader(visitor); - }; + return java_searchSymbols::response::ReflectReader(visitor); + }; + handler.method2request[WorkspaceConfiguration::request::kMethodInfo] = [](Reader& visitor) + { return WorkspaceConfiguration::request::ReflectReader(visitor); }; + handler.method2request[WorkspaceFolders::request::kMethodInfo] = [](Reader& visitor) + { return WorkspaceFolders::request::ReflectReader(visitor); }; } void AddNotifyJsonRpcMethod(MessageJsonHandler& handler) { - handler.method2notification[Notify_Exit::notify::kMethodInfo] = [](Reader& visitor) - { - return Notify_Exit::notify::ReflectReader(visitor); - }; - handler.method2notification[Notify_InitializedNotification::notify::kMethodInfo] = [](Reader& visitor) - { - return Notify_InitializedNotification::notify::ReflectReader(visitor); - }; - - handler.method2notification[java_projectConfigurationUpdate::notify::kMethodInfo] = [](Reader& visitor) - { - return java_projectConfigurationUpdate::notify::ReflectReader(visitor); - }; - - handler.method2notification[Notify_TextDocumentDidChange::notify::kMethodInfo] = [](Reader& visitor) - { - return Notify_TextDocumentDidChange::notify::ReflectReader(visitor); - }; - - handler.method2notification[Notify_TextDocumentDidClose::notify::kMethodInfo] = [](Reader& visitor) - { - return Notify_TextDocumentDidClose::notify::ReflectReader(visitor); - }; - - - handler.method2notification[Notify_TextDocumentDidOpen::notify::kMethodInfo] = [](Reader& visitor) - { - return Notify_TextDocumentDidOpen::notify::ReflectReader(visitor); - }; - - handler.method2notification[Notify_TextDocumentDidSave::notify::kMethodInfo] = [](Reader& visitor) - { - return Notify_TextDocumentDidSave::notify::ReflectReader(visitor); - }; - - handler.method2notification[Notify_TextDocumentPublishDiagnostics::notify::kMethodInfo] = [](Reader& visitor) - { - return Notify_TextDocumentPublishDiagnostics::notify::ReflectReader(visitor); - }; - handler.method2notification[Notify_semanticHighlighting::notify::kMethodInfo] = [](Reader& visitor) - { - return Notify_semanticHighlighting::notify::ReflectReader(visitor); - }; - handler.method2notification[td_willSave::notify::kMethodInfo] = [](Reader& visitor) - { - return td_willSave::notify::ReflectReader(visitor); - }; - - handler.method2notification[Notify_LogMessage::notify::kMethodInfo] = [](Reader& visitor) - { - return Notify_LogMessage::notify::ReflectReader(visitor); - }; - handler.method2notification[Notify_ShowMessage::notify::kMethodInfo] = [](Reader& visitor) - { - return Notify_ShowMessage::notify::ReflectReader(visitor); - }; - handler.method2notification[Notify_WorkspaceDidChangeWorkspaceFolders::notify::kMethodInfo] = [](Reader& visitor) - { - return Notify_WorkspaceDidChangeWorkspaceFolders::notify::ReflectReader(visitor); - }; - - handler.method2notification[Notify_WorkspaceDidChangeConfiguration::notify::kMethodInfo] = [](Reader& visitor) - { - return Notify_WorkspaceDidChangeConfiguration::notify::ReflectReader(visitor); - }; - - - handler.method2notification[Notify_WorkspaceDidChangeWatchedFiles::notify::kMethodInfo] = [](Reader& visitor) - { - return Notify_WorkspaceDidChangeWatchedFiles::notify::ReflectReader(visitor); - }; - - handler.method2notification[Notify_sendNotification::notify::kMethodInfo] = [](Reader& visitor) - { - return Notify_sendNotification::notify::ReflectReader(visitor); - }; - handler.method2notification[lang_status::notify::kMethodInfo] = [](Reader& visitor) - { - return lang_status::notify::ReflectReader(visitor); - }; - handler.method2notification[lang_actionableNotification::notify::kMethodInfo] = [](Reader& visitor) - { - return lang_actionableNotification::notify::ReflectReader(visitor); - }; - handler.method2notification[lang_progressReport::notify::kMethodInfo] = [](Reader& visitor) - { - return lang_progressReport::notify::ReflectReader(visitor); - }; - handler.method2notification[lang_eventNotification::notify::kMethodInfo] = [](Reader& visitor) - { - return lang_eventNotification::notify::ReflectReader(visitor); - }; + handler.method2notification[Notify_Exit::notify::kMethodInfo] = [](Reader& visitor) + { return Notify_Exit::notify::ReflectReader(visitor); }; + handler.method2notification[Notify_InitializedNotification::notify::kMethodInfo] = [](Reader& visitor) + { return Notify_InitializedNotification::notify::ReflectReader(visitor); }; + + handler.method2notification[java_projectConfigurationUpdate::notify::kMethodInfo] = [](Reader& visitor) + { return java_projectConfigurationUpdate::notify::ReflectReader(visitor); }; + + handler.method2notification[Notify_TextDocumentDidChange::notify::kMethodInfo] = [](Reader& visitor) + { return Notify_TextDocumentDidChange::notify::ReflectReader(visitor); }; + + handler.method2notification[Notify_TextDocumentDidClose::notify::kMethodInfo] = [](Reader& visitor) + { return Notify_TextDocumentDidClose::notify::ReflectReader(visitor); }; + + handler.method2notification[Notify_TextDocumentDidOpen::notify::kMethodInfo] = [](Reader& visitor) + { return Notify_TextDocumentDidOpen::notify::ReflectReader(visitor); }; + + handler.method2notification[Notify_TextDocumentDidSave::notify::kMethodInfo] = [](Reader& visitor) + { return Notify_TextDocumentDidSave::notify::ReflectReader(visitor); }; + + handler.method2notification[Notify_TextDocumentPublishDiagnostics::notify::kMethodInfo] = [](Reader& visitor) + { return Notify_TextDocumentPublishDiagnostics::notify::ReflectReader(visitor); }; + handler.method2notification[Notify_semanticHighlighting::notify::kMethodInfo] = [](Reader& visitor) + { return Notify_semanticHighlighting::notify::ReflectReader(visitor); }; + handler.method2notification[td_willSave::notify::kMethodInfo] = [](Reader& visitor) + { return td_willSave::notify::ReflectReader(visitor); }; + + handler.method2notification[Notify_LogMessage::notify::kMethodInfo] = [](Reader& visitor) + { return Notify_LogMessage::notify::ReflectReader(visitor); }; + handler.method2notification[Notify_ShowMessage::notify::kMethodInfo] = [](Reader& visitor) + { return Notify_ShowMessage::notify::ReflectReader(visitor); }; + handler.method2notification[Notify_WorkspaceDidChangeWorkspaceFolders::notify::kMethodInfo] = [](Reader& visitor) + { return Notify_WorkspaceDidChangeWorkspaceFolders::notify::ReflectReader(visitor); }; + + handler.method2notification[Notify_WorkspaceDidChangeConfiguration::notify::kMethodInfo] = [](Reader& visitor) + { return Notify_WorkspaceDidChangeConfiguration::notify::ReflectReader(visitor); }; + + handler.method2notification[Notify_WorkspaceDidChangeWatchedFiles::notify::kMethodInfo] = [](Reader& visitor) + { return Notify_WorkspaceDidChangeWatchedFiles::notify::ReflectReader(visitor); }; + + handler.method2notification[Notify_sendNotification::notify::kMethodInfo] = [](Reader& visitor) + { return Notify_sendNotification::notify::ReflectReader(visitor); }; + handler.method2notification[lang_status::notify::kMethodInfo] = [](Reader& visitor) + { return lang_status::notify::ReflectReader(visitor); }; + handler.method2notification[lang_actionableNotification::notify::kMethodInfo] = [](Reader& visitor) + { return lang_actionableNotification::notify::ReflectReader(visitor); }; + handler.method2notification[lang_progressReport::notify::kMethodInfo] = [](Reader& visitor) + { return lang_progressReport::notify::ReflectReader(visitor); }; + handler.method2notification[lang_eventNotification::notify::kMethodInfo] = [](Reader& visitor) + { return lang_eventNotification::notify::ReflectReader(visitor); }; } void AddRequstJsonRpcMethod(MessageJsonHandler& handler) { - handler.method2request[Req_ClientRegisterCapability::request::kMethodInfo]= [](Reader& visitor) - { - - return Req_ClientRegisterCapability::request::ReflectReader(visitor); - }; - handler.method2request[Req_ClientUnregisterCapability::request::kMethodInfo] = [](Reader& visitor) - { - - return Req_ClientUnregisterCapability::request::ReflectReader(visitor); - }; + handler.method2request[Req_ClientRegisterCapability::request::kMethodInfo] = [](Reader& visitor) + { return Req_ClientRegisterCapability::request::ReflectReader(visitor); }; + handler.method2request[Req_ClientUnregisterCapability::request::kMethodInfo] = [](Reader& visitor) + { return Req_ClientUnregisterCapability::request::ReflectReader(visitor); }; } void AddStandardRequestJsonRpcMethod(MessageJsonHandler& handler) { - handler.method2request[td_initialize::request::kMethodInfo] = [](Reader& visitor) - { - - return td_initialize::request::ReflectReader(visitor); - }; - handler.method2request[td_shutdown::request::kMethodInfo] = [](Reader& visitor) - { - - return td_shutdown::request::ReflectReader(visitor); - }; - handler.method2request[td_codeAction::request::kMethodInfo] = [](Reader& visitor) - { - - - return td_codeAction::request::ReflectReader(visitor); - }; - handler.method2request[td_codeLens::request::kMethodInfo] = [](Reader& visitor) - { - - return td_codeLens::request::ReflectReader(visitor); - }; - handler.method2request[td_completion::request::kMethodInfo] = [](Reader& visitor) - { - - return td_completion::request::ReflectReader(visitor); - }; - - handler.method2request[td_definition::request::kMethodInfo] = [](Reader& visitor) - { - - return td_definition::request::ReflectReader(visitor); - }; - handler.method2request[td_declaration::request::kMethodInfo] = [](Reader& visitor) - { + handler.method2request[td_initialize::request::kMethodInfo] = [](Reader& visitor) + { return td_initialize::request::ReflectReader(visitor); }; + handler.method2request[td_shutdown::request::kMethodInfo] = [](Reader& visitor) + { return td_shutdown::request::ReflectReader(visitor); }; + handler.method2request[td_codeAction::request::kMethodInfo] = [](Reader& visitor) + { return td_codeAction::request::ReflectReader(visitor); }; + handler.method2request[td_codeLens::request::kMethodInfo] = [](Reader& visitor) + { return td_codeLens::request::ReflectReader(visitor); }; + handler.method2request[td_completion::request::kMethodInfo] = [](Reader& visitor) + { return td_completion::request::ReflectReader(visitor); }; - return td_declaration::request::ReflectReader(visitor); - }; - handler.method2request[td_willSaveWaitUntil::request::kMethodInfo] = [](Reader& visitor) + handler.method2request[td_definition::request::kMethodInfo] = [](Reader& visitor) + { return td_definition::request::ReflectReader(visitor); }; + handler.method2request[td_declaration::request::kMethodInfo] = [](Reader& visitor) + { return td_declaration::request::ReflectReader(visitor); }; + handler.method2request[td_willSaveWaitUntil::request::kMethodInfo] = [](Reader& visitor) + { + if (visitor.HasMember("error")) { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return td_willSaveWaitUntil::request::ReflectReader(visitor); - }; - - handler.method2request[td_highlight::request::kMethodInfo] = [](Reader& visitor) - { - - return td_highlight::request::ReflectReader(visitor); - }; + return Rsp_Error::ReflectReader(visitor); + } + return td_willSaveWaitUntil::request::ReflectReader(visitor); + }; - handler.method2request[td_links::request::kMethodInfo] = [](Reader& visitor) - { + handler.method2request[td_highlight::request::kMethodInfo] = [](Reader& visitor) + { return td_highlight::request::ReflectReader(visitor); }; - return td_links::request::ReflectReader(visitor); - }; + handler.method2request[td_links::request::kMethodInfo] = [](Reader& visitor) + { return td_links::request::ReflectReader(visitor); }; - handler.method2request[td_linkResolve::request::kMethodInfo] = [](Reader& visitor) - { + handler.method2request[td_linkResolve::request::kMethodInfo] = [](Reader& visitor) + { return td_linkResolve::request::ReflectReader(visitor); }; - return td_linkResolve::request::ReflectReader(visitor); - }; + handler.method2request[td_symbol::request::kMethodInfo] = [](Reader& visitor) + { return td_symbol::request::ReflectReader(visitor); }; - handler.method2request[td_symbol::request::kMethodInfo] = [](Reader& visitor) - { + handler.method2request[td_formatting::request::kMethodInfo] = [](Reader& visitor) + { return td_formatting::request::ReflectReader(visitor); }; - return td_symbol::request::ReflectReader(visitor); - }; + handler.method2request[td_hover::request::kMethodInfo] = [](Reader& visitor) + { return td_hover::request::ReflectReader(visitor); }; - handler.method2request[td_formatting::request::kMethodInfo] = [](Reader& visitor) - { + handler.method2request[td_implementation::request::kMethodInfo] = [](Reader& visitor) + { return td_implementation::request::ReflectReader(visitor); }; - return td_formatting::request::ReflectReader(visitor); - }; + handler.method2request[td_didRenameFiles::request::kMethodInfo] = [](Reader& visitor) + { return td_didRenameFiles::request::ReflectReader(visitor); }; - handler.method2request[td_hover::request::kMethodInfo] = [](Reader& visitor) - { - return td_hover::request::ReflectReader(visitor); - }; - - handler.method2request[td_implementation::request::kMethodInfo] = [](Reader& visitor) - { - - return td_implementation::request::ReflectReader(visitor); - }; - - handler.method2request[td_didRenameFiles::request::kMethodInfo] = [](Reader& visitor) - { - - return td_didRenameFiles::request::ReflectReader(visitor); - }; - - handler.method2request[td_willRenameFiles::request::kMethodInfo] = [](Reader& visitor) - { - return td_willRenameFiles::request::ReflectReader(visitor); - }; + handler.method2request[td_willRenameFiles::request::kMethodInfo] = [](Reader& visitor) + { return td_willRenameFiles::request::ReflectReader(visitor); }; } - lsp::ProtocolJsonHandler::ProtocolJsonHandler() { - AddStadardResponseJsonRpcMethod(*this); - AddJavaExtentionResponseJsonRpcMethod(*this); - AddNotifyJsonRpcMethod(*this); - AddStandardRequestJsonRpcMethod(*this); - AddRequstJsonRpcMethod(*this); + AddStadardResponseJsonRpcMethod(*this); + AddJavaExtentionResponseJsonRpcMethod(*this); + AddNotifyJsonRpcMethod(*this); + AddStandardRequestJsonRpcMethod(*this); + AddRequstJsonRpcMethod(*this); } diff --git a/graphics/asymptote/LspCpp/src/lsp/initialize.cpp b/graphics/asymptote/LspCpp/src/lsp/initialize.cpp index 504caa3e65..82f68701ca 100644 --- a/graphics/asymptote/LspCpp/src/lsp/initialize.cpp +++ b/graphics/asymptote/LspCpp/src/lsp/initialize.cpp @@ -3,43 +3,49 @@ void Reflect(Reader& reader, lsInitializeParams::lsTrace& value) { - if (!reader.IsString()) - { - value = lsInitializeParams::lsTrace::Off; - return; - } - std::string v = reader.GetString(); - if (v == "off") - value = lsInitializeParams::lsTrace::Off; - else if (v == "messages") - value = lsInitializeParams::lsTrace::Messages; - else if (v == "verbose") - value = lsInitializeParams::lsTrace::Verbose; + if (!reader.IsString()) + { + value = lsInitializeParams::lsTrace::Off; + return; + } + std::string v = reader.GetString(); + if (v == "off") + { + value = lsInitializeParams::lsTrace::Off; + } + else if (v == "messages") + { + value = lsInitializeParams::lsTrace::Messages; + } + else if (v == "verbose") + { + value = lsInitializeParams::lsTrace::Verbose; + } } void Reflect(Writer& writer, lsInitializeParams::lsTrace& value) { - switch (value) - { - case lsInitializeParams::lsTrace::Off: - writer.String("off"); - break; - case lsInitializeParams::lsTrace::Messages: - writer.String("messages"); - break; - case lsInitializeParams::lsTrace::Verbose: - writer.String("verbose"); - break; - } + switch (value) + { + case lsInitializeParams::lsTrace::Off: + writer.String("off"); + break; + case lsInitializeParams::lsTrace::Messages: + writer.String("messages"); + break; + case lsInitializeParams::lsTrace::Verbose: + writer.String("verbose"); + break; + } } - void Reflect(Reader& visitor, std::pair<optional<lsTextDocumentSyncKind>, optional<lsTextDocumentSyncOptions> >& value) +void Reflect(Reader& visitor, std::pair<optional<lsTextDocumentSyncKind>, optional<lsTextDocumentSyncOptions>>& value) { - if(((JsonReader&)visitor).m_->IsObject()) - { - Reflect(visitor, value.second); - } - else - { - Reflect(visitor, value.first); - } + if (((JsonReader&)visitor).m_->IsObject()) + { + Reflect(visitor, value.second); + } + else + { + Reflect(visitor, value.first); + } } diff --git a/graphics/asymptote/LspCpp/src/lsp/lsp.cpp b/graphics/asymptote/LspCpp/src/lsp/lsp.cpp index d070f22be1..964d1ba8cd 100644 --- a/graphics/asymptote/LspCpp/src/lsp/lsp.cpp +++ b/graphics/asymptote/LspCpp/src/lsp/lsp.cpp @@ -2,10 +2,8 @@ #include "LibLsp/lsp/lru_cache.h" - #include <rapidjson/writer.h> - #include <stdio.h> #include <iostream> #include "LibLsp/lsp/location_type.h" @@ -25,6 +23,9 @@ #include "LibLsp/lsp/AbsolutePath.h" #ifdef _WIN32 +#ifndef NOMINMAX +#define NOMINMAX +#endif #include <Windows.h> #else #include <climits> @@ -46,399 +47,415 @@ #include <boost/uuid/uuid_generators.hpp> // namespace - - -lsTextDocumentIdentifier -lsVersionedTextDocumentIdentifier::AsTextDocumentIdentifier() const { - lsTextDocumentIdentifier result; - result.uri = uri; - return result; +lsTextDocumentIdentifier lsVersionedTextDocumentIdentifier::AsTextDocumentIdentifier() const +{ + lsTextDocumentIdentifier result; + result.uri = uri; + return result; } +lsPosition::lsPosition() +{ +} +lsPosition::lsPosition(int line, int character) : line(line), character(character) +{ +} -lsPosition::lsPosition() {} -lsPosition::lsPosition(int line, int character) - : line(line), character(character) {} - -bool lsPosition::operator==(const lsPosition& other) const { - return line == other.line && character == other.character; +bool lsPosition::operator==(lsPosition const& other) const +{ + return line == other.line && character == other.character; } -bool lsPosition::operator<(const lsPosition& other) const { - return line != other.line ? line < other.line : character < other.character; +bool lsPosition::operator<(lsPosition const& other) const +{ + return line != other.line ? line < other.line : character < other.character; } -std::string lsPosition::ToString() const { - return std::to_string(line) + ":" + std::to_string(character); +std::string lsPosition::ToString() const +{ + return std::to_string(line) + ":" + std::to_string(character); } -const lsPosition lsPosition::kZeroPosition = lsPosition(); +lsPosition const lsPosition::kZeroPosition = lsPosition(); -lsRange::lsRange() {} -lsRange::lsRange(lsPosition start, lsPosition end) : start(start), end(end) {} +lsRange::lsRange() +{ +} +lsRange::lsRange(lsPosition start, lsPosition end) : start(start), end(end) +{ +} -bool lsRange::operator==(const lsRange& o) const { - return start == o.start && end == o.end; +bool lsRange::operator==(lsRange const& o) const +{ + return start == o.start && end == o.end; } -bool lsRange::operator<(const lsRange& o) const { - return !(start == o.start) ? start < o.start : end < o.end; +bool lsRange::operator<(lsRange const& o) const +{ + return !(start == o.start) ? start < o.start : end < o.end; } std::string lsRange::ToString() const { - std::stringstream ss; - ss << "start:" << start.ToString() << std::endl; - ss << "end" << end.ToString() << std::endl; - return ss.str(); + std::stringstream ss; + ss << "start:" << start.ToString() << std::endl; + ss << "end" << end.ToString() << std::endl; + return ss.str(); } -lsLocation::lsLocation() {} -lsLocation::lsLocation(lsDocumentUri uri, lsRange range) - : uri(uri), range(range) {} - -bool lsLocation::operator==(const lsLocation& o) const { - return uri == o.uri && range == o.range; +lsLocation::lsLocation() +{ +} +lsLocation::lsLocation(lsDocumentUri uri, lsRange range) : uri(uri), range(range) +{ } -bool lsLocation::operator<(const lsLocation& o) const { - return std::make_tuple(uri.raw_uri_, range) < - std::make_tuple(o.uri.raw_uri_, o.range); +bool lsLocation::operator==(lsLocation const& o) const +{ + return uri == o.uri && range == o.range; } -bool lsTextEdit::operator==(const lsTextEdit& that) { - return range == that.range && newText == that.newText; +bool lsLocation::operator<(lsLocation const& o) const +{ + return std::make_tuple(uri.raw_uri_, range) < std::make_tuple(o.uri.raw_uri_, o.range); } -std::string lsTextEdit::ToString() const +bool lsTextEdit::operator==(lsTextEdit const& that) { - std::stringstream ss; - ss << "Range:" << range.ToString() << std::endl; - ss << "newText:" << newText << std::endl; - return ss.str(); + return range == that.range && newText == that.newText; } -void Reflect(Writer& visitor, lsMarkedString& value) { - // If there is a language, emit a `{language:string, value:string}` object. If - // not, emit a string. - if (value.language) { - REFLECT_MEMBER_START(); - REFLECT_MEMBER(language); - REFLECT_MEMBER(value); - REFLECT_MEMBER_END(); - } else { - Reflect(visitor, value.value); - } +std::string lsTextEdit::ToString() const +{ + std::stringstream ss; + ss << "Range:" << range.ToString() << std::endl; + ss << "newText:" << newText << std::endl; + return ss.str(); } -void Reflect(Reader& visitor, lsMarkedString& value) +void Reflect(Writer& visitor, lsMarkedString& value) { + // If there is a language, emit a `{language:string, value:string}` object. If + // not, emit a string. + if (value.language) + { REFLECT_MEMBER_START(); REFLECT_MEMBER(language); REFLECT_MEMBER(value); REFLECT_MEMBER_END(); + } + else + { + Reflect(visitor, value.value); + } } - void Reflect(Reader& visitor, LocationListEither::Either& value) +void Reflect(Reader& visitor, lsMarkedString& value) { - if(!visitor.IsArray()) - { - throw std::invalid_argument("Rsp_LocationListEither::Either& value is not array"); - } - auto data = ((JsonReader&)visitor).m_->GetArray(); - if (data.Size() && data[0].HasMember("originSelectionRange")) - { - Reflect(visitor, value.second); - } - else { - Reflect(visitor, value.first); - } - + REFLECT_MEMBER_START(); + REFLECT_MEMBER(language); + REFLECT_MEMBER(value); + REFLECT_MEMBER_END(); } - void Reflect(Writer& visitor, LocationListEither::Either& value) +void Reflect(Reader& visitor, LocationListEither::Either& value) { - if (value.first) - { - Reflect(visitor, value.first.value()); - } - else if (value.second) - { - Reflect(visitor, value.second.value()); - } + if (!visitor.IsArray()) + { + throw std::invalid_argument("Rsp_LocationListEither::Either& value is not array"); + } + auto data = ((JsonReader&)visitor).m_->GetArray(); + if (data.Size() && data[0].HasMember("originSelectionRange")) + { + Reflect(visitor, value.second); + } + else + { + Reflect(visitor, value.first); + } +} + +void Reflect(Writer& visitor, LocationListEither::Either& value) +{ + if (value.first) + { + Reflect(visitor, value.first.value()); + } + else if (value.second) + { + Reflect(visitor, value.second.value()); + } } - void Reflect(Reader& visitor, TextDocumentCodeAction::Either& value) { - - if(visitor.HasMember("command")) + if (visitor.HasMember("command")) + { + if (visitor["command"]->IsString()) { - if(visitor["command"]->IsString()) - { - Reflect(visitor, value.first); - } - else - { - Reflect(visitor, value.second); - } + Reflect(visitor, value.first); } else { - if (visitor.HasMember("diagnostics") || visitor.HasMember("edit")) - { - Reflect(visitor, value.second); - } - else - { - Reflect(visitor, value.first); - } + Reflect(visitor, value.second); } - -} - - -void Reflect(Reader& visitor, lsWorkspaceEdit::Either& value) -{ - - - if(visitor.HasMember("textDocument")) + } + else + { + if (visitor.HasMember("diagnostics") || visitor.HasMember("edit")) { - Reflect(visitor, value.first); + Reflect(visitor, value.second); } else { - Reflect(visitor, value.second); + Reflect(visitor, value.first); } + } +} + +void Reflect(Reader& visitor, lsWorkspaceEdit::Either& value) +{ + + if (visitor.HasMember("textDocument")) + { + Reflect(visitor, value.first); + } + else + { + Reflect(visitor, value.second); + } } ResourceOperation* GetResourceOperation(lsp::Any& lspAny) { - rapidjson::Document document; - auto& data = lspAny.Data(); - document.Parse(data.c_str(), data.length()); - if (document.HasParseError()) { - // ��ʾ - return nullptr; - } - auto find = document.FindMember("kind"); + rapidjson::Document document; + auto& data = lspAny.Data(); + document.Parse(data.c_str(), data.length()); + if (document.HasParseError()) + { + // ��ʾ + return nullptr; + } + auto find = document.FindMember("kind"); - JsonReader visitor{ &document }; - try + JsonReader visitor {&document}; + try + { + if (find->value == "create") { - if (find->value == "create") - { - auto ptr = std::make_unique<lsCreateFile>(); - auto temp = ptr.get(); - Reflect(visitor, *temp); - return ptr.release(); - } - else if (find->value == "rename") - { - auto ptr = std::make_unique<lsRenameFile>(); - auto temp = ptr.get(); - Reflect(visitor, *temp); - return ptr.release(); - } - else if (find->value == "delete") - { - - auto ptr = std::make_unique<lsDeleteFile>(); - auto temp = ptr.get(); - Reflect(visitor, *temp); - return ptr.release(); - } + auto ptr = std::make_unique<lsCreateFile>(); + auto temp = ptr.get(); + Reflect(visitor, *temp); + return ptr.release(); } - catch (std::exception&) + else if (find->value == "rename") + { + auto ptr = std::make_unique<lsRenameFile>(); + auto temp = ptr.get(); + Reflect(visitor, *temp); + return ptr.release(); + } + else if (find->value == "delete") { + auto ptr = std::make_unique<lsDeleteFile>(); + auto temp = ptr.get(); + Reflect(visitor, *temp); + return ptr.release(); } - return nullptr; + } + catch (std::exception&) + { + } + return nullptr; } - void Reflect(Writer& visitor, ResourceOperation* value) +void Reflect(Writer& visitor, ResourceOperation* value) { - if(!value) + if (!value) + { + throw std::invalid_argument("ResourceOperation value is nullptr"); + } + if (value->kind == "create") + { + auto temp = (lsCreateFile*)value; + Reflect(visitor, *temp); + } + else if (value->kind == "rename") + { + auto temp = (lsRenameFile*)value; + Reflect(visitor, *temp); + } + else if (value->kind == "delete") + { + + auto temp = (lsDeleteFile*)value; + Reflect(visitor, *temp); + } +} + +int lsp::Any::GuessType() +{ + if (!data.empty()) + { + if (data == "null") { - throw std::invalid_argument("ResourceOperation value is nullptr"); + jsonType = rapidjson::kNullType; } - if (value->kind == "create") + else if (data == "true") { - auto temp = (lsCreateFile*)value; - Reflect(visitor, *temp); + jsonType = rapidjson::kTrueType; } - else if (value->kind == "rename") + else if (data == "false") { - auto temp = (lsRenameFile*)value; - Reflect(visitor, *temp); + jsonType = rapidjson::kFalseType; } - else if (value->kind == "delete") + else if (data[0] == '{') { - - auto temp = (lsDeleteFile*)value; - Reflect(visitor, *temp); + jsonType = rapidjson::kObjectType; } - -} - -int lsp::Any::GuessType() -{ - if (!data.empty()) + else if (data[0] == '[') { - if (data == "null") - { - jsonType = rapidjson::kNullType; - } - else if (data == "true") - { - jsonType = rapidjson::kTrueType; - } - else if(data == "false") - { - jsonType = rapidjson::kFalseType; - } - else if (data[0] == '{') - { - jsonType = rapidjson::kObjectType; - } - else if (data[0] == '[') - { - if (data.size() >= 2 && data[1] == '{') - jsonType = rapidjson::kStringType; - else - jsonType = rapidjson::kArrayType; - } - else if (data[0] == '"') - { - jsonType = rapidjson::kStringType; - } - else - { - jsonType = rapidjson::kNumberType; - } + if (data.size() >= 2 && data[1] == '{') + { + jsonType = rapidjson::kStringType; + } + else + { + jsonType = rapidjson::kArrayType; + } + } + else if (data[0] == '"') + { + jsonType = rapidjson::kStringType; } else { - if (jsonType != kUnKnown) - return jsonType; - jsonType = rapidjson::kNullType; + jsonType = rapidjson::kNumberType; } - return jsonType; + } + else + { + if (jsonType != kUnKnown) + { + return jsonType; + } + jsonType = rapidjson::kNullType; + } + return jsonType; } int lsp::Any::GetType() { - if (jsonType == Type::kUnKnown) + if (jsonType == Type::kUnKnown) + { + if (data.empty()) { - if (data.empty()) - { - jsonType = rapidjson::kNullType; - return jsonType; - } - rapidjson::Document document; - document.Parse(data.c_str(), data.length()); - if (document.HasParseError()) - { - // ��ʾ - return jsonType; - } - jsonType = document.GetType(); + jsonType = rapidjson::kNullType; + return jsonType; } - return jsonType; + rapidjson::Document document; + document.Parse(data.c_str(), data.length()); + if (document.HasParseError()) + { + // ��ʾ + return jsonType; + } + jsonType = document.GetType(); + } + return jsonType; } void lsp::Any::Set(std::unique_ptr<LspMessage> value) { - if (value) - { - jsonType = rapidjson::Type::kObjectType; - data = value->ToJson(); - } - else - { - assert(false); - } + if (value) + { + jsonType = rapidjson::Type::kObjectType; + data = value->ToJson(); + } + else + { + assert(false); + } } void lsp::Any::SetJsonString(std::string&& _data, Type _type) { - jsonType = _type; - data.swap(_data); - GetType(); + jsonType = _type; + data.swap(_data); + GetType(); } -void lsp::Any::SetJsonString(const std::string& _data, Type _type) +void lsp::Any::SetJsonString(std::string const& _data, Type _type) { - jsonType = _type; - data = (_data); - GetType(); + jsonType = _type; + data = (_data); + GetType(); } void lsp::Any::swap(Any& arg) noexcept { - data.swap(arg.data); - const int temp = jsonType; - jsonType = arg.jsonType; - arg.jsonType = temp; + data.swap(arg.data); + int const temp = jsonType; + jsonType = arg.jsonType; + arg.jsonType = temp; } -class JsonReaderForAny : public JsonReader +class JsonReaderForAny : public JsonReader { public: - JsonReaderForAny() - : JsonReader(&document) - { - } - rapidjson::Document document; + JsonReaderForAny() : JsonReader(&document) + { + } + rapidjson::Document document; }; bool lsp::Any::GetForMapHelper(std::string& value) { - return Get(value); + return Get(value); } bool lsp::Any::GetForMapHelper(optional<std::string>& value) { - return Get(value); + return Get(value); } std::unique_ptr<Reader> lsp::Any::GetReader() { - auto reader = new JsonReaderForAny(); - std::unique_ptr<Reader> ret(reader); - reader->document.Parse(data.c_str(), data.length()); - if (reader->document.HasParseError()) - { - return {}; - } - if (jsonType == kUnKnown) - { - jsonType = reader->document.GetType(); - } - return (ret); + auto reader = new JsonReaderForAny(); + std::unique_ptr<Reader> ret(reader); + reader->document.Parse(data.c_str(), data.length()); + if (reader->document.HasParseError()) + { + return {}; + } + if (jsonType == kUnKnown) + { + jsonType = reader->document.GetType(); + } + return (ret); } class JsonWriterForAny : public JsonWriter { public: - rapidjson::StringBuffer output; - rapidjson::Writer<rapidjson::StringBuffer> writer; - JsonWriterForAny():JsonWriter(&writer), writer(output) - { - - } + rapidjson::StringBuffer output; + rapidjson::Writer<rapidjson::StringBuffer> writer; + JsonWriterForAny() : JsonWriter(&writer), writer(output) + { + } }; std::unique_ptr<Writer> lsp::Any::GetWriter() const { - return std::make_unique<JsonWriterForAny>(); + return std::make_unique<JsonWriterForAny>(); } void lsp::Any::SetData(std::unique_ptr<Writer>& writer) { - auto _temp = static_cast<JsonWriterForAny*>(writer.get()); - data = _temp->output.GetString(); - GuessType(); + auto _temp = static_cast<JsonWriterForAny*>(writer.get()); + data = _temp->output.GetString(); + GuessType(); } namespace @@ -467,219 +484,222 @@ namespace } } #endif - lsp::Any::Type convert(rapidjson::Type type) - { - switch (type) - { - case rapidjson::Type::kNullType: - return lsp::Any::Type::kNullType; - case rapidjson::Type::kFalseType: - return lsp::Any::Type::kFalseType; - case rapidjson::Type::kTrueType: - return lsp::Any::Type::kTrueType; - case rapidjson::Type::kObjectType: - return lsp::Any::Type::kObjectType; - case rapidjson::Type::kArrayType: - return lsp::Any::Type::kArrayType; - case rapidjson::Type::kStringType: - return lsp::Any::Type::kStringType; - case rapidjson::Type::kNumberType: - return lsp::Any::Type::kNumberType; - default: - return lsp::Any::Type::kNullType; - } - } -} +lsp::Any::Type convert(rapidjson::Type type) +{ + switch (type) + { + case rapidjson::Type::kNullType: + return lsp::Any::Type::kNullType; + case rapidjson::Type::kFalseType: + return lsp::Any::Type::kFalseType; + case rapidjson::Type::kTrueType: + return lsp::Any::Type::kTrueType; + case rapidjson::Type::kObjectType: + return lsp::Any::Type::kObjectType; + case rapidjson::Type::kArrayType: + return lsp::Any::Type::kArrayType; + case rapidjson::Type::kStringType: + return lsp::Any::Type::kStringType; + case rapidjson::Type::kNumberType: + return lsp::Any::Type::kNumberType; + default: + return lsp::Any::Type::kNullType; + } +} +} // namespace void Reflect(Reader& visitor, lsp::Any& value) { - //if (visitor.IsNull()) { - // visitor.GetNull(); - // value.SetJsonString("", rapidjson::Type::kNullType); - // return; - //}else - //{ - // - //} - JsonReader& json_reader = reinterpret_cast<JsonReader&>(visitor); - value.SetJsonString(visitor.ToString(), convert(json_reader.m_->GetType())); -} - void Reflect(Writer& visitor, lsp::Any& value) - { - JsonWriter& json_writer = reinterpret_cast<JsonWriter&>(visitor); - json_writer.m_->RawValue( value.Data().data(),value.Data().size(),static_cast<rapidjson::Type>(value.GetType())); - - } - void Reflect(Reader& visitor, lsFormattingOptions::KeyData& value) -{ - if (visitor.IsBool()) - { - Reflect(visitor, value._boolean); - } - else if (visitor.IsInt() || visitor.IsInt64() || visitor.IsUint64()) - { - Reflect(visitor, value._integer); - } - else if(visitor.IsString()) - { - Reflect(visitor, value._string); - } -} - void Reflect(Writer& visitor, lsFormattingOptions::KeyData& value) -{ - if (value._boolean.has_value()) - { - Reflect(visitor, value._boolean); - } - else if (value._integer.has_value()) - { - Reflect(visitor, value._integer); - } - else if (value._string.has_value()) - { - Reflect(visitor, value._string); - } + //if (visitor.IsNull()) { + // visitor.GetNull(); + // value.SetJsonString("", rapidjson::Type::kNullType); + // return; + //}else + //{ + // + //} + JsonReader& json_reader = reinterpret_cast<JsonReader&>(visitor); + value.SetJsonString(visitor.ToString(), convert(json_reader.m_->GetType())); +} +void Reflect(Writer& visitor, lsp::Any& value) +{ + JsonWriter& json_writer = reinterpret_cast<JsonWriter&>(visitor); + json_writer.m_->RawValue(value.Data().data(), value.Data().size(), static_cast<rapidjson::Type>(value.GetType())); +} +void Reflect(Reader& visitor, lsFormattingOptions::KeyData& value) +{ + if (visitor.IsBool()) + { + Reflect(visitor, value._boolean); + } + else if (visitor.IsInt() || visitor.IsInt64() || visitor.IsUint64()) + { + Reflect(visitor, value._integer); + } + else if (visitor.IsString()) + { + Reflect(visitor, value._string); + } +} +void Reflect(Writer& visitor, lsFormattingOptions::KeyData& value) +{ + if (value._boolean.has_value()) + { + Reflect(visitor, value._boolean); + } + else if (value._integer.has_value()) + { + Reflect(visitor, value._integer); + } + else if (value._string.has_value()) + { + Reflect(visitor, value._string); + } } lsCreateFile::lsCreateFile() { - kind = "create"; + kind = "create"; } lsDeleteFile::lsDeleteFile() { - kind = "delete"; + kind = "delete"; } lsRenameFile::lsRenameFile() { - kind = "rename"; + kind = "rename"; } - -void Reflect(Reader& visitor, optional< SelectionRange* >& value) +void Reflect(Reader& visitor, optional<SelectionRange*>& value) { - if (visitor.IsNull()) { - visitor.GetNull(); - return; - } + if (visitor.IsNull()) + { + visitor.GetNull(); + return; + } - SelectionRange* entry_value = nullptr; + SelectionRange* entry_value = nullptr; + std::unique_ptr<SelectionRange> ptr = std::make_unique<SelectionRange>(); + SelectionRange* temp = ptr.get(); + Reflect(visitor, *temp); - std::unique_ptr<SelectionRange> ptr = std::make_unique<SelectionRange>(); - SelectionRange* temp = ptr.get(); - Reflect(visitor, *temp); - - entry_value = ptr.release(); - value = (entry_value); - + entry_value = ptr.release(); + value = (entry_value); } void Reflect(Writer& visitor, SelectionRange* value) { - if (!value) - { - throw std::invalid_argument("ResourceOperation value is nullptr"); - } - - Reflect(visitor, *value); - + if (!value) + { + throw std::invalid_argument("ResourceOperation value is nullptr"); + } + Reflect(visitor, *value); } - std::string make_file_scheme_uri(const std::string& absolute_path) +std::string make_file_scheme_uri(std::string const& absolute_path) { - network::uri_builder builder; - builder.scheme("file"); - builder.host(""); - builder.path(absolute_path); - return builder.uri().string(); - //// lsDocumentUri uri; - //// uri.SetPath(absolute_path); - /// return uri.raw_uri_; + network::uri_builder builder; + builder.scheme("file"); + builder.host(""); + builder.path(absolute_path); + return builder.uri().string(); + //// lsDocumentUri uri; + //// uri.SetPath(absolute_path); + /// return uri.raw_uri_; } // static -AbsolutePath AbsolutePath::BuildDoNotUse(const std::string& path) { - AbsolutePath p; - p.path = std::string(path); - return p; +AbsolutePath AbsolutePath::BuildDoNotUse(std::string const& path) +{ + AbsolutePath p; + p.path = std::string(path); + return p; } +AbsolutePath::AbsolutePath() +{ +} -AbsolutePath::AbsolutePath() {} - - - -AbsolutePath::operator std::string() const { - return path; +AbsolutePath::operator std::string() const +{ + return path; } -bool AbsolutePath::operator==(const AbsolutePath& rhs) const { - return path == rhs.path; +bool AbsolutePath::operator==(AbsolutePath const& rhs) const +{ + return path == rhs.path; } -bool AbsolutePath::operator!=(const AbsolutePath& rhs) const { - return path != rhs.path; +bool AbsolutePath::operator!=(AbsolutePath const& rhs) const +{ + return path != rhs.path; } -bool AbsolutePath::operator<(const AbsolutePath& rhs) const +bool AbsolutePath::operator<(AbsolutePath const& rhs) const { - return path < rhs.path; + return path < rhs.path; } -bool AbsolutePath::operator>(const AbsolutePath& rhs) const +bool AbsolutePath::operator>(AbsolutePath const& rhs) const { - return path > rhs.path; + return path > rhs.path; } -void Reflect(Reader& visitor, AbsolutePath& value) { - value.path = visitor.GetString(); +void Reflect(Reader& visitor, AbsolutePath& value) +{ + value.path = visitor.GetString(); } -void Reflect(Writer& visitor, AbsolutePath& value) { - visitor.String(value.path.c_str(), value.path.length()); +void Reflect(Writer& visitor, AbsolutePath& value) +{ + visitor.String(value.path.c_str(), value.path.length()); } -std::ostream& operator<<(std::ostream& out, const AbsolutePath& path) { - out << path.path; - return out; +std::ostream& operator<<(std::ostream& out, AbsolutePath const& path) +{ + out << path.path; + return out; } -lsDocumentUri lsDocumentUri::FromPath(const AbsolutePath& path) { - lsDocumentUri result; - result.SetPath(path); - return result; +lsDocumentUri lsDocumentUri::FromPath(AbsolutePath const& path) +{ + lsDocumentUri result; + result.SetPath(path); + return result; } //void lsDocumentUri::SetPath(const AbsolutePath& path) //{ // raw_uri_ = make_file_scheme_uri(path.path); //} // -void lsDocumentUri::SetPath(const AbsolutePath& path) { - // file:///c%3A/Users/jacob/Desktop/superindex/indexer/full_tests - raw_uri_ = path; - - size_t index = raw_uri_.find(":"); - if (index == 1) { // widows drive letters must always be 1 char - raw_uri_.replace(raw_uri_.begin() + index, raw_uri_.begin() + index + 1, - "%3A"); - } +void lsDocumentUri::SetPath(AbsolutePath const& path) +{ + // file:///c%3A/Users/jacob/Desktop/superindex/indexer/full_tests + raw_uri_ = path; + + size_t index = raw_uri_.find(":"); + if (index == 1) + { // widows drive letters must always be 1 char + raw_uri_.replace(raw_uri_.begin() + index, raw_uri_.begin() + index + 1, "%3A"); + } - // subset of reserved characters from the URI standard - // http://www.ecma-international.org/ecma-262/6.0/#sec-uri-syntax-and-semantics - std::string t; - t.reserve(8 + raw_uri_.size()); + // subset of reserved characters from the URI standard + // http://www.ecma-international.org/ecma-262/6.0/#sec-uri-syntax-and-semantics + std::string t; + t.reserve(8 + raw_uri_.size()); - // TODO: proper fix + // TODO: proper fix #if defined(_WIN32) - t += "file:///"; + t += "file:///"; #else - t += "file://"; + t += "file://"; #endif - // clang-format off + // clang-format off for (char c : raw_uri_) switch (c) { case ' ': t += "%20"; break; @@ -695,330 +715,379 @@ void lsDocumentUri::SetPath(const AbsolutePath& path) { case '@': t += "%40"; break; default: t += c; break; } - // clang-format on - raw_uri_ = std::move(t); + // clang-format on + raw_uri_ = std::move(t); } -std::string lsDocumentUri::GetRawPath() const { - - - if (raw_uri_.compare(0, 8, "file:///")) - return raw_uri_; +std::string lsDocumentUri::GetRawPath() const +{ + if (raw_uri_.compare(0, 8, "file:///")) + { + return raw_uri_; + } - std::string ret; + std::string ret; #if defined(_WIN32) - size_t i = 8; + size_t i = 8; #else - size_t i = 7; + size_t i = 7; #endif - auto from_hex = [](unsigned char c) { - return c - '0' < 10 ? c - '0' : (c | 32) - 'a' + 10; - }; - for (; i < raw_uri_.size(); i++) { - if (i + 3 <= raw_uri_.size() && raw_uri_[i] == '%') { - ret.push_back(from_hex(raw_uri_[i + 1]) * 16 + from_hex(raw_uri_[i + 2])); - i += 2; - } - else - ret.push_back(raw_uri_[i] == '\\' ? '/' : raw_uri_[i]); + auto from_hex = [](unsigned char const& c) -> unsigned int + { + unsigned char c_from_zero_char = c - '0'; + return c_from_zero_char < 10 ? c_from_zero_char : (c | 32) - 'a' + 10; + }; + for (; i < raw_uri_.size(); i++) + { + if (i + 3 <= raw_uri_.size() && raw_uri_[i] == '%') + { + ret.push_back(static_cast<char>(from_hex(raw_uri_[i + 1]) * 16 + from_hex(raw_uri_[i + 2]))); + i += 2; + } + else + { + ret.push_back(raw_uri_[i] == '\\' ? '/' : raw_uri_[i]); } - return ret; + } + return ret; } -lsDocumentUri::lsDocumentUri() {} - - -lsDocumentUri::lsDocumentUri(const AbsolutePath& path) +lsDocumentUri::lsDocumentUri() { - SetPath(path); } -lsDocumentUri::lsDocumentUri(const lsDocumentUri& other): raw_uri_(other.raw_uri_) +lsDocumentUri::lsDocumentUri(AbsolutePath const& path) { + SetPath(path); } -bool lsDocumentUri::operator==(const lsDocumentUri& other) const { - return raw_uri_ == other.raw_uri_; +lsDocumentUri::lsDocumentUri(lsDocumentUri const& other) : raw_uri_(other.raw_uri_) +{ } -bool lsDocumentUri::operator==(const std::string& other) const +bool lsDocumentUri::operator==(lsDocumentUri const& other) const { - return raw_uri_ == other; + return raw_uri_ == other.raw_uri_; } +bool lsDocumentUri::operator==(std::string const& other) const +{ + return raw_uri_ == other; +} -AbsolutePath lsDocumentUri::GetAbsolutePath() const { - - - if (raw_uri_.find("file://") != std::string::npos){ - try - { - return lsp::NormalizePath(GetRawPath(), false /*ensure_exists*/, false); - } - catch (std::exception&) - { - return AbsolutePath("", false); - } - } +AbsolutePath lsDocumentUri::GetAbsolutePath() const +{ - return AbsolutePath(raw_uri_,false); + if (raw_uri_.find("file://") != std::string::npos) + { + try + { + return lsp::NormalizePath(GetRawPath(), false /*ensure_exists*/, false); + } + catch (std::exception&) + { + return AbsolutePath("", false); + } + } + return AbsolutePath(raw_uri_, false); } -AbsolutePath::AbsolutePath(const std::string& path, bool validate) - : path(path) { - // TODO: enable validation after fixing tests. - if (validate && !lsp::IsAbsolutePath(path)) { - qualify = false; - auto temp = lsp::NormalizePath(path,false); - if(!temp.path.empty()) - { - this->path = temp.path; - } +AbsolutePath::AbsolutePath(std::string const& path, bool validate) : path(path) +{ + // TODO: enable validation after fixing tests. + if (validate && !lsp::IsAbsolutePath(path)) + { + qualify = false; + auto temp = lsp::NormalizePath(path, false); + if (!temp.path.empty()) + { + this->path = temp.path; } + } } -void Reflect(Writer& visitor, lsDocumentUri& value) { - Reflect(visitor, value.raw_uri_); +void Reflect(Writer& visitor, lsDocumentUri& value) +{ + Reflect(visitor, value.raw_uri_); } -void Reflect(Reader& visitor, lsDocumentUri& value) { - Reflect(visitor, value.raw_uri_); - // Only record the path when we deserialize a URI, since it most likely came - // from the client. - +void Reflect(Reader& visitor, lsDocumentUri& value) +{ + Reflect(visitor, value.raw_uri_); + // Only record the path when we deserialize a URI, since it most likely came + // from the client. } - std::string ProgressReport::ToString() const +std::string ProgressReport::ToString() const { - std::string info; - info += "id:" + id + "\n"; - info += "task:" + task + "\n"; - info += "subTask:" + subTask + "\n"; - info += "status:" + status + "\n"; - { - std::stringstream ss; - ss << "totalWork:" << totalWork << std::endl; - info += ss.str(); - } - { - std::stringstream ss; - ss << "workDone:" << workDone << std::endl; - info += ss.str(); - } + std::string info; + info += "id:" + id + "\n"; + info += "task:" + task + "\n"; + info += "subTask:" + subTask + "\n"; + info += "status:" + status + "\n"; + { + std::stringstream ss; + ss << "totalWork:" << totalWork << std::endl; + info += ss.str(); + } + { + std::stringstream ss; + ss << "workDone:" << workDone << std::endl; + info += ss.str(); + } - { - std::stringstream ss; - ss << "complete:" << complete << std::endl; - info += ss.str(); - } + { + std::stringstream ss; + ss << "complete:" << complete << std::endl; + info += ss.str(); + } - return info; + return info; } std::string EventNotification::ToString() const { - std::string info; - if (ClasspathUpdated == eventType) - { - info += "eventType:ClasspathUpdated\n"; - } - else if (ProjectsImported == eventType) - { - info += "eventType:ProjectsImported\n"; - } - else - { - std::ostringstream oss; - oss << std::hex << eventType << std::endl; - - info += "eventType:"; - info += oss.str(); - } - info += "data:" + data.Data() + "\n"; - return info; + std::string info; + if (ClasspathUpdated == eventType) + { + info += "eventType:ClasspathUpdated\n"; + } + else if (ProjectsImported == eventType) + { + info += "eventType:ProjectsImported\n"; + } + else + { + std::ostringstream oss; + oss << std::hex << eventType << std::endl; + + info += "eventType:"; + info += oss.str(); + } + info += "data:" + data.Data() + "\n"; + return info; } std::string lsp::ToString(lsCompletionItemKind _kind) { - switch (_kind) { - case lsCompletionItemKind::Text: - return "Text"; - case lsCompletionItemKind::Method: - return "Method"; - case lsCompletionItemKind::Function: - return ""; - case lsCompletionItemKind::Constructor: - return "Function"; - case lsCompletionItemKind::Field: - return "Field"; - case lsCompletionItemKind::Variable: - return ""; - case lsCompletionItemKind::Class: - return "Variable"; - case lsCompletionItemKind::Interface: - return "Interface"; - case lsCompletionItemKind::Module: - return "Module"; - case lsCompletionItemKind::Property: - return "Property"; - case lsCompletionItemKind::Unit: - return "Unit"; - case lsCompletionItemKind::Value: - return "Value"; - case lsCompletionItemKind::Enum: - return "Enum"; - case lsCompletionItemKind::Keyword: - return "Keyword"; - case lsCompletionItemKind::Snippet: - return "Snippet"; - case lsCompletionItemKind::Color: - return "Color"; - case lsCompletionItemKind::File: - return "File"; - case lsCompletionItemKind::Reference: - return "Reference"; - case lsCompletionItemKind::Folder: - return "Folder"; - case lsCompletionItemKind::EnumMember: - return "EnumMember"; - case lsCompletionItemKind::Constant: - return "Constant"; - case lsCompletionItemKind::Struct: - return "Struct"; - case lsCompletionItemKind::Event: - return "Event"; - case lsCompletionItemKind::Operator: - return "Operator"; - case lsCompletionItemKind::TypeParameter: - return "TypeParameter"; - default: - return "Unknown"; - } + switch (_kind) + { + case lsCompletionItemKind::Text: + return "Text"; + case lsCompletionItemKind::Method: + return "Method"; + case lsCompletionItemKind::Function: + return ""; + case lsCompletionItemKind::Constructor: + return "Function"; + case lsCompletionItemKind::Field: + return "Field"; + case lsCompletionItemKind::Variable: + return ""; + case lsCompletionItemKind::Class: + return "Variable"; + case lsCompletionItemKind::Interface: + return "Interface"; + case lsCompletionItemKind::Module: + return "Module"; + case lsCompletionItemKind::Property: + return "Property"; + case lsCompletionItemKind::Unit: + return "Unit"; + case lsCompletionItemKind::Value: + return "Value"; + case lsCompletionItemKind::Enum: + return "Enum"; + case lsCompletionItemKind::Keyword: + return "Keyword"; + case lsCompletionItemKind::Snippet: + return "Snippet"; + case lsCompletionItemKind::Color: + return "Color"; + case lsCompletionItemKind::File: + return "File"; + case lsCompletionItemKind::Reference: + return "Reference"; + case lsCompletionItemKind::Folder: + return "Folder"; + case lsCompletionItemKind::EnumMember: + return "EnumMember"; + case lsCompletionItemKind::Constant: + return "Constant"; + case lsCompletionItemKind::Struct: + return "Struct"; + case lsCompletionItemKind::Event: + return "Event"; + case lsCompletionItemKind::Operator: + return "Operator"; + case lsCompletionItemKind::TypeParameter: + return "TypeParameter"; + default: + return "Unknown"; + } } std::string lsp::ToString(lsInsertTextFormat _kind) { - if (_kind == lsInsertTextFormat::PlainText) - { - return "PlainText"; - } - else if (_kind == lsInsertTextFormat::Snippet) - { - return "Snippet"; - }else - { - return "Unknown"; - } -} - -const std::string& lsCompletionItem::InsertedContent() const + if (_kind == lsInsertTextFormat::PlainText) + { + return "PlainText"; + } + else if (_kind == lsInsertTextFormat::Snippet) + { + return "Snippet"; + } + else + { + return "Unknown"; + } +} + +std::string const& lsCompletionItem::InsertedContent() const { - if (textEdit) - return textEdit->newText; - if (insertText.has_value() && !insertText->empty()) - return insertText.value(); - return label; + if (textEdit) + { + return textEdit->newText; + } + if (insertText.has_value() && !insertText->empty()) + { + return insertText.value(); + } + return label; } std::string lsCompletionItem::DisplayText() { - if (detail) - { + if (detail) + { - return label + " in " + detail.value(); - } - return label; + return label + " in " + detail.value(); + } + return label; } std::string lsCompletionItem::ToString() - { - std::stringstream info; - info << "label : " << label << std::endl; - if(kind) - info << "kind : " << lsp::ToString(kind.value()) << std::endl; - else - info << "kind : no exist." << std::endl; - - if (detail) - info << "detail : " << detail.value() << std::endl; - else - info << "detail : no exist." << std::endl; - - if (documentation) - { - info << "documentation : " << std::endl; - if(documentation.value().first) - { - info << documentation.value().first.value(); - } - else if(documentation.value().second) - { - info << documentation.value().second.value().value; - } - } - else - info << "documentation : no exist." << std::endl; - - if (deprecated) - info << "deprecated : " << deprecated.value() << std::endl; - else - info << "deprecated : no exist." << std::endl; - - if (preselect) - info << "preselect : " << preselect.value() << std::endl; - else - info << "preselect : no exist." << std::endl; - - if (sortText) - info << "sortText : " << sortText.value() << std::endl; - else - info << "sortText : no exist." << std::endl; - - if (filterText) - info << "filterText : " << filterText.value() << std::endl; - else - info << "filterText : no exist." << std::endl; - - - if (insertText) - info << "insertText : " << insertText.value() << std::endl; - else - info << "insertText : no exist." << std::endl; - - - if (insertTextFormat) - info << "insertText : " << lsp::ToString(insertTextFormat.value()) << std::endl; - else - info << "insertTextFormat : no exist." << std::endl; - - if (textEdit) - info << "textEdit : " << textEdit.value().ToString() << std::endl; - else - info << "textEdit : no exist." << std::endl; - - - - return info.str(); - - } -namespace JDT -{ - namespace CodeActionKind { - - - /** +{ + std::stringstream info; + info << "label : " << label << std::endl; + if (kind) + { + info << "kind : " << lsp::ToString(kind.value()) << std::endl; + } + else + { + info << "kind : no exist." << std::endl; + } + + if (detail) + { + info << "detail : " << detail.value() << std::endl; + } + else + { + info << "detail : no exist." << std::endl; + } + + if (documentation) + { + info << "documentation : " << std::endl; + if (documentation.value().first) + { + info << documentation.value().first.value(); + } + else if (documentation.value().second) + { + info << documentation.value().second.value().value; + } + } + else + { + info << "documentation : no exist." << std::endl; + } + + if (deprecated) + { + info << "deprecated : " << deprecated.value() << std::endl; + } + else + { + info << "deprecated : no exist." << std::endl; + } + + if (preselect) + { + info << "preselect : " << preselect.value() << std::endl; + } + else + { + info << "preselect : no exist." << std::endl; + } + + if (sortText) + { + info << "sortText : " << sortText.value() << std::endl; + } + else + { + info << "sortText : no exist." << std::endl; + } + + if (filterText) + { + info << "filterText : " << filterText.value() << std::endl; + } + else + { + info << "filterText : no exist." << std::endl; + } + + if (insertText) + { + info << "insertText : " << insertText.value() << std::endl; + } + else + { + info << "insertText : no exist." << std::endl; + } + + if (insertTextFormat) + { + info << "insertText : " << lsp::ToString(insertTextFormat.value()) << std::endl; + } + else + { + info << "insertTextFormat : no exist." << std::endl; + } + + if (textEdit) + { + info << "textEdit : " << textEdit.value().ToString() << std::endl; + } + else + { + info << "textEdit : no exist." << std::endl; + } + + return info.str(); +} +namespace JDT +{ +namespace CodeActionKind +{ + + /** * Base kind for quickfix actions: 'quickfix' */ - const char* QuickFix = "quickfix"; + char const* QuickFix = "quickfix"; - /** + /** * Base kind for refactoring actions: 'refactor' */ - const char* Refactor = "refactor"; + char const* Refactor = "refactor"; - /** + /** * Base kind for refactoring extraction actions: 'refactor.extract' * * Example extract actions: @@ -1026,18 +1095,18 @@ namespace JDT * - Extract method - Extract function - Extract variable - Extract interface * from class - ... */ - const char* RefactorExtract = "refactor.extract"; + char const* RefactorExtract = "refactor.extract"; - /** + /** * Base kind for refactoring inline actions: 'refactor.inline' * * Example inline actions: * * - Inline function - Inline variable - Inline constant - ... */ - const char* RefactorInline = "refactor.inline"; + char const* RefactorInline = "refactor.inline"; - /** + /** * Base kind for refactoring rewrite actions: 'refactor.rewrite' * * Example rewrite actions: @@ -1045,45 +1114,45 @@ namespace JDT * - Convert JavaScript function to class - Add or remove parameter - * Encapsulate field - Make method static - Move method to base class - ... */ - const char* RefactorRewrite = "refactor.rewrite"; + char const* RefactorRewrite = "refactor.rewrite"; - /** + /** * Base kind for source actions: `source` * * Source code actions apply to the entire file. */ - const char* Source = "source"; + char const* Source = "source"; - /** + /** * Base kind for an organize imports source action: `source.organizeImports` */ - const char* SourceOrganizeImports = "source.organizeImports"; + char const* SourceOrganizeImports = "source.organizeImports"; - const char* COMMAND_ID_APPLY_EDIT = "java.apply.workspaceEdit"; + char const* COMMAND_ID_APPLY_EDIT = "java.apply.workspaceEdit"; - }; +}; // namespace CodeActionKind - -} -Directory::Directory(const AbsolutePath& path) : path(path.path) { - lsp::EnsureEndsInSlash(this->path); +} // namespace JDT +Directory::Directory(AbsolutePath const& path) : path(path.path) +{ + lsp::EnsureEndsInSlash(this->path); } -bool Directory::operator==(const Directory& rhs) const { - return path == rhs.path; +bool Directory::operator==(Directory const& rhs) const +{ + return path == rhs.path; } -bool Directory::operator!=(const Directory& rhs) const { - return path != rhs.path; +bool Directory::operator!=(Directory const& rhs) const +{ + return path != rhs.path; } - - - Registration Registration::Create(const std::string& method) +Registration Registration::Create(std::string const& method) { - Registration reg; - reg.method = method; - const boost::uuids::uuid a_uuid = boost::uuids::random_generator()(); - reg.id = to_string(a_uuid); - return reg; + Registration reg; + reg.method = method; + boost::uuids::uuid const a_uuid = boost::uuids::random_generator()(); + reg.id = to_string(a_uuid); + return reg; } diff --git a/graphics/asymptote/LspCpp/src/lsp/lsp_diagnostic.cpp b/graphics/asymptote/LspCpp/src/lsp/lsp_diagnostic.cpp index fba0edc30c..308388da37 100644 --- a/graphics/asymptote/LspCpp/src/lsp/lsp_diagnostic.cpp +++ b/graphics/asymptote/LspCpp/src/lsp/lsp_diagnostic.cpp @@ -1,75 +1,78 @@ #include "LibLsp/lsp/lsp_diagnostic.h" -bool lsDiagnostic::operator==(const lsDiagnostic& rhs) const { - // Just check the important fields. - return range == rhs.range && message == rhs.message; +bool lsDiagnostic::operator==(lsDiagnostic const& rhs) const +{ + // Just check the important fields. + return range == rhs.range && message == rhs.message; } -bool lsDiagnostic::operator!=(const lsDiagnostic& rhs) const { - return !(*this == rhs); +bool lsDiagnostic::operator!=(lsDiagnostic const& rhs) const +{ + return !(*this == rhs); } std::string lsResponseError::ToString() { - std::string info = "code:"; - switch (code) - { - case lsErrorCodes::ParseError: - info += "ParseError\n"; - break; - case lsErrorCodes::InvalidRequest: - info += "InvalidRequest\n"; - break; - case lsErrorCodes::MethodNotFound: - info += "MethodNotFound\n"; - break; - case lsErrorCodes::InvalidParams: - info += "InvalidParams\n"; - break; - case lsErrorCodes::InternalError: - info += "InternalError\n"; - break; - case lsErrorCodes::serverErrorStart: - info += "serverErrorStart\n"; - break; - case lsErrorCodes::serverErrorEnd: - info += "serverErrorEnd\n"; - break; - case lsErrorCodes::ServerNotInitialized: - info += "ServerNotInitialized\n"; - break; - case lsErrorCodes::UnknownErrorCode: - info += "UnknownErrorCode\n"; - break; - // Defined by the protocol. - case lsErrorCodes::RequestCancelled: - info += "RequestCancelled\n"; - break; - default: - { - std::stringstream ss; - ss << "unknown code:" << (int32_t)code << std::endl; - info += ss.str(); - } - break; - } - info += "message:" + message; - info += "\n"; + std::string info = "code:"; + switch (code) + { + case lsErrorCodes::ParseError: + info += "ParseError\n"; + break; + case lsErrorCodes::InvalidRequest: + info += "InvalidRequest\n"; + break; + case lsErrorCodes::MethodNotFound: + info += "MethodNotFound\n"; + break; + case lsErrorCodes::InvalidParams: + info += "InvalidParams\n"; + break; + case lsErrorCodes::InternalError: + info += "InternalError\n"; + break; + case lsErrorCodes::serverErrorStart: + info += "serverErrorStart\n"; + break; + case lsErrorCodes::serverErrorEnd: + info += "serverErrorEnd\n"; + break; + case lsErrorCodes::ServerNotInitialized: + info += "ServerNotInitialized\n"; + break; + case lsErrorCodes::UnknownErrorCode: + info += "UnknownErrorCode\n"; + break; + // Defined by the protocol. + case lsErrorCodes::RequestCancelled: + info += "RequestCancelled\n"; + break; + default: + { + std::stringstream ss; + ss << "unknown code:" << (int32_t)code << std::endl; + info += ss.str(); + } + break; + } + info += "message:" + message; + info += "\n"; - if(data.has_value()) - { + if (data.has_value()) + { - info += "data:" + data.value().Data(); - info += "\n"; - } - return info; + info += "data:" + data.value().Data(); + info += "\n"; + } + return info; } -void lsResponseError::Write(Writer& visitor) { - auto& value = *this; - int code2 = static_cast<int>(this->code); +void lsResponseError::Write(Writer& visitor) +{ + auto& value = *this; + int code2 = static_cast<int>(this->code); - visitor.StartObject(); - REFLECT_MEMBER2("code", code2); - REFLECT_MEMBER(message); - visitor.EndObject(); + visitor.StartObject(); + REFLECT_MEMBER2("code", code2); + REFLECT_MEMBER(message); + visitor.EndObject(); } diff --git a/graphics/asymptote/LspCpp/src/lsp/textDocument.cpp b/graphics/asymptote/LspCpp/src/lsp/textDocument.cpp index c87a047d3f..1ff7a3af2d 100644 --- a/graphics/asymptote/LspCpp/src/lsp/textDocument.cpp +++ b/graphics/asymptote/LspCpp/src/lsp/textDocument.cpp @@ -9,341 +9,399 @@ #include "LibLsp/lsp/textDocument/SemanticTokens.h" #include "LibLsp/JsonRpc/json.h" - constexpr unsigned SemanticTokenEncodingSize = 5; std::string to_string(SemanticTokenType _type) { - switch (_type) { + switch (_type) + { - case ls_namespace: return "namespace"; - /** + case ls_namespace: + return "namespace"; + /** * Represents a generic type. Acts as a fallback for types which * can"t be mapped to a specific type like class or enum. */ - case ls_type: return "type"; - case ls_class: return "class"; - case ls_enum: return "enum"; - case ls_interface: return "interface"; - case ls_struct: return "struct"; - case ls_typeParameter: return "typeParameter"; - case ls_parameter: return "parameter"; - case ls_variable: return "variable"; - case ls_property: return "property"; - case ls_enumMember: return "enumMember"; - case ls_event: return "event"; - case ls_function: return "function"; - case ls_method: return "method"; - case ls_macro: return "macro"; - case ls_keyword: return "keyword"; - case ls_modifier: return "modifier"; - case ls_comment: return "comment"; - case ls_string: return "string"; - case ls_number: return "number"; - case ls_regexp: return "regexp"; - case ls_operator: return "operator"; - default: - return "unknown"; - } + case ls_type: + return "type"; + case ls_class: + return "class"; + case ls_enum: + return "enum"; + case ls_interface: + return "interface"; + case ls_struct: + return "struct"; + case ls_typeParameter: + return "typeParameter"; + case ls_parameter: + return "parameter"; + case ls_variable: + return "variable"; + case ls_property: + return "property"; + case ls_enumMember: + return "enumMember"; + case ls_event: + return "event"; + case ls_function: + return "function"; + case ls_method: + return "method"; + case ls_macro: + return "macro"; + case ls_keyword: + return "keyword"; + case ls_modifier: + return "modifier"; + case ls_comment: + return "comment"; + case ls_string: + return "string"; + case ls_number: + return "number"; + case ls_regexp: + return "regexp"; + case ls_operator: + return "operator"; + default: + return "unknown"; + } } unsigned toSemanticTokenType(std::vector<SemanticTokenType>& modifiers) { - unsigned encode_type = 0; - for (auto bit : modifiers) { - encode_type = encode_type | (0b00000001 << bit); - } - return encode_type; + unsigned encode_type = 0; + for (auto bit : modifiers) + { + encode_type = encode_type | (0b00000001 << bit); + } + return encode_type; } std::string to_string(TokenType_JDT _type) { - switch (_type) - { - case PACKAGE_JDT:return "namespace"; - case CLASS_JDT:return "class"; - case INTERFACE_JDT:return "interface"; - case ENUM_JDT:return "enum"; - case ENUM_MEMBER_JDT:return "enumMember"; - case TYPE_JDT:return "type"; - case TYPE_PARAMETER_JDT:return "typeParameter"; - case ANNOTATION_JDT:return "annotation"; - case ANNOTATION_MEMBER_JDT:return "annotationMember"; - case METHOD_JDT:return "function"; - case PROPERTY_JDT:return "property"; - case VARIABLE_JDT:return "variable"; - case PARAMETER_JDT:return "parameter"; - } - return "unknown"; + switch (_type) + { + case PACKAGE_JDT: + return "namespace"; + case CLASS_JDT: + return "class"; + case INTERFACE_JDT: + return "interface"; + case ENUM_JDT: + return "enum"; + case ENUM_MEMBER_JDT: + return "enumMember"; + case TYPE_JDT: + return "type"; + case TYPE_PARAMETER_JDT: + return "typeParameter"; + case ANNOTATION_JDT: + return "annotation"; + case ANNOTATION_MEMBER_JDT: + return "annotationMember"; + case METHOD_JDT: + return "function"; + case PROPERTY_JDT: + return "property"; + case VARIABLE_JDT: + return "variable"; + case PARAMETER_JDT: + return "parameter"; + } + return "unknown"; } std::string to_string(SemanticTokenModifier modifier) { - switch (modifier) { - case ls_declaration: return "declaration"; - case ls_definition: return "definition"; - case ls_readonly: return "readonly"; - case ls_static: return "static"; - case ls_deprecated: return "deprecated"; - case ls_abstract: return "abstract"; - case ls_async: return "async"; - case ls_modification: return "modification"; - case ls_documentation: return "documentation"; - case ls_defaultLibrary: return "defaultLibrary"; - default: - return "unknown"; - } + switch (modifier) + { + case ls_declaration: + return "declaration"; + case ls_definition: + return "definition"; + case ls_readonly: + return "readonly"; + case ls_static: + return "static"; + case ls_deprecated: + return "deprecated"; + case ls_abstract: + return "abstract"; + case ls_async: + return "async"; + case ls_modification: + return "modification"; + case ls_documentation: + return "documentation"; + case ls_defaultLibrary: + return "defaultLibrary"; + default: + return "unknown"; + } } unsigned toSemanticTokenModifiers(std::vector<SemanticTokenModifier>& modifiers) { - unsigned encodedModifiers = 0; - for (auto bit : modifiers) { - encodedModifiers = encodedModifiers | (0b00000001 << bit); - } - return encodedModifiers; + unsigned encodedModifiers = 0; + for (auto bit : modifiers) + { + encodedModifiers = encodedModifiers | (0b00000001 << bit); + } + return encodedModifiers; } - -std::string toSemanticTokenType(HighlightingKind_clangD kind) { - switch (kind) { - case HighlightingKind_clangD::Variable: - case HighlightingKind_clangD::LocalVariable: - case HighlightingKind_clangD::StaticField: - return "variable"; - case HighlightingKind_clangD::Parameter: - return "parameter"; - case HighlightingKind_clangD::Function: - return "function"; - case HighlightingKind_clangD::Method: - return "method"; - case HighlightingKind_clangD::StaticMethod: - // FIXME: better method with static modifier? - return "function"; - case HighlightingKind_clangD::Field: - return "property"; - case HighlightingKind_clangD::Class: - return "class"; - case HighlightingKind_clangD::Interface: - return "interface"; - case HighlightingKind_clangD::Enum: - return "enum"; - case HighlightingKind_clangD::EnumConstant: - return "enumMember"; - case HighlightingKind_clangD::Typedef: - case HighlightingKind_clangD::Type: - return "type"; - case HighlightingKind_clangD::Unknown: - return "unknown"; // nonstandard - case HighlightingKind_clangD::Namespace: - return "namespace"; - case HighlightingKind_clangD::TemplateParameter: - return "typeParameter"; - case HighlightingKind_clangD::Concept: - return "concept"; // nonstandard - case HighlightingKind_clangD::Primitive: - return "type"; - case HighlightingKind_clangD::Macro: - return "macro"; - case HighlightingKind_clangD::InactiveCode: - return "comment"; - } - return ("unhandled HighlightingKind_clangD"); +std::string toSemanticTokenType(HighlightingKind_clangD kind) +{ + switch (kind) + { + case HighlightingKind_clangD::Variable: + case HighlightingKind_clangD::LocalVariable: + case HighlightingKind_clangD::StaticField: + return "variable"; + case HighlightingKind_clangD::Parameter: + return "parameter"; + case HighlightingKind_clangD::Function: + return "function"; + case HighlightingKind_clangD::Method: + return "method"; + case HighlightingKind_clangD::StaticMethod: + // FIXME: better method with static modifier? + return "function"; + case HighlightingKind_clangD::Field: + return "property"; + case HighlightingKind_clangD::Class: + return "class"; + case HighlightingKind_clangD::Interface: + return "interface"; + case HighlightingKind_clangD::Enum: + return "enum"; + case HighlightingKind_clangD::EnumConstant: + return "enumMember"; + case HighlightingKind_clangD::Typedef: + case HighlightingKind_clangD::Type: + return "type"; + case HighlightingKind_clangD::Unknown: + return "unknown"; // nonstandard + case HighlightingKind_clangD::Namespace: + return "namespace"; + case HighlightingKind_clangD::TemplateParameter: + return "typeParameter"; + case HighlightingKind_clangD::Concept: + return "concept"; // nonstandard + case HighlightingKind_clangD::Primitive: + return "type"; + case HighlightingKind_clangD::Macro: + return "macro"; + case HighlightingKind_clangD::InactiveCode: + return "comment"; + } + return ("unhandled HighlightingKind_clangD"); } -std::string toSemanticTokenModifier(HighlightingModifier_clangD modifier) { - switch (modifier) { - case HighlightingModifier_clangD::Declaration: - return "declaration"; - case HighlightingModifier_clangD::Deprecated: - return "deprecated"; - case HighlightingModifier_clangD::Readonly: - return "readonly"; - case HighlightingModifier_clangD::Static: - return "static"; - case HighlightingModifier_clangD::Deduced: - return "deduced"; // nonstandard - case HighlightingModifier_clangD::Abstract: - return "abstract"; - case HighlightingModifier_clangD::DependentName: - return "dependentName"; // nonstandard - case HighlightingModifier_clangD::DefaultLibrary: - return "defaultLibrary"; - case HighlightingModifier_clangD::FunctionScope: - return "functionScope"; // nonstandard - case HighlightingModifier_clangD::ClassScope: - return "classScope"; // nonstandard - case HighlightingModifier_clangD::FileScope: - return "fileScope"; // nonstandard - case HighlightingModifier_clangD::GlobalScope: - return "globalScope"; // nonstandard - } - return ("unhandled HighlightingModifier_clangD"); +std::string toSemanticTokenModifier(HighlightingModifier_clangD modifier) +{ + switch (modifier) + { + case HighlightingModifier_clangD::Declaration: + return "declaration"; + case HighlightingModifier_clangD::Deprecated: + return "deprecated"; + case HighlightingModifier_clangD::Readonly: + return "readonly"; + case HighlightingModifier_clangD::Static: + return "static"; + case HighlightingModifier_clangD::Deduced: + return "deduced"; // nonstandard + case HighlightingModifier_clangD::Abstract: + return "abstract"; + case HighlightingModifier_clangD::DependentName: + return "dependentName"; // nonstandard + case HighlightingModifier_clangD::DefaultLibrary: + return "defaultLibrary"; + case HighlightingModifier_clangD::FunctionScope: + return "functionScope"; // nonstandard + case HighlightingModifier_clangD::ClassScope: + return "classScope"; // nonstandard + case HighlightingModifier_clangD::FileScope: + return "fileScope"; // nonstandard + case HighlightingModifier_clangD::GlobalScope: + return "globalScope"; // nonstandard + } + return ("unhandled HighlightingModifier_clangD"); } - - -bool operator==(const SemanticToken& l, const SemanticToken& r) { - return std::tie(l.deltaLine, l.deltaStart, l.length, l.tokenType, - l.tokenModifiers) == std::tie(r.deltaLine, r.deltaStart, - r.length, r.tokenType, - r.tokenModifiers); +bool operator==(SemanticToken const& l, SemanticToken const& r) +{ + return std::tie(l.deltaLine, l.deltaStart, l.length, l.tokenType, l.tokenModifiers) + == std::tie(r.deltaLine, r.deltaStart, r.length, r.tokenType, r.tokenModifiers); } std::vector<int32_t> SemanticTokens::encodeTokens(std::vector<SemanticToken>& tokens) { - std::vector<int32_t> result; - result.reserve(SemanticTokenEncodingSize * tokens.size()); - for (const auto& tok : tokens) - { - result.push_back(tok.deltaLine); - result.push_back(tok.deltaStart); - result.push_back(tok.length); - result.push_back(tok.tokenType); - result.push_back(tok.tokenModifiers); - } - assert(result.size() == SemanticTokenEncodingSize * tokens.size()); - return result; + std::vector<int32_t> result; + result.reserve(SemanticTokenEncodingSize * tokens.size()); + for (auto const& tok : tokens) + { + result.push_back(tok.deltaLine); + result.push_back(tok.deltaStart); + result.push_back(tok.length); + result.push_back(tok.tokenType); + result.push_back(tok.tokenModifiers); + } + assert(result.size() == SemanticTokenEncodingSize * tokens.size()); + return result; } void Reflect(Reader& visitor, TextDocumentComplete::Either& value) { - if(visitor.IsArray()) - { - Reflect(visitor, value.first); - } - else - { - - Reflect(visitor, value.second); - } + if (visitor.IsArray()) + { + Reflect(visitor, value.first); + } + else + { + Reflect(visitor, value.second); + } } void Reflect(Reader& visitor, TextDocumentDocumentSymbol::Either& value) { - if (visitor.HasMember("location")) - { - Reflect(visitor, value.first); - } - else - { - Reflect(visitor, value.second); - } + if (visitor.HasMember("location")) + { + Reflect(visitor, value.first); + } + else + { + Reflect(visitor, value.second); + } } void Reflect(Reader& visitor, std::pair<optional<std::string>, optional<lsMarkedString>>& value) { - if (!visitor.IsString()) - { - Reflect(visitor, value.second); - } - else - { - Reflect(visitor, value.first); - } + if (!visitor.IsString()) + { + Reflect(visitor, value.second); + } + else + { + Reflect(visitor, value.first); + } } void Reflect(Reader& visitor, std::pair<optional<std::string>, optional<MarkupContent>>& value) { - if (!visitor.IsString()) - { - Reflect(visitor, value.second); - } - else - { - Reflect(visitor, value.first); - } + if (!visitor.IsString()) + { + Reflect(visitor, value.second); + } + else + { + Reflect(visitor, value.first); + } } - void Reflect(Reader& visitor, TextDocumentHover::Either& value) +void Reflect(Reader& visitor, TextDocumentHover::Either& value) { - JsonReader& reader = dynamic_cast<JsonReader&>(visitor); - if (reader.IsArray()) - { - Reflect(visitor, value.first); - } - else if(reader.m_->IsObject()) - { - Reflect(visitor, value.second); - } + JsonReader& reader = dynamic_cast<JsonReader&>(visitor); + if (reader.IsArray()) + { + Reflect(visitor, value.first); + } + else if (reader.m_->IsObject()) + { + Reflect(visitor, value.second); + } } - void Reflect(Reader& visitor, TextDocumentPrepareRenameResult& value) +void Reflect(Reader& visitor, TextDocumentPrepareRenameResult& value) { - if (visitor.HasMember("placeholder")) - { - Reflect(visitor, value.second); - } - else - { - Reflect(visitor, value.first); - } + if (visitor.HasMember("placeholder")) + { + Reflect(visitor, value.second); + } + else + { + Reflect(visitor, value.first); + } } - namespace - RefactorProposalUtility - { - const char* APPLY_REFACTORING_COMMAND_ID = "java.action.applyRefactoringCommand"; - const char* EXTRACT_VARIABLE_ALL_OCCURRENCE_COMMAND = "extractVariableAllOccurrence"; - const char* EXTRACT_VARIABLE_COMMAND = "extractVariable"; - const char* EXTRACT_CONSTANT_COMMAND = "extractConstant"; - const char* EXTRACT_METHOD_COMMAND = "extractMethod"; - const char* EXTRACT_FIELD_COMMAND = "extractField"; - const char* CONVERT_VARIABLE_TO_FIELD_COMMAND = "convertVariableToField"; - const char* MOVE_FILE_COMMAND = "moveFile"; - const char* MOVE_INSTANCE_METHOD_COMMAND = "moveInstanceMethod"; - const char* MOVE_STATIC_MEMBER_COMMAND = "moveStaticMember"; - const char* MOVE_TYPE_COMMAND = "moveType"; - }; - namespace QuickAssistProcessor { - - const char* SPLIT_JOIN_VARIABLE_DECLARATION_ID = "org.eclipse.jdt.ls.correction.splitJoinVariableDeclaration.assist"; //$NON-NLS-1$ - const char* CONVERT_FOR_LOOP_ID = "org.eclipse.jdt.ls.correction.convertForLoop.assist"; //$NON-NLS-1$ - const char* ASSIGN_TO_LOCAL_ID = "org.eclipse.jdt.ls.correction.assignToLocal.assist"; //$NON-NLS-1$ - const char* ASSIGN_TO_FIELD_ID = "org.eclipse.jdt.ls.correction.assignToField.assist"; //$NON-NLS-1$ - const char* ASSIGN_PARAM_TO_FIELD_ID = "org.eclipse.jdt.ls.correction.assignParamToField.assist"; //$NON-NLS-1$ - const char* ASSIGN_ALL_PARAMS_TO_NEW_FIELDS_ID = "org.eclipse.jdt.ls.correction.assignAllParamsToNewFields.assist"; //$NON-NLS-1$ - const char* ADD_BLOCK_ID = "org.eclipse.jdt.ls.correction.addBlock.assist"; //$NON-NLS-1$ - const char* EXTRACT_LOCAL_ID = "org.eclipse.jdt.ls.correction.extractLocal.assist"; //$NON-NLS-1$ - const char* EXTRACT_LOCAL_NOT_REPLACE_ID = "org.eclipse.jdt.ls.correction.extractLocalNotReplaceOccurrences.assist"; //$NON-NLS-1$ - const char* EXTRACT_CONSTANT_ID = "org.eclipse.jdt.ls.correction.extractConstant.assist"; //$NON-NLS-1$ - const char* INLINE_LOCAL_ID = "org.eclipse.jdt.ls.correction.inlineLocal.assist"; //$NON-NLS-1$ - const char* CONVERT_LOCAL_TO_FIELD_ID = "org.eclipse.jdt.ls.correction.convertLocalToField.assist"; //$NON-NLS-1$ - const char* CONVERT_ANONYMOUS_TO_LOCAL_ID = "org.eclipse.jdt.ls.correction.convertAnonymousToLocal.assist"; //$NON-NLS-1$ - const char* CONVERT_TO_STRING_BUFFER_ID = "org.eclipse.jdt.ls.correction.convertToStringBuffer.assist"; //$NON-NLS-1$ - const char* CONVERT_TO_MESSAGE_FORMAT_ID = "org.eclipse.jdt.ls.correction.convertToMessageFormat.assist"; //$NON-NLS-1$; - const char* EXTRACT_METHOD_INPLACE_ID = "org.eclipse.jdt.ls.correction.extractMethodInplace.assist"; //$NON-NLS-1$; +namespace RefactorProposalUtility +{ +char const* APPLY_REFACTORING_COMMAND_ID = "java.action.applyRefactoringCommand"; +char const* EXTRACT_VARIABLE_ALL_OCCURRENCE_COMMAND = "extractVariableAllOccurrence"; +char const* EXTRACT_VARIABLE_COMMAND = "extractVariable"; +char const* EXTRACT_CONSTANT_COMMAND = "extractConstant"; +char const* EXTRACT_METHOD_COMMAND = "extractMethod"; +char const* EXTRACT_FIELD_COMMAND = "extractField"; +char const* CONVERT_VARIABLE_TO_FIELD_COMMAND = "convertVariableToField"; +char const* MOVE_FILE_COMMAND = "moveFile"; +char const* MOVE_INSTANCE_METHOD_COMMAND = "moveInstanceMethod"; +char const* MOVE_STATIC_MEMBER_COMMAND = "moveStaticMember"; +char const* MOVE_TYPE_COMMAND = "moveType"; +}; // namespace RefactorProposalUtility +namespace QuickAssistProcessor +{ - const char* CONVERT_ANONYMOUS_CLASS_TO_NESTED_COMMAND = "convertAnonymousClassToNestedCommand"; - }; +char const* SPLIT_JOIN_VARIABLE_DECLARATION_ID = + "org.eclipse.jdt.ls.correction.splitJoinVariableDeclaration.assist"; //$NON-NLS-1$ +char const* CONVERT_FOR_LOOP_ID = "org.eclipse.jdt.ls.correction.convertForLoop.assist"; //$NON-NLS-1$ +char const* ASSIGN_TO_LOCAL_ID = "org.eclipse.jdt.ls.correction.assignToLocal.assist"; //$NON-NLS-1$ +char const* ASSIGN_TO_FIELD_ID = "org.eclipse.jdt.ls.correction.assignToField.assist"; //$NON-NLS-1$ +char const* ASSIGN_PARAM_TO_FIELD_ID = "org.eclipse.jdt.ls.correction.assignParamToField.assist"; //$NON-NLS-1$ +char const* ASSIGN_ALL_PARAMS_TO_NEW_FIELDS_ID = + "org.eclipse.jdt.ls.correction.assignAllParamsToNewFields.assist"; //$NON-NLS-1$ +char const* ADD_BLOCK_ID = "org.eclipse.jdt.ls.correction.addBlock.assist"; //$NON-NLS-1$ +char const* EXTRACT_LOCAL_ID = "org.eclipse.jdt.ls.correction.extractLocal.assist"; //$NON-NLS-1$ +char const* EXTRACT_LOCAL_NOT_REPLACE_ID = + "org.eclipse.jdt.ls.correction.extractLocalNotReplaceOccurrences.assist"; //$NON-NLS-1$ +char const* EXTRACT_CONSTANT_ID = "org.eclipse.jdt.ls.correction.extractConstant.assist"; //$NON-NLS-1$ +char const* INLINE_LOCAL_ID = "org.eclipse.jdt.ls.correction.inlineLocal.assist"; //$NON-NLS-1$ +char const* CONVERT_LOCAL_TO_FIELD_ID = "org.eclipse.jdt.ls.correction.convertLocalToField.assist"; //$NON-NLS-1$ +char const* CONVERT_ANONYMOUS_TO_LOCAL_ID = + "org.eclipse.jdt.ls.correction.convertAnonymousToLocal.assist"; //$NON-NLS-1$ +char const* CONVERT_TO_STRING_BUFFER_ID = "org.eclipse.jdt.ls.correction.convertToStringBuffer.assist"; //$NON-NLS-1$ +char const* CONVERT_TO_MESSAGE_FORMAT_ID = "org.eclipse.jdt.ls.correction.convertToMessageFormat.assist"; //$NON-NLS-1$; +char const* EXTRACT_METHOD_INPLACE_ID = "org.eclipse.jdt.ls.correction.extractMethodInplace.assist"; //$NON-NLS-1$; - void Reflect(Reader& reader, TypeHierarchyDirection& value) { - if (!reader.IsString()) - { - value = TypeHierarchyDirection::Both; - return; - } - std::string v = reader.GetString(); - if (v == "Children") - value = TypeHierarchyDirection::Both; - else if (v == "Parents") - value = TypeHierarchyDirection::Parents; - else if (v == "Both") - value = TypeHierarchyDirection::Both; - } +char const* CONVERT_ANONYMOUS_CLASS_TO_NESTED_COMMAND = "convertAnonymousClassToNestedCommand"; +}; // namespace QuickAssistProcessor +void Reflect(Reader& reader, TypeHierarchyDirection& value) +{ + if (!reader.IsString()) + { + value = TypeHierarchyDirection::Both; + return; + } + std::string v = reader.GetString(); + if (v == "Children") + { + value = TypeHierarchyDirection::Both; + } + else if (v == "Parents") + { + value = TypeHierarchyDirection::Parents; + } + else if (v == "Both") + { + value = TypeHierarchyDirection::Both; + } +} - void Reflect(Writer& writer, TypeHierarchyDirection& value) { - switch (value) - { - case TypeHierarchyDirection::Children: - writer.String("Children"); - break; - case TypeHierarchyDirection::Parents: - writer.String("Parents"); - break; - case TypeHierarchyDirection::Both: - writer.String("Both"); - break; - } - } +void Reflect(Writer& writer, TypeHierarchyDirection& value) +{ + switch (value) + { + case TypeHierarchyDirection::Children: + writer.String("Children"); + break; + case TypeHierarchyDirection::Parents: + writer.String("Parents"); + break; + case TypeHierarchyDirection::Both: + writer.String("Both"); + break; + } +} diff --git a/graphics/asymptote/LspCpp/src/lsp/utils.cpp b/graphics/asymptote/LspCpp/src/lsp/utils.cpp index 893cc94552..0ed5872fca 100644 --- a/graphics/asymptote/LspCpp/src/lsp/utils.cpp +++ b/graphics/asymptote/LspCpp/src/lsp/utils.cpp @@ -15,11 +15,10 @@ #include "LibLsp/lsp/lsPosition.h" #include "utf8.h" -#ifdef _WIN32 +#ifdef _WIN32 #include <Windows.h> #endif - // DEFAULT_RESOURCE_DIRECTORY is passed with quotes for non-MSVC compilers, ie, // foo vs "foo". #if defined(_MSC_VER) @@ -28,6 +27,7 @@ #else #define ENSURE_STRING_MACRO_ARGUMENT(x) x #endif +#include <boost/utility.hpp> #include <boost/filesystem/path.hpp> #include <boost/filesystem/operations.hpp> #include <boost/algorithm/string.hpp> @@ -35,286 +35,336 @@ namespace lsp { - // See http://stackoverflow.com/a/2072890 -bool EndsWith(std::string value, std::string ending) { - if (ending.size() > value.size()) - return false; - return std::equal(ending.rbegin(), ending.rend(), value.rbegin()); +bool EndsWith(std::string value, std::string ending) +{ + if (ending.size() > value.size()) + { + return false; + } + return std::equal(ending.rbegin(), ending.rend(), value.rbegin()); } -bool StartsWith(std::string value, std::string start) { - if (start.size() > value.size()) - return false; - return std::equal(start.begin(), start.end(), value.begin()); +bool StartsWith(std::string value, std::string start) +{ + if (start.size() > value.size()) + { + return false; + } + return std::equal(start.begin(), start.end(), value.begin()); } -bool AnyStartsWith(const std::vector<std::string>& values, - const std::string& start) { - return std::any_of( - std::begin(values), std::end(values), - [&start](const std::string& value) { return StartsWith(value, start); }); +bool AnyStartsWith(std::vector<std::string> const& values, std::string const& start) +{ + return std::any_of( + std::begin(values), std::end(values), [&start](std::string const& value) { return StartsWith(value, start); } + ); } -bool StartsWithAny(const std::string& value, - const std::vector<std::string>& startings) { - return std::any_of(std::begin(startings), std::end(startings), - [&value](const std::string& starting) { - return StartsWith(value, starting); - }); +bool StartsWithAny(std::string const& value, std::vector<std::string> const& startings) +{ + return std::any_of( + std::begin(startings), std::end(startings), + [&value](std::string const& starting) { return StartsWith(value, starting); } + ); } -bool EndsWithAny(const std::string& value, - const std::vector<std::string>& endings) { - return std::any_of( - std::begin(endings), std::end(endings), - [&value](const std::string& ending) { return EndsWith(value, ending); }); +bool EndsWithAny(std::string const& value, std::vector<std::string> const& endings) +{ + return std::any_of( + std::begin(endings), std::end(endings), [&value](std::string const& ending) { return EndsWith(value, ending); } + ); } -bool FindAnyPartial(const std::string& value, - const std::vector<std::string>& values) { - return std::any_of(std::begin(values), std::end(values), - [&value](const std::string& v) { - return value.find(v) != std::string::npos; - }); +bool FindAnyPartial(std::string const& value, std::vector<std::string> const& values) +{ + return std::any_of( + std::begin(values), std::end(values), + [&value](std::string const& v) { return value.find(v) != std::string::npos; } + ); } -std::string GetDirName(std::string path) { +std::string GetDirName(std::string path) +{ - ReplaceAll(path, "\\", "/"); - if (path.size() && path.back() == '/') - path.pop_back(); - size_t last_slash = path.find_last_of('/'); - if (last_slash == std::string::npos) - return "./"; - return path.substr(0, last_slash + 1); + ReplaceAll(path, "\\", "/"); + if (path.size() && path.back() == '/') + { + path.pop_back(); + } + size_t last_slash = path.find_last_of('/'); + if (last_slash == std::string::npos) + { + return "./"; + } + return path.substr(0, last_slash + 1); } -std::string GetBaseName(const std::string& path) { - size_t last_slash = path.find_last_of('/'); - if (last_slash != std::string::npos && (last_slash + 1) < path.size()) - return path.substr(last_slash + 1); - return path; +std::string GetBaseName(std::string const& path) +{ + size_t last_slash = path.find_last_of('/'); + if (last_slash != std::string::npos && (last_slash + 1) < path.size()) + { + return path.substr(last_slash + 1); + } + return path; } -std::string StripFileType(const std::string& path) { - size_t last_period = path.find_last_of('.'); - if (last_period != std::string::npos) - return path.substr(0, last_period); - return path; +std::string StripFileType(std::string const& path) +{ + size_t last_period = path.find_last_of('.'); + if (last_period != std::string::npos) + { + return path.substr(0, last_period); + } + return path; } // See http://stackoverflow.com/a/29752943 -std::string ReplaceAll(const std::string& source, - const std::string& from, - const std::string& to) { - std::string result; - result.reserve(source.length()); // avoids a few memory allocations +std::string ReplaceAll(std::string const& source, std::string const& from, std::string const& to) +{ + std::string result; + result.reserve(source.length()); // avoids a few memory allocations - std::string::size_type last_pos = 0; - std::string::size_type find_pos; + std::string::size_type last_pos = 0; + std::string::size_type find_pos; - while (std::string::npos != (find_pos = source.find(from, last_pos))) { - result.append(source, last_pos, find_pos - last_pos); - result += to; - last_pos = find_pos + from.length(); - } + while (std::string::npos != (find_pos = source.find(from, last_pos))) + { + result.append(source, last_pos, find_pos - last_pos); + result += to; + last_pos = find_pos + from.length(); + } - // Care for the rest after last occurrence - result += source.substr(last_pos); + // Care for the rest after last occurrence + result += source.substr(last_pos); - return result; + return result; } -std::vector<std::string> SplitString(const std::string& str, - const std::string& delimiter) { - // http://stackoverflow.com/a/13172514 - std::vector<std::string> strings; - - std::string::size_type pos = 0; - std::string::size_type prev = 0; - while ((pos = str.find(delimiter, prev)) != std::string::npos) { - strings.emplace_back(str.substr(prev, pos - prev)); - prev = pos + 1; - } +std::vector<std::string> SplitString(std::string const& str, std::string const& delimiter) +{ + // http://stackoverflow.com/a/13172514 + std::vector<std::string> strings; + + std::string::size_type pos = 0; + std::string::size_type prev = 0; + while ((pos = str.find(delimiter, prev)) != std::string::npos) + { + strings.emplace_back(str.substr(prev, pos - prev)); + prev = pos + 1; + } - // To get the last substring (or only, if delimiter is not found) - strings.emplace_back(str.substr(prev)); + // To get the last substring (or only, if delimiter is not found) + strings.emplace_back(str.substr(prev)); - return strings; + return strings; } -void EnsureEndsInSlash(std::string& path) { - if (path.empty() || path[path.size() - 1] != '/') - path += '/'; +void EnsureEndsInSlash(std::string& path) +{ + if (path.empty() || path[path.size() - 1] != '/') + { + path += '/'; + } } -std::string EscapeFileName(std::string path) { - if (path.size() && path.back() == '/') - path.pop_back(); - std::replace(path.begin(), path.end(), '\\', '@'); - std::replace(path.begin(), path.end(), '/', '@'); - std::replace(path.begin(), path.end(), ':', '@'); - return path; +std::string EscapeFileName(std::string path) +{ + if (path.size() && path.back() == '/') + { + path.pop_back(); + } + std::replace(path.begin(), path.end(), '\\', '@'); + std::replace(path.begin(), path.end(), '/', '@'); + std::replace(path.begin(), path.end(), ':', '@'); + return path; } // http://stackoverflow.com/a/6089413 -std::istream& SafeGetline(std::istream& is, std::string& t) { - t.clear(); +std::istream& SafeGetline(std::istream& is, std::string& t) +{ + t.clear(); - // The characters in the stream are read one-by-one using a std::streambuf. - // That is faster than reading them one-by-one using the std::istream. Code - // that uses streambuf this way must be guarded by a sentry object. The sentry - // object performs various tasks, such as thread synchronization and updating - // the stream state. + // The characters in the stream are read one-by-one using a std::streambuf. + // That is faster than reading them one-by-one using the std::istream. Code + // that uses streambuf this way must be guarded by a sentry object. The sentry + // object performs various tasks, such as thread synchronization and updating + // the stream state. - std::istream::sentry se(is, true); - std::streambuf* sb = is.rdbuf(); + std::istream::sentry se(is, true); + std::streambuf* sb = is.rdbuf(); - for (;;) { - int c = sb->sbumpc(); - if (c == EOF) { - // Also handle the case when the last line has no line ending - if (t.empty()) - is.setstate(std::ios::eofbit); - return is; - } + for (;;) + { + int c = sb->sbumpc(); + if (c == EOF) + { + // Also handle the case when the last line has no line ending + if (t.empty()) + { + is.setstate(std::ios::eofbit); + } + return is; + } - t += (char)c; + t += (char)c; - if (c == '\n') - return is; - } + if (c == '\n') + { + return is; + } + } } -bool FileExists(const std::string& filename) { - std::ifstream cache(filename); - return cache.is_open(); +bool FileExists(std::string const& filename) +{ + std::ifstream cache(filename); + return cache.is_open(); } -optional<std::string> ReadContent(const AbsolutePath& filename) { +optional<std::string> ReadContent(AbsolutePath const& filename) +{ - std::ifstream cache; - cache.open(filename.path); + std::ifstream cache; + cache.open(filename.path); - try { - return std::string(std::istreambuf_iterator<char>(cache), - std::istreambuf_iterator<char>()); - } catch (std::ios_base::failure&) { - return {}; - } + try + { + return std::string(std::istreambuf_iterator<char>(cache), std::istreambuf_iterator<char>()); + } + catch (std::ios_base::failure&) + { + return {}; + } } -std::vector<std::string> ReadLinesWithEnding(const AbsolutePath& filename) { - std::vector<std::string> result; +std::vector<std::string> ReadLinesWithEnding(AbsolutePath const& filename) +{ + std::vector<std::string> result; - std::ifstream input(filename.path); - for (std::string line; SafeGetline(input, line);) - result.emplace_back(line); + std::ifstream input(filename.path); + for (std::string line; SafeGetline(input, line);) + { + result.emplace_back(line); + } - return result; + return result; } -bool WriteToFile(const std::string& filename, const std::string& content) { - std::ofstream file(filename, - std::ios::out | std::ios::trunc | std::ios::binary); - if (!file.good()) { +bool WriteToFile(std::string const& filename, std::string const& content) +{ + std::ofstream file(filename, std::ios::out | std::ios::trunc | std::ios::binary); + if (!file.good()) + { - return false; - } + return false; + } - file << content; - return true; + file << content; + return true; } +std::string FormatMicroseconds(long long microseconds) +{ + long long milliseconds = microseconds / 1000; + long long remaining = microseconds - milliseconds; -std::string FormatMicroseconds(long long microseconds) { - long long milliseconds = microseconds / 1000; - long long remaining = microseconds - milliseconds; - - // Only show two digits after the dot. - while (remaining >= 100) - remaining /= 10; + // Only show two digits after the dot. + while (remaining >= 100) + { + remaining /= 10; + } - return std::to_string(milliseconds) + "." + std::to_string(remaining) + "ms"; + return std::to_string(milliseconds) + "." + std::to_string(remaining) + "ms"; } +std::string UpdateToRnNewlines(std::string output) +{ + size_t idx = 0; + while (true) + { + idx = output.find('\n', idx); + // No more matches. + if (idx == std::string::npos) + { + break; + } -std::string UpdateToRnNewlines(std::string output) { - size_t idx = 0; - while (true) { - idx = output.find('\n', idx); - - // No more matches. - if (idx == std::string::npos) - break; + // Skip an existing "\r\n" match. + if (idx > 0 && output[idx - 1] == '\r') + { + ++idx; + continue; + } - // Skip an existing "\r\n" match. - if (idx > 0 && output[idx - 1] == '\r') { - ++idx; - continue; + // Replace "\n" with "\r|n". + output.replace(output.begin() + idx, output.begin() + idx + 1, "\r\n"); } - // Replace "\n" with "\r|n". - output.replace(output.begin() + idx, output.begin() + idx + 1, "\r\n"); - } - - return output; + return output; } - - -bool IsAbsolutePath(const std::string& path) { - return IsUnixAbsolutePath(path) || IsWindowsAbsolutePath(path); +bool IsAbsolutePath(std::string const& path) +{ + return IsUnixAbsolutePath(path) || IsWindowsAbsolutePath(path); } -bool IsUnixAbsolutePath(const std::string& path) { - return !path.empty() && path[0] == '/'; +bool IsUnixAbsolutePath(std::string const& path) +{ + return !path.empty() && path[0] == '/'; } -bool IsWindowsAbsolutePath(const std::string& path) { - auto is_drive_letter = [](char c) { - return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); - }; +bool IsWindowsAbsolutePath(std::string const& path) +{ + auto is_drive_letter = [](char c) { return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); }; - return path.size() > 3 && path[1] == ':' && - (path[2] == '/' || path[2] == '\\') && is_drive_letter(path[0]); + return path.size() > 3 && path[1] == ':' && (path[2] == '/' || path[2] == '\\') && is_drive_letter(path[0]); } -bool IsDirectory(const std::string& path) { - struct stat path_stat; +bool IsDirectory(std::string const& path) +{ + struct stat path_stat; - if (stat(path.c_str(), &path_stat) != 0) { - perror("cannot access path"); - return false; - } + if (stat(path.c_str(), &path_stat) != 0) + { + perror("cannot access path"); + return false; + } - return path_stat.st_mode & S_IFDIR; + return path_stat.st_mode & S_IFDIR; } - std::string ws2s(std::wstring const& wstr) { - if(sizeof(wchar_t) == 2){ - std::string narrow; - utf8::utf16to8(wstr.begin(), wstr.end(), std::back_inserter(narrow)); - return narrow; - }else{ - std::string narrow; - utf8::utf32to8(wstr.begin(), wstr.end(), std::back_inserter(narrow)); - return narrow; - } - +std::string ws2s(std::wstring const& wstr) +{ + BOOST_IF_CONSTEXPR(sizeof(wchar_t) == 2) + { + std::string narrow; + utf8::utf16to8(wstr.begin(), wstr.end(), std::back_inserter(narrow)); + return narrow; } - std::wstring s2ws(const std::string& str) { - std::wstring wide; - if(sizeof(wchar_t) == 2){ - utf8::utf8to16(str.begin(), str.end(), std::back_inserter(wide)); - return wide; - }else{ - utf8::utf8to32(str.begin(), str.end(), std::back_inserter(wide)); - return wide; - } + else + { + std::string narrow; + utf8::utf32to8(wstr.begin(), wstr.end(), std::back_inserter(narrow)); + return narrow; + } +} +std::wstring s2ws(std::string const& str) +{ + std::wstring wide; + BOOST_IF_CONSTEXPR(sizeof(wchar_t) == 2) + { + utf8::utf8to16(str.begin(), str.end(), std::back_inserter(wide)); + return wide; + } + else + { + utf8::utf8to32(str.begin(), str.end(), std::back_inserter(wide)); + return wide; } +} #ifdef _WIN32 @@ -322,291 +372,348 @@ bool IsDirectory(const std::string& path) { // Returns the canonicalized absolute pathname, without expanding symbolic // links. This is a variant of realpath(2), C++ rewrite of // https://github.com/freebsd/freebsd/blob/master/lib/libc/stdlib/realpath.c -AbsolutePath RealPathNotExpandSymlink(std::string path, - bool ensure_exists) { - if (path.empty()) { - errno = EINVAL; - return {}; - } - if (path[0] == '\0') { - errno = ENOENT; - return {}; +AbsolutePath RealPathNotExpandSymlink(std::string path, bool ensure_exists) +{ + if (path.empty()) + { + errno = EINVAL; + return {}; + } + if (path[0] == '\0') + { + errno = ENOENT; + return {}; + } + + // Do not use PATH_MAX because it is tricky on Linux. + // See https://eklitzke.org/path-max-is-tricky + char tmp[1024]; + std::string resolved; + size_t i = 0; + struct stat sb; + if (path[0] == '/') + { + resolved = "/"; + i = 1; + } + else + { + if (!getcwd(tmp, sizeof tmp) && ensure_exists) + { + return {}; } + resolved = tmp; + } - // Do not use PATH_MAX because it is tricky on Linux. - // See https://eklitzke.org/path-max-is-tricky - char tmp[1024]; - std::string resolved; - size_t i = 0; - struct stat sb; - if (path[0] == '/') { - resolved = "/"; - i = 1; + while (i < path.size()) + { + auto j = path.find('/', i); + if (j == std::string::npos) + { + j = path.size(); } - else { - if (!getcwd(tmp, sizeof tmp) && ensure_exists) - return {}; - resolved = tmp; + auto next_token = path.substr(i, j - i); + i = j + 1; + if (resolved.back() != '/') + { + resolved += '/'; } - - while (i < path.size()) { - auto j = path.find('/', i); - if (j == std::string::npos) - j = path.size(); - auto next_token = path.substr(i, j - i); - i = j + 1; - if (resolved.back() != '/') - resolved += '/'; - if (next_token.empty() || next_token == ".") { - // Handle consequential slashes and "." - continue; - } - else if (next_token == "..") { - // Strip the last path component except when it is single "/" - if (resolved.size() > 1) - resolved.resize(resolved.rfind('/', resolved.size() - 2) + 1); - continue; - } - // Append the next path component. - // Here we differ from realpath(3), we use stat(2) instead of - // lstat(2) because we do not want to resolve symlinks. - resolved += next_token; - if (stat(resolved.c_str(), &sb) != 0 && ensure_exists) - return {}; - if (!S_ISDIR(sb.st_mode) && j < path.size() && ensure_exists) { - errno = ENOTDIR; - return {}; - } + if (next_token.empty() || next_token == ".") + { + // Handle consequential slashes and "." + continue; } + else if (next_token == "..") + { + // Strip the last path component except when it is single "/" + if (resolved.size() > 1) + { + resolved.resize(resolved.rfind('/', resolved.size() - 2) + 1); + } + continue; + } + // Append the next path component. + // Here we differ from realpath(3), we use stat(2) instead of + // lstat(2) because we do not want to resolve symlinks. + resolved += next_token; + if (stat(resolved.c_str(), &sb) != 0 && ensure_exists) + { + return {}; + } + if (!S_ISDIR(sb.st_mode) && j < path.size() && ensure_exists) + { + errno = ENOTDIR; + return {}; + } + } - // Remove trailing slash except when a single "/". - if (resolved.size() > 1 && resolved.back() == '/') - resolved.pop_back(); - return AbsolutePath(resolved, true /*validate*/); + // Remove trailing slash except when a single "/". + if (resolved.size() > 1 && resolved.back() == '/') + { + resolved.pop_back(); + } + return AbsolutePath(resolved, true /*validate*/); } #endif - -AbsolutePath NormalizePath(const std::string& path0, - bool ensure_exists , - bool force_lower_on_windows) { +AbsolutePath NormalizePath(std::string const& path0, bool ensure_exists, bool force_lower_on_windows) +{ #ifdef _WIN32 - std::wstring path = lsp::s2ws(path0); + std::wstring path = lsp::s2ws(path0); - wchar_t buffer[MAX_PATH] = (L""); + wchar_t buffer[MAX_PATH] = (L""); - // Normalize the path name, ie, resolve `..`. - unsigned long len = GetFullPathNameW(path.c_str(), MAX_PATH, buffer, nullptr); + // Normalize the path name, ie, resolve `..`. + unsigned long len = GetFullPathNameW(path.c_str(), MAX_PATH, buffer, nullptr); + if (!len) + { + return {}; + } + path = std::wstring(buffer, len); + + // Get the actual casing of the path, ie, if the file on disk is `C:\FooBar` + // and this function is called with `c:\fooBar` this will return `c:\FooBar`. + // (drive casing is lowercase). + if (ensure_exists) + { + len = GetLongPathNameW(path.c_str(), buffer, MAX_PATH); if (!len) - return {}; - path = std::wstring(buffer, len); - - // Get the actual casing of the path, ie, if the file on disk is `C:\FooBar` - // and this function is called with `c:\fooBar` this will return `c:\FooBar`. - // (drive casing is lowercase). - if (ensure_exists) { - len = GetLongPathNameW(path.c_str(), buffer, MAX_PATH); - if (!len) - return {}; - path = std::wstring(buffer, len); + { + return {}; } + path = std::wstring(buffer, len); + } - // Empty paths have no meaning. - if (path.empty()) - return {}; + // Empty paths have no meaning. + if (path.empty()) + { + return {}; + } - // We may need to normalize the drive name to upper-case; at the moment - // vscode sends lower-case path names. - /* + // We may need to normalize the drive name to upper-case; at the moment + // vscode sends lower-case path names. + /* path[0] = toupper(path[0]); */ - // Make the path all lower-case, since windows is case-insensitive. - if (force_lower_on_windows) { - for (size_t i = 0; i < path.size(); ++i) - path[i] = (wchar_t)tolower(path[i]); + // Make the path all lower-case, since windows is case-insensitive. + if (force_lower_on_windows) + { + for (size_t i = 0; i < path.size(); ++i) + { + path[i] = (wchar_t)tolower(path[i]); } + } - // cquery assumes forward-slashes. - std::replace(path.begin(), path.end(), '\\', '/'); - + // cquery assumes forward-slashes. + std::replace(path.begin(), path.end(), '\\', '/'); - return AbsolutePath(lsp::ws2s(path), false /*validate*/); + return AbsolutePath(lsp::ws2s(path), false /*validate*/); #else - return RealPathNotExpandSymlink(path0, ensure_exists); + return RealPathNotExpandSymlink(path0, ensure_exists); #endif - - } // VSCode (UTF-16) disagrees with Emacs lsp-mode (UTF-8) on how to represent // text documents. // We use a UTF-8 iterator to approximate UTF-16 in the specification (weird). // This is good enough and fails only for UTF-16 surrogate pairs. -int GetOffsetForPosition(lsPosition position, const std::string& content) { - size_t i = 0; - // Iterate lines until we have found the correct line. - while (position.line > 0 && i < content.size()) { - if (content[i] == '\n') - position.line--; - i++; +int GetOffsetForPosition(lsPosition position, std::string const& content) +{ + size_t i = 0; + // Iterate lines until we have found the correct line. + while (position.line > 0 && i < content.size()) + { + if (content[i] == '\n') + { + position.line--; } - // Iterate characters on the target line. - while (position.character > 0 && i < content.size()) { - if (uint8_t(content[i++]) >= 128) { - // Skip 0b10xxxxxx - while (i < content.size() && uint8_t(content[i]) >= 128 && - uint8_t(content[i]) < 192) - i++; - } - position.character--; + i++; + } + // Iterate characters on the target line. + while (position.character > 0 && i < content.size()) + { + if (uint8_t(content[i++]) >= 128) + { + // Skip 0b10xxxxxx + while (i < content.size() && uint8_t(content[i]) >= 128 && uint8_t(content[i]) < 192) + { + i++; + } } - return int(i); + position.character--; + } + return int(i); } +lsPosition GetPositionForOffset(size_t offset, std::string const& content) +{ + lsPosition result; + for (size_t i = 0; i < offset && i < content.length(); ++i) + { + if (content[i] == '\n') + { + result.line++; + result.character = 0; + } + else + { + result.character++; + } + } + return result; +} -lsPosition GetPositionForOffset(size_t offset,const std::string& content) { - lsPosition result; - for (size_t i = 0; i < offset && i < content.length(); ++i) { - if (content[i] == '\n') { - result.line++; - result.character = 0; - } - else { - result.character++; - } +lsPosition CharPos(std::string const& search, char character, int character_offset) +{ + lsPosition result; + size_t index = 0; + while (index < search.size()) + { + char c = search[index]; + if (c == character) + { + break; } - return result; -} - -lsPosition CharPos(const std::string& search, - char character, - int character_offset) { - lsPosition result; - size_t index = 0; - while (index < search.size()) { - char c = search[index]; - if (c == character) - break; - if (c == '\n') { - result.line += 1; - result.character = 0; - } - else { - result.character += 1; - } - ++index; + if (c == '\n') + { + result.line += 1; + result.character = 0; } - assert(index < search.size()); - result.character += character_offset; - return result; -} - -void scanDirsUseRecursive(const std::wstring& rootPath, std::vector<std::wstring>& ret) -{ - namespace fs = boost::filesystem; - fs::path fullpath(rootPath); - if (!fs::exists(fullpath)) { return; } - fs::recursive_directory_iterator end_iter; - for (fs::recursive_directory_iterator iter(fullpath); iter != end_iter; iter++) { - try { - if (fs::is_directory(*iter)) { - ret.push_back(iter->path().wstring()); - } - } - catch (const std::exception& ex) { - continue; - } + else + { + result.character += 1; } + ++index; + } + assert(index < search.size()); + result.character += character_offset; + return result; } -void scanDirsNoRecursive(const std::wstring& rootPath, std::vector<std::wstring>& ret) +void scanDirsUseRecursive(std::wstring const& rootPath, std::vector<std::wstring>& ret) { - namespace fs = boost::filesystem; - boost::filesystem::path myPath(rootPath); - if (!fs::exists(rootPath)) { return; } - boost::filesystem::directory_iterator endIter; - for (boost::filesystem::directory_iterator iter(myPath); iter != endIter; iter++) { - if (boost::filesystem::is_directory(*iter)) { - ret.push_back(iter->path().wstring()); - } + namespace fs = boost::filesystem; + fs::path fullpath(rootPath); + if (!fs::exists(fullpath)) + { + return; + } + fs::recursive_directory_iterator end_iter; + for (fs::recursive_directory_iterator iter(fullpath); iter != end_iter; iter++) + { + try + { + if (fs::is_directory(*iter)) + { + ret.push_back(iter->path().wstring()); + } + } + catch (std::exception const&) + { + continue; } + } } -void scanFilesUseRecursive( - const std::wstring& rootPath, - std::vector<std::wstring>& ret, - std::wstring suf) { - namespace fs = boost::filesystem; - boost::to_lower(suf); - - fs::path fullpath(rootPath); - if (!fs::exists(fullpath)) { return; } - fs::recursive_directory_iterator end_iter; - for (fs::recursive_directory_iterator iter(fullpath); iter != end_iter; iter++) { - try { - if (!fs::is_directory(*iter) && fs::is_regular_file(*iter)) { - auto temp_path = iter->path().wstring(); - auto size = suf.size(); - if (!size) - { - ret.push_back(std::move(temp_path)); - } - else - { - - if (temp_path.size() < size) continue; - auto suf_temp = temp_path.substr(temp_path.size() - size); - boost::to_lower(suf_temp); - if (suf_temp == suf) - { - ret.push_back(std::move(temp_path)); - } - } - } - } - catch (const std::exception&) { - continue; - } +void scanDirsNoRecursive(std::wstring const& rootPath, std::vector<std::wstring>& ret) +{ + namespace fs = boost::filesystem; + boost::filesystem::path myPath(rootPath); + if (!fs::exists(rootPath)) + { + return; + } + boost::filesystem::directory_iterator endIter; + for (boost::filesystem::directory_iterator iter(myPath); iter != endIter; iter++) + { + if (boost::filesystem::is_directory(*iter)) + { + ret.push_back(iter->path().wstring()); } + } } -void scanFileNamesUseRecursive(const std::wstring& rootPath, std::vector<std::wstring>& ret, - std::wstring strSuf) +void scanFilesUseRecursive(std::wstring const& rootPath, std::vector<std::wstring>& ret, std::wstring suf) { - scanFilesUseRecursive(rootPath, ret, strSuf); - std::vector<std::wstring> names; - for (auto& it : ret) + namespace fs = boost::filesystem; + boost::to_lower(suf); + + fs::path fullpath(rootPath); + if (!fs::exists(fullpath)) + { + return; + } + fs::recursive_directory_iterator end_iter; + for (fs::recursive_directory_iterator iter(fullpath); iter != end_iter; iter++) + { + try { - if (it.size() >= rootPath.size()) + if (!fs::is_directory(*iter) && fs::is_regular_file(*iter)) + { + auto temp_path = iter->path().wstring(); + auto size = suf.size(); + if (!size) { - names.push_back(it.substr(rootPath.size())); + ret.push_back(std::move(temp_path)); } - } - ret.swap(names); -} + else + { -void scanFileNamesUseRecursive(const std::string& rootPath, std::vector<std::string>& ret, std::string strSuf) -{ - std::vector<std::wstring> out; - scanFileNamesUseRecursive(s2ws(rootPath), out, s2ws(strSuf)); - for (auto& it : out) + if (temp_path.size() < size) + { + continue; + } + auto suf_temp = temp_path.substr(temp_path.size() - size); + boost::to_lower(suf_temp); + if (suf_temp == suf) + { + ret.push_back(std::move(temp_path)); + } + } + } + } + catch (std::exception const&) { - ret.push_back(ws2s(it)); + continue; } + } } -void scanFilesUseRecursive(const std::string& rootPath, std::vector<std::string>& ret, std::string strSuf) +void scanFileNamesUseRecursive(std::wstring const& rootPath, std::vector<std::wstring>& ret, std::wstring strSuf) { - std::vector<std::wstring> out; - scanFilesUseRecursive(s2ws(rootPath), out, s2ws(strSuf)); - for (auto& it : out) + scanFilesUseRecursive(rootPath, ret, strSuf); + std::vector<std::wstring> names; + for (auto& it : ret) + { + if (it.size() >= rootPath.size()) { - ret.push_back(ws2s(it)); + names.push_back(it.substr(rootPath.size())); } + } + ret.swap(names); } +void scanFileNamesUseRecursive(std::string const& rootPath, std::vector<std::string>& ret, std::string strSuf) +{ + std::vector<std::wstring> out; + scanFileNamesUseRecursive(s2ws(rootPath), out, s2ws(strSuf)); + for (auto& it : out) + { + ret.push_back(ws2s(it)); + } +} +void scanFilesUseRecursive(std::string const& rootPath, std::vector<std::string>& ret, std::string strSuf) +{ + std::vector<std::wstring> out; + scanFilesUseRecursive(s2ws(rootPath), out, s2ws(strSuf)); + for (auto& it : out) + { + ret.push_back(ws2s(it)); + } } + +} // namespace lsp diff --git a/graphics/asymptote/LspCpp/src/lsp/working_files.cpp b/graphics/asymptote/LspCpp/src/lsp/working_files.cpp index 4eb4b29053..a77f763cda 100644 --- a/graphics/asymptote/LspCpp/src/lsp/working_files.cpp +++ b/graphics/asymptote/LspCpp/src/lsp/working_files.cpp @@ -8,167 +8,165 @@ using namespace lsp; struct WorkingFilesData { - std::map<AbsolutePath, std::shared_ptr<WorkingFile> > files; - std::mutex files_mutex; // Protects |d_ptr->files|. + std::map<AbsolutePath, std::shared_ptr<WorkingFile>> files; + std::mutex files_mutex; // Protects |d_ptr->files|. }; -WorkingFile::WorkingFile(WorkingFiles& _parent, const AbsolutePath& filename, - const std::string& buffer_content) - : filename(filename), directory(filename), parent(_parent), counter(0), buffer_content(buffer_content) +WorkingFile::WorkingFile(WorkingFiles& _parent, AbsolutePath const& filename, std::string const& buffer_content) + : filename(filename), directory(filename), parent(_parent), counter(0), buffer_content(buffer_content) { - directory = Directory(GetDirName(filename.path)); + directory = Directory(GetDirName(filename.path)); } -WorkingFile::WorkingFile(WorkingFiles& _parent, const AbsolutePath& filename, - std::string&& buffer_content) - : filename(filename), directory(filename), parent(_parent), counter(0), buffer_content(buffer_content) +WorkingFile::WorkingFile(WorkingFiles& _parent, AbsolutePath const& filename, std::string&& buffer_content) + : filename(filename), directory(filename), parent(_parent), counter(0), buffer_content(buffer_content) { directory = Directory(GetDirName(filename.path)); } -WorkingFiles::WorkingFiles():d_ptr(new WorkingFilesData()) +WorkingFiles::WorkingFiles() : d_ptr(new WorkingFilesData()) { } WorkingFiles::~WorkingFiles() { delete d_ptr; - } - - -void WorkingFiles::CloseFilesInDirectory(const std::vector<Directory>& directories) +void WorkingFiles::CloseFilesInDirectory(std::vector<Directory> const& directories) { std::lock_guard<std::mutex> lock(d_ptr->files_mutex); std::vector<AbsolutePath> files_to_be_delete; - for(auto& it : d_ptr->files) + for (auto& it : d_ptr->files) { for (auto& dir : directories) { - if (it.second->directory == dir) { + if (it.second->directory == dir) + { files_to_be_delete.emplace_back(it.first); } } } - for(auto& it : files_to_be_delete) + for (auto& it : files_to_be_delete) { d_ptr->files.erase(it); } } - - - -std::shared_ptr<WorkingFile> WorkingFiles::GetFileByFilename(const AbsolutePath& filename) { - std::lock_guard<std::mutex> lock(d_ptr->files_mutex); - return GetFileByFilenameNoLock(filename); +std::shared_ptr<WorkingFile> WorkingFiles::GetFileByFilename(AbsolutePath const& filename) +{ + std::lock_guard<std::mutex> lock(d_ptr->files_mutex); + return GetFileByFilenameNoLock(filename); } -std::shared_ptr<WorkingFile> WorkingFiles::GetFileByFilenameNoLock( - const AbsolutePath& filename) { - const auto findIt = d_ptr->files.find(filename); - if ( findIt != d_ptr->files.end()) +std::shared_ptr<WorkingFile> WorkingFiles::GetFileByFilenameNoLock(AbsolutePath const& filename) +{ + auto const findIt = d_ptr->files.find(filename); + if (findIt != d_ptr->files.end()) { return findIt->second; } - return nullptr; + return nullptr; } +std::shared_ptr<WorkingFile> WorkingFiles::OnOpen(lsTextDocumentItem& open) +{ + std::lock_guard<std::mutex> lock(d_ptr->files_mutex); + AbsolutePath filename = open.uri.GetAbsolutePath(); -std::shared_ptr<WorkingFile> WorkingFiles::OnOpen( lsTextDocumentItem& open) { - std::lock_guard<std::mutex> lock(d_ptr->files_mutex); - - AbsolutePath filename = open.uri.GetAbsolutePath(); - - // The file may already be open. - if (auto file = GetFileByFilenameNoLock(filename)) { - file->version = open.version; - file->buffer_content.swap(open.text); + // The file may already be open. + if (auto file = GetFileByFilenameNoLock(filename)) + { + file->version = open.version; + file->buffer_content.swap(open.text); - return file; - } + return file; + } - const auto& it = d_ptr->files.insert({ filename,std::make_shared<WorkingFile>(*this,filename, std::move(open.text)) }); - return it.first->second; + auto const& it = + d_ptr->files.insert({filename, std::make_shared<WorkingFile>(*this, filename, std::move(open.text))}); + return it.first->second; } +std::shared_ptr<WorkingFile> WorkingFiles::OnChange(lsTextDocumentDidChangeParams const& change) +{ + std::lock_guard<std::mutex> lock(d_ptr->files_mutex); -std::shared_ptr<WorkingFile> WorkingFiles::OnChange(const lsTextDocumentDidChangeParams& change) { - std::lock_guard<std::mutex> lock(d_ptr->files_mutex); - - AbsolutePath filename = change.textDocument.uri.GetAbsolutePath(); - auto file = GetFileByFilenameNoLock(filename); - if (!file) { - return {}; - } - - if (change.textDocument.version) - file->version = *change.textDocument.version; - file->counter.fetch_add(1, std::memory_order_relaxed); - for (const lsTextDocumentContentChangeEvent& diff : change.contentChanges) { - // Per the spec replace everything if the rangeLength and range are not set. - // See https://github.com/Microsoft/language-server-protocol/issues/9. - if (!diff.range) { - file->buffer_content = diff.text; - - } else { - int start_offset = - GetOffsetForPosition(diff.range->start, file->buffer_content); - // Ignore TextDocumentContentChangeEvent.rangeLength which causes trouble - // when UTF-16 surrogate pairs are used. - int end_offset = - GetOffsetForPosition(diff.range->end, file->buffer_content); - file->buffer_content.replace(file->buffer_content.begin() + start_offset, - file->buffer_content.begin() + end_offset, - diff.text); + AbsolutePath filename = change.textDocument.uri.GetAbsolutePath(); + auto file = GetFileByFilenameNoLock(filename); + if (!file) + { + return {}; + } + if (change.textDocument.version) + { + file->version = *change.textDocument.version; + } + file->counter.fetch_add(1, std::memory_order_relaxed); + for (lsTextDocumentContentChangeEvent const& diff : change.contentChanges) + { + // Per the spec replace everything if the rangeLength and range are not set. + // See https://github.com/Microsoft/language-server-protocol/issues/9. + if (!diff.range) + { + file->buffer_content = diff.text; + } + else + { + int start_offset = GetOffsetForPosition(diff.range->start, file->buffer_content); + // Ignore TextDocumentContentChangeEvent.rangeLength which causes trouble + // when UTF-16 surrogate pairs are used. + int end_offset = GetOffsetForPosition(diff.range->end, file->buffer_content); + file->buffer_content.replace( + file->buffer_content.begin() + start_offset, file->buffer_content.begin() + end_offset, diff.text + ); + } } - } - return file; + return file; } -bool WorkingFiles::OnClose(const lsTextDocumentIdentifier& close) { - std::lock_guard<std::mutex> lock(d_ptr->files_mutex); - - AbsolutePath filename = close.uri.GetAbsolutePath(); - const auto findIt = d_ptr->files.find(filename); - if( findIt != d_ptr->files.end()) - { - d_ptr->files.erase(findIt); - return true; - } - return false; +bool WorkingFiles::OnClose(lsTextDocumentIdentifier const& close) +{ + std::lock_guard<std::mutex> lock(d_ptr->files_mutex); + + AbsolutePath filename = close.uri.GetAbsolutePath(); + auto const findIt = d_ptr->files.find(filename); + if (findIt != d_ptr->files.end()) + { + d_ptr->files.erase(findIt); + return true; + } + return false; } -std::shared_ptr<WorkingFile> WorkingFiles::OnSave(const lsTextDocumentIdentifier& _save) +std::shared_ptr<WorkingFile> WorkingFiles::OnSave(lsTextDocumentIdentifier const& _save) { std::lock_guard<std::mutex> lock(d_ptr->files_mutex); AbsolutePath filename = _save.uri.GetAbsolutePath(); - const auto findIt = d_ptr->files.find(filename); + auto const findIt = d_ptr->files.find(filename); if (findIt != d_ptr->files.end()) { std::shared_ptr<WorkingFile>& file = findIt->second; lsp::WriteToFile(file->filename, file->GetContentNoLock()); return findIt->second; } - return {}; - + return {}; } -bool WorkingFiles::GetFileBufferContent(std::shared_ptr<WorkingFile>&file, std::string& out) +bool WorkingFiles::GetFileBufferContent(std::shared_ptr<WorkingFile>& file, std::string& out) { std::lock_guard<std::mutex> lock(d_ptr->files_mutex); if (file) { out = file->buffer_content; - return true; + return true; } - return false; + return false; } bool WorkingFiles::GetFileBufferContent(std::shared_ptr<WorkingFile>& file, std::wstring& out) { @@ -176,11 +174,12 @@ bool WorkingFiles::GetFileBufferContent(std::shared_ptr<WorkingFile>& file, std: if (file) { out = lsp::s2ws(file->buffer_content); - return true; + return true; } - return false; + return false; } -void WorkingFiles::Clear() { +void WorkingFiles::Clear() +{ std::lock_guard<std::mutex> lock(d_ptr->files_mutex); d_ptr->files.clear(); } diff --git a/graphics/asymptote/LspCpp/support/cmake/JoinPaths.cmake b/graphics/asymptote/LspCpp/support/cmake/JoinPaths.cmake new file mode 100755 index 0000000000..32d6d6685c --- /dev/null +++ b/graphics/asymptote/LspCpp/support/cmake/JoinPaths.cmake @@ -0,0 +1,26 @@ +# This module provides function for joining paths +# known from from most languages +# +# Original license: +# SPDX-License-Identifier: (MIT OR CC0-1.0) +# Explicit permission given to distribute this module under +# the terms of the project as described in /LICENSE.rst. +# Copyright 2020 Jan Tojnar +# https://github.com/jtojnar/cmake-snips +# +# Modelled after Python’s os.path.join +# https://docs.python.org/3.7/library/os.path.html#os.path.join +# Windows not supported +function(join_paths joined_path first_path_segment) + set(temp_path "${first_path_segment}") + foreach(current_segment IN LISTS ARGN) + if(NOT ("${current_segment}" STREQUAL "")) + if(IS_ABSOLUTE "${current_segment}") + set(temp_path "${current_segment}") + else() + set(temp_path "${temp_path}/${current_segment}") + endif() + endif() + endforeach() + set(${joined_path} "${temp_path}" PARENT_SCOPE) +endfunction() diff --git a/graphics/asymptote/LspCpp/distclean.cmake b/graphics/asymptote/LspCpp/support/cmake/distclean.cmake index 8e814a170c..8e814a170c 100644 --- a/graphics/asymptote/LspCpp/distclean.cmake +++ b/graphics/asymptote/LspCpp/support/cmake/distclean.cmake diff --git a/graphics/asymptote/LspCpp/support/cmake/lspcpp-config.cmake.in b/graphics/asymptote/LspCpp/support/cmake/lspcpp-config.cmake.in new file mode 100755 index 0000000000..2fbacadd52 --- /dev/null +++ b/graphics/asymptote/LspCpp/support/cmake/lspcpp-config.cmake.in @@ -0,0 +1,7 @@ +@PACKAGE_INIT@ + +if (NOT TARGET lspcpp::lspcpp) + include(${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake) +endif () + +check_required_components(lspcpp) diff --git a/graphics/asymptote/LspCpp/support/cmake/lspcpp.pc.in b/graphics/asymptote/LspCpp/support/cmake/lspcpp.pc.in new file mode 100755 index 0000000000..9502de0860 --- /dev/null +++ b/graphics/asymptote/LspCpp/support/cmake/lspcpp.pc.in @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@libdir_for_pc_file@ +includedir=@includedir_for_pc_file@ + +Name: lsp +Description: A Language Server Protocol implementation in C++ +Version: @LIB_VERSION_STRING@ +Libs: -L${libdir} -l@LSPCPP_LIB_NAME@ +Cflags: -I${includedir} + diff --git a/graphics/asymptote/LspCpp/third_party/uri/CMakeFiles/CMakeDirectoryInformation.cmake b/graphics/asymptote/LspCpp/third_party/uri/CMakeFiles/CMakeDirectoryInformation.cmake index 972288b7e2..cf270aa6c6 100644 --- a/graphics/asymptote/LspCpp/third_party/uri/CMakeFiles/CMakeDirectoryInformation.cmake +++ b/graphics/asymptote/LspCpp/third_party/uri/CMakeFiles/CMakeDirectoryInformation.cmake @@ -1,9 +1,9 @@ # CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.28 +# Generated by "Unix Makefiles" Generator, CMake Version 3.30 # Relative path conversion top directories. -set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/usr/local/src/asymptote-2.95/LspCpp") -set(CMAKE_RELATIVE_PATH_TOP_BINARY "/usr/local/src/asymptote-2.95/LspCpp") +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/usr/local/src/asymptote-2.96/LspCpp") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "/usr/local/src/asymptote-2.96/LspCpp") # Force unix paths in dependencies. set(CMAKE_FORCE_UNIX_PATHS 1) diff --git a/graphics/asymptote/LspCpp/third_party/uri/CMakeFiles/doc.dir/build.make b/graphics/asymptote/LspCpp/third_party/uri/CMakeFiles/doc.dir/build.make index 334a9e210e..fe86c34683 100644 --- a/graphics/asymptote/LspCpp/third_party/uri/CMakeFiles/doc.dir/build.make +++ b/graphics/asymptote/LspCpp/third_party/uri/CMakeFiles/doc.dir/build.make @@ -1,5 +1,5 @@ # CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.28 +# Generated by "Unix Makefiles" Generator, CMake Version 3.30 # Delete rule output on recipe failure. .DELETE_ON_ERROR: @@ -56,10 +56,10 @@ RM = /usr/bin/cmake -E rm -f EQUALS = = # The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /usr/local/src/asymptote-2.95/LspCpp +CMAKE_SOURCE_DIR = /usr/local/src/asymptote-2.96/LspCpp # The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /usr/local/src/asymptote-2.95/LspCpp +CMAKE_BINARY_DIR = /usr/local/src/asymptote-2.96/LspCpp # Utility rule file for doc. @@ -70,8 +70,8 @@ include third_party/uri/CMakeFiles/doc.dir/compiler_depend.make include third_party/uri/CMakeFiles/doc.dir/progress.make third_party/uri/CMakeFiles/doc: - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --blue --bold --progress-dir=/usr/local/src/asymptote-2.95/LspCpp/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Generating API documentation with Doxygen" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri && /bin/doxygen /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/Doxyfile + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --blue --bold --progress-dir=/usr/local/src/asymptote-2.96/LspCpp/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Generating API documentation with Doxygen" + cd /usr/local/src/asymptote-2.96/LspCpp/third_party/uri && /bin/doxygen /usr/local/src/asymptote-2.96/LspCpp/third_party/uri/Doxyfile doc: third_party/uri/CMakeFiles/doc doc: third_party/uri/CMakeFiles/doc.dir/build.make @@ -82,10 +82,10 @@ third_party/uri/CMakeFiles/doc.dir/build: doc .PHONY : third_party/uri/CMakeFiles/doc.dir/build third_party/uri/CMakeFiles/doc.dir/clean: - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri && $(CMAKE_COMMAND) -P CMakeFiles/doc.dir/cmake_clean.cmake + cd /usr/local/src/asymptote-2.96/LspCpp/third_party/uri && $(CMAKE_COMMAND) -P CMakeFiles/doc.dir/cmake_clean.cmake .PHONY : third_party/uri/CMakeFiles/doc.dir/clean third_party/uri/CMakeFiles/doc.dir/depend: - cd /usr/local/src/asymptote-2.95/LspCpp && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /usr/local/src/asymptote-2.95/LspCpp /usr/local/src/asymptote-2.95/LspCpp/third_party/uri /usr/local/src/asymptote-2.95/LspCpp /usr/local/src/asymptote-2.95/LspCpp/third_party/uri /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/CMakeFiles/doc.dir/DependInfo.cmake "--color=$(COLOR)" + cd /usr/local/src/asymptote-2.96/LspCpp && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /usr/local/src/asymptote-2.96/LspCpp /usr/local/src/asymptote-2.96/LspCpp/third_party/uri /usr/local/src/asymptote-2.96/LspCpp /usr/local/src/asymptote-2.96/LspCpp/third_party/uri /usr/local/src/asymptote-2.96/LspCpp/third_party/uri/CMakeFiles/doc.dir/DependInfo.cmake "--color=$(COLOR)" .PHONY : third_party/uri/CMakeFiles/doc.dir/depend diff --git a/graphics/asymptote/LspCpp/third_party/uri/Doxyfile b/graphics/asymptote/LspCpp/third_party/uri/Doxyfile index 559bea2d9c..f6e26f71e3 100644 --- a/graphics/asymptote/LspCpp/third_party/uri/Doxyfile +++ b/graphics/asymptote/LspCpp/third_party/uri/Doxyfile @@ -128,7 +128,7 @@ FULL_PATH_NAMES = YES # If left blank the directory from which doxygen is run is used as the # path to strip. -STRIP_FROM_PATH = /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/ +STRIP_FROM_PATH = /usr/local/src/asymptote-2.96/LspCpp/third_party/uri/include/ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells @@ -626,7 +626,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include +INPUT = /usr/local/src/asymptote-2.96/LspCpp/third_party/uri/include # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is @@ -658,7 +658,7 @@ RECURSIVE = YES # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail +EXCLUDE = /usr/local/src/asymptote-2.96/LspCpp/third_party/uri/include/network/uri/detail # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded @@ -821,7 +821,7 @@ COLS_IN_ALPHA_INDEX = 5 # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. -IGNORE_PREFIX = /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/uri/src/ +IGNORE_PREFIX = /usr/local/src/asymptote-2.96/LspCpp/third_party/uri/uri/src/ #--------------------------------------------------------------------------- # configuration options related to the HTML output diff --git a/graphics/asymptote/LspCpp/third_party/uri/Makefile b/graphics/asymptote/LspCpp/third_party/uri/Makefile new file mode 100644 index 0000000000..3e85e18eff --- /dev/null +++ b/graphics/asymptote/LspCpp/third_party/uri/Makefile @@ -0,0 +1,207 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.30 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Produce verbose output by default. +VERBOSE = 1 + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /usr/local/src/asymptote-2.96/LspCpp + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /usr/local/src/asymptote-2.96/LspCpp + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake cache editor..." + /usr/bin/ccmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Available install components are: \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components +.PHONY : list_install_components/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# The main all target +all: cmake_check_build_system + cd /usr/local/src/asymptote-2.96/LspCpp && $(CMAKE_COMMAND) -E cmake_progress_start /usr/local/src/asymptote-2.96/LspCpp/CMakeFiles /usr/local/src/asymptote-2.96/LspCpp/third_party/uri//CMakeFiles/progress.marks + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 third_party/uri/all + $(CMAKE_COMMAND) -E cmake_progress_start /usr/local/src/asymptote-2.96/LspCpp/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 third_party/uri/clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 third_party/uri/preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 third_party/uri/preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + cd /usr/local/src/asymptote-2.96/LspCpp && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +# Convenience name for target. +third_party/uri/CMakeFiles/doc.dir/rule: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 third_party/uri/CMakeFiles/doc.dir/rule +.PHONY : third_party/uri/CMakeFiles/doc.dir/rule + +# Convenience name for target. +doc: third_party/uri/CMakeFiles/doc.dir/rule +.PHONY : doc + +# fast build rule for target. +doc/fast: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/CMakeFiles/doc.dir/build.make third_party/uri/CMakeFiles/doc.dir/build +.PHONY : doc/fast + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... install" + @echo "... install/local" + @echo "... install/strip" + @echo "... list_install_components" + @echo "... rebuild_cache" + @echo "... doc" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + cd /usr/local/src/asymptote-2.96/LspCpp && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/graphics/asymptote/LspCpp/third_party/uri/cmake_install.cmake b/graphics/asymptote/LspCpp/third_party/uri/cmake_install.cmake new file mode 100644 index 0000000000..94acff2e0a --- /dev/null +++ b/graphics/asymptote/LspCpp/third_party/uri/cmake_install.cmake @@ -0,0 +1,54 @@ +# Install script for directory: /usr/local/src/asymptote-2.96/LspCpp/third_party/uri + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "0") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set path to fallback-tool for dependency-resolution. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/." TYPE DIRECTORY FILES "/usr/local/src/asymptote-2.96/LspCpp/third_party/uri/include") +endif() + +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + # Include the install script for each subdirectory. + include("/usr/local/src/asymptote-2.96/LspCpp/third_party/uri/src/cmake_install.cmake") + +endif() + diff --git a/graphics/asymptote/LspCpp/third_party/uri/include/network/uri/detail/translate.hpp b/graphics/asymptote/LspCpp/third_party/uri/include/network/uri/detail/translate.hpp index 7566c258e1..7e1949fe88 100644 --- a/graphics/asymptote/LspCpp/third_party/uri/include/network/uri/detail/translate.hpp +++ b/graphics/asymptote/LspCpp/third_party/uri/include/network/uri/detail/translate.hpp @@ -7,6 +7,7 @@ #define NETWORK_URI_DETAIL_TRANSLATE_INC #include <string> +#include <algorithm> namespace network { namespace detail { @@ -41,7 +42,14 @@ struct translate_impl<const char[N]> { template <> struct translate_impl<std::wstring> { std::string operator()(const std::wstring &source) const { - return std::string(std::begin(source), std::end(source)); + std::string ret(source.length(), 0); + std::transform( + source.begin(), + source.end(), + ret.begin(), + [](wchar_t ch) { return static_cast<char>(ch); } + ); + return ret; } }; diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/CMakeDirectoryInformation.cmake b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/CMakeDirectoryInformation.cmake deleted file mode 100644 index 972288b7e2..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/CMakeDirectoryInformation.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.28 - -# Relative path conversion top directories. -set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/usr/local/src/asymptote-2.95/LspCpp") -set(CMAKE_RELATIVE_PATH_TOP_BINARY "/usr/local/src/asymptote-2.95/LspCpp") - -# Force unix paths in dependencies. -set(CMAKE_FORCE_UNIX_PATHS 1) - - -# The C and CXX include file regular expressions for this directory. -set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") -set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") -set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) -set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/DependInfo.cmake b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/DependInfo.cmake deleted file mode 100644 index b023b49c09..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/DependInfo.cmake +++ /dev/null @@ -1,30 +0,0 @@ - -# Consider dependencies only in project. -set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) - -# The set of languages for which implicit dependencies are needed: -set(CMAKE_DEPENDS_LANGUAGES - ) - -# The set of dependency files which are needed: -set(CMAKE_DEPENDS_DEPENDENCY_FILES - "/usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_advance_parts.cpp" "third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o" "gcc" "third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o.d" - "/usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_normalize.cpp" "third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o" "gcc" "third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o.d" - "/usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_parse.cpp" "third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o" "gcc" "third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o.d" - "/usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_parse_authority.cpp" "third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o" "gcc" "third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o.d" - "/usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_resolve.cpp" "third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o" "gcc" "third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o.d" - "/usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/uri.cpp" "third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.o" "gcc" "third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.o.d" - "/usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/uri_builder.cpp" "third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.o" "gcc" "third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.o.d" - "/usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/uri_errors.cpp" "third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.o" "gcc" "third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.o.d" - ) - -# Targets to which this target links which contain Fortran sources. -set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES - ) - -# Targets to which this target links which contain Fortran sources. -set(CMAKE_Fortran_TARGET_FORWARD_LINKED_INFO_FILES - ) - -# Fortran module output directory. -set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/build.make b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/build.make deleted file mode 100644 index 74dbc22feb..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/build.make +++ /dev/null @@ -1,226 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.28 - -# Delete rule output on recipe failure. -.DELETE_ON_ERROR: - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - -# Disable VCS-based implicit rules. -% : %,v - -# Disable VCS-based implicit rules. -% : RCS/% - -# Disable VCS-based implicit rules. -% : RCS/%,v - -# Disable VCS-based implicit rules. -% : SCCS/s.% - -# Disable VCS-based implicit rules. -% : s.% - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Produce verbose output by default. -VERBOSE = 1 - -# Command-line flag to silence nested $(MAKE). -$(VERBOSE)MAKESILENT = -s - -#Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /usr/bin/cmake - -# The command to remove a file. -RM = /usr/bin/cmake -E rm -f - -# Escaping for special characters. -EQUALS = = - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /usr/local/src/asymptote-2.95/LspCpp - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /usr/local/src/asymptote-2.95/LspCpp - -# Include any dependencies generated for this target. -include third_party/uri/src/CMakeFiles/network-uri.dir/depend.make -# Include any dependencies generated by the compiler for this target. -include third_party/uri/src/CMakeFiles/network-uri.dir/compiler_depend.make - -# Include the progress variables for this target. -include third_party/uri/src/CMakeFiles/network-uri.dir/progress.make - -# Include the compile flags for this target's objects. -include third_party/uri/src/CMakeFiles/network-uri.dir/flags.make - -third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.o: third_party/uri/src/CMakeFiles/network-uri.dir/flags.make -third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.o: third_party/uri/src/uri.cpp -third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.o: third_party/uri/src/CMakeFiles/network-uri.dir/compiler_depend.ts - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/usr/local/src/asymptote-2.95/LspCpp/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.o" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.o -MF CMakeFiles/network-uri.dir/uri.cpp.o.d -o CMakeFiles/network-uri.dir/uri.cpp.o -c /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/uri.cpp - -third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.i: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing CXX source to CMakeFiles/network-uri.dir/uri.cpp.i" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/uri.cpp > CMakeFiles/network-uri.dir/uri.cpp.i - -third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.s: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling CXX source to assembly CMakeFiles/network-uri.dir/uri.cpp.s" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/uri.cpp -o CMakeFiles/network-uri.dir/uri.cpp.s - -third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.o: third_party/uri/src/CMakeFiles/network-uri.dir/flags.make -third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.o: third_party/uri/src/uri_builder.cpp -third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.o: third_party/uri/src/CMakeFiles/network-uri.dir/compiler_depend.ts - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/usr/local/src/asymptote-2.95/LspCpp/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building CXX object third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.o" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.o -MF CMakeFiles/network-uri.dir/uri_builder.cpp.o.d -o CMakeFiles/network-uri.dir/uri_builder.cpp.o -c /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/uri_builder.cpp - -third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.i: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing CXX source to CMakeFiles/network-uri.dir/uri_builder.cpp.i" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/uri_builder.cpp > CMakeFiles/network-uri.dir/uri_builder.cpp.i - -third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.s: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling CXX source to assembly CMakeFiles/network-uri.dir/uri_builder.cpp.s" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/uri_builder.cpp -o CMakeFiles/network-uri.dir/uri_builder.cpp.s - -third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.o: third_party/uri/src/CMakeFiles/network-uri.dir/flags.make -third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.o: third_party/uri/src/uri_errors.cpp -third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.o: third_party/uri/src/CMakeFiles/network-uri.dir/compiler_depend.ts - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/usr/local/src/asymptote-2.95/LspCpp/CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Building CXX object third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.o" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.o -MF CMakeFiles/network-uri.dir/uri_errors.cpp.o.d -o CMakeFiles/network-uri.dir/uri_errors.cpp.o -c /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/uri_errors.cpp - -third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.i: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing CXX source to CMakeFiles/network-uri.dir/uri_errors.cpp.i" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/uri_errors.cpp > CMakeFiles/network-uri.dir/uri_errors.cpp.i - -third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.s: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling CXX source to assembly CMakeFiles/network-uri.dir/uri_errors.cpp.s" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/uri_errors.cpp -o CMakeFiles/network-uri.dir/uri_errors.cpp.s - -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o: third_party/uri/src/CMakeFiles/network-uri.dir/flags.make -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o: third_party/uri/src/detail/uri_parse.cpp -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o: third_party/uri/src/CMakeFiles/network-uri.dir/compiler_depend.ts - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/usr/local/src/asymptote-2.95/LspCpp/CMakeFiles --progress-num=$(CMAKE_PROGRESS_4) "Building CXX object third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o -MF CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o.d -o CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o -c /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_parse.cpp - -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.i: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing CXX source to CMakeFiles/network-uri.dir/detail/uri_parse.cpp.i" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_parse.cpp > CMakeFiles/network-uri.dir/detail/uri_parse.cpp.i - -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.s: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling CXX source to assembly CMakeFiles/network-uri.dir/detail/uri_parse.cpp.s" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_parse.cpp -o CMakeFiles/network-uri.dir/detail/uri_parse.cpp.s - -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o: third_party/uri/src/CMakeFiles/network-uri.dir/flags.make -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o: third_party/uri/src/detail/uri_parse_authority.cpp -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o: third_party/uri/src/CMakeFiles/network-uri.dir/compiler_depend.ts - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/usr/local/src/asymptote-2.95/LspCpp/CMakeFiles --progress-num=$(CMAKE_PROGRESS_5) "Building CXX object third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o -MF CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o.d -o CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o -c /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_parse_authority.cpp - -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.i: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing CXX source to CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.i" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_parse_authority.cpp > CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.i - -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.s: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling CXX source to assembly CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.s" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_parse_authority.cpp -o CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.s - -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o: third_party/uri/src/CMakeFiles/network-uri.dir/flags.make -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o: third_party/uri/src/detail/uri_advance_parts.cpp -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o: third_party/uri/src/CMakeFiles/network-uri.dir/compiler_depend.ts - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/usr/local/src/asymptote-2.95/LspCpp/CMakeFiles --progress-num=$(CMAKE_PROGRESS_6) "Building CXX object third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o -MF CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o.d -o CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o -c /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_advance_parts.cpp - -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.i: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing CXX source to CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.i" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_advance_parts.cpp > CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.i - -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.s: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling CXX source to assembly CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.s" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_advance_parts.cpp -o CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.s - -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o: third_party/uri/src/CMakeFiles/network-uri.dir/flags.make -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o: third_party/uri/src/detail/uri_normalize.cpp -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o: third_party/uri/src/CMakeFiles/network-uri.dir/compiler_depend.ts - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/usr/local/src/asymptote-2.95/LspCpp/CMakeFiles --progress-num=$(CMAKE_PROGRESS_7) "Building CXX object third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o -MF CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o.d -o CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o -c /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_normalize.cpp - -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.i: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing CXX source to CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.i" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_normalize.cpp > CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.i - -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.s: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling CXX source to assembly CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.s" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_normalize.cpp -o CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.s - -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o: third_party/uri/src/CMakeFiles/network-uri.dir/flags.make -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o: third_party/uri/src/detail/uri_resolve.cpp -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o: third_party/uri/src/CMakeFiles/network-uri.dir/compiler_depend.ts - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/usr/local/src/asymptote-2.95/LspCpp/CMakeFiles --progress-num=$(CMAKE_PROGRESS_8) "Building CXX object third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o -MF CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o.d -o CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o -c /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_resolve.cpp - -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.i: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing CXX source to CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.i" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_resolve.cpp > CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.i - -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.s: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling CXX source to assembly CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.s" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && /bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_resolve.cpp -o CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.s - -# Object files for target network-uri -network__uri_OBJECTS = \ -"CMakeFiles/network-uri.dir/uri.cpp.o" \ -"CMakeFiles/network-uri.dir/uri_builder.cpp.o" \ -"CMakeFiles/network-uri.dir/uri_errors.cpp.o" \ -"CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o" \ -"CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o" \ -"CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o" \ -"CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o" \ -"CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o" - -# External object files for target network-uri -network__uri_EXTERNAL_OBJECTS = - -third_party/uri/src/libnetwork-uri.a: third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.o -third_party/uri/src/libnetwork-uri.a: third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.o -third_party/uri/src/libnetwork-uri.a: third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.o -third_party/uri/src/libnetwork-uri.a: third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o -third_party/uri/src/libnetwork-uri.a: third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o -third_party/uri/src/libnetwork-uri.a: third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o -third_party/uri/src/libnetwork-uri.a: third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o -third_party/uri/src/libnetwork-uri.a: third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o -third_party/uri/src/libnetwork-uri.a: third_party/uri/src/CMakeFiles/network-uri.dir/build.make -third_party/uri/src/libnetwork-uri.a: third_party/uri/src/CMakeFiles/network-uri.dir/link.txt - @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --bold --progress-dir=/usr/local/src/asymptote-2.95/LspCpp/CMakeFiles --progress-num=$(CMAKE_PROGRESS_9) "Linking CXX static library libnetwork-uri.a" - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && $(CMAKE_COMMAND) -P CMakeFiles/network-uri.dir/cmake_clean_target.cmake - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/network-uri.dir/link.txt --verbose=$(VERBOSE) - -# Rule to build all files generated by this target. -third_party/uri/src/CMakeFiles/network-uri.dir/build: third_party/uri/src/libnetwork-uri.a -.PHONY : third_party/uri/src/CMakeFiles/network-uri.dir/build - -third_party/uri/src/CMakeFiles/network-uri.dir/clean: - cd /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src && $(CMAKE_COMMAND) -P CMakeFiles/network-uri.dir/cmake_clean.cmake -.PHONY : third_party/uri/src/CMakeFiles/network-uri.dir/clean - -third_party/uri/src/CMakeFiles/network-uri.dir/depend: - cd /usr/local/src/asymptote-2.95/LspCpp && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /usr/local/src/asymptote-2.95/LspCpp /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src /usr/local/src/asymptote-2.95/LspCpp /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/DependInfo.cmake "--color=$(COLOR)" -.PHONY : third_party/uri/src/CMakeFiles/network-uri.dir/depend - diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/cmake_clean.cmake b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/cmake_clean.cmake deleted file mode 100644 index 1d050bed3e..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/cmake_clean.cmake +++ /dev/null @@ -1,25 +0,0 @@ -file(REMOVE_RECURSE - "CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o" - "CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o.d" - "CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o" - "CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o.d" - "CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o" - "CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o.d" - "CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o" - "CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o.d" - "CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o" - "CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o.d" - "CMakeFiles/network-uri.dir/uri.cpp.o" - "CMakeFiles/network-uri.dir/uri.cpp.o.d" - "CMakeFiles/network-uri.dir/uri_builder.cpp.o" - "CMakeFiles/network-uri.dir/uri_builder.cpp.o.d" - "CMakeFiles/network-uri.dir/uri_errors.cpp.o" - "CMakeFiles/network-uri.dir/uri_errors.cpp.o.d" - "libnetwork-uri.a" - "libnetwork-uri.pdb" -) - -# Per-language clean rules from dependency scanning. -foreach(lang CXX) - include(CMakeFiles/network-uri.dir/cmake_clean_${lang}.cmake OPTIONAL) -endforeach() diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/cmake_clean_target.cmake b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/cmake_clean_target.cmake deleted file mode 100644 index 0b9c366a69..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/cmake_clean_target.cmake +++ /dev/null @@ -1,3 +0,0 @@ -file(REMOVE_RECURSE - "libnetwork-uri.a" -) diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/compiler_depend.make b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/compiler_depend.make deleted file mode 100644 index bb6f743826..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/compiler_depend.make +++ /dev/null @@ -1,2 +0,0 @@ -# Empty compiler generated dependencies file for network-uri. -# This may be replaced when dependencies are built. diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/compiler_depend.ts b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/compiler_depend.ts deleted file mode 100644 index ff025e0c9e..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/compiler_depend.ts +++ /dev/null @@ -1,2 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Timestamp file for compiler generated dependencies management for network-uri. diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/depend.make b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/depend.make deleted file mode 100644 index 2b4283de4b..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/depend.make +++ /dev/null @@ -1,2 +0,0 @@ -# Empty dependencies file for network-uri. -# This may be replaced when dependencies are built. diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o Binary files differdeleted file mode 100644 index 2758270e35..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o +++ /dev/null diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o.d b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o.d deleted file mode 100644 index c0a4da1a9a..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o.d +++ /dev/null @@ -1,146 +0,0 @@ -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o: \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_advance_parts.cpp \ - /usr/include/stdc-predef.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_advance_parts.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/uri_parts.hpp \ - /usr/include/c++/14/string /usr/include/c++/14/bits/requires_hosted.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++config.h \ - /usr/include/bits/wordsize.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/os_defines.h \ - /usr/include/features.h /usr/include/features-time64.h \ - /usr/include/bits/timesize.h /usr/include/sys/cdefs.h \ - /usr/include/bits/long-double.h /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-64.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/cpu_defines.h \ - /usr/include/c++/14/bits/stringfwd.h \ - /usr/include/c++/14/bits/memoryfwd.h \ - /usr/include/c++/14/bits/char_traits.h \ - /usr/include/c++/14/bits/postypes.h /usr/include/c++/14/cwchar \ - /usr/include/wchar.h /usr/include/bits/libc-header-start.h \ - /usr/include/bits/floatn.h /usr/include/bits/floatn-common.h \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stddef.h \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stdarg.h \ - /usr/include/bits/wchar.h /usr/include/bits/types/wint_t.h \ - /usr/include/bits/types/mbstate_t.h \ - /usr/include/bits/types/__mbstate_t.h /usr/include/bits/types/__FILE.h \ - /usr/include/bits/types/FILE.h /usr/include/bits/types/locale_t.h \ - /usr/include/bits/types/__locale_t.h /usr/include/c++/14/type_traits \ - /usr/include/c++/14/bits/version.h /usr/include/c++/14/bits/allocator.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++allocator.h \ - /usr/include/c++/14/bits/new_allocator.h /usr/include/c++/14/new \ - /usr/include/c++/14/bits/exception.h \ - /usr/include/c++/14/bits/functexcept.h \ - /usr/include/c++/14/bits/exception_defines.h \ - /usr/include/c++/14/bits/move.h \ - /usr/include/c++/14/bits/cpp_type_traits.h \ - /usr/include/c++/14/bits/localefwd.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++locale.h \ - /usr/include/c++/14/clocale /usr/include/locale.h \ - /usr/include/bits/locale.h /usr/include/c++/14/iosfwd \ - /usr/include/c++/14/cctype /usr/include/ctype.h \ - /usr/include/bits/types.h /usr/include/bits/typesizes.h \ - /usr/include/bits/time64.h /usr/include/bits/endian.h \ - /usr/include/bits/endianness.h /usr/include/c++/14/bits/ostream_insert.h \ - /usr/include/c++/14/bits/cxxabi_forced.h \ - /usr/include/c++/14/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/14/bits/concept_check.h \ - /usr/include/c++/14/debug/assertions.h \ - /usr/include/c++/14/bits/stl_iterator_base_types.h \ - /usr/include/c++/14/bits/stl_iterator.h \ - /usr/include/c++/14/ext/type_traits.h \ - /usr/include/c++/14/bits/ptr_traits.h \ - /usr/include/c++/14/bits/stl_function.h \ - /usr/include/c++/14/backward/binders.h \ - /usr/include/c++/14/ext/numeric_traits.h \ - /usr/include/c++/14/bits/stl_algobase.h \ - /usr/include/c++/14/bits/stl_pair.h /usr/include/c++/14/bits/utility.h \ - /usr/include/c++/14/debug/debug.h \ - /usr/include/c++/14/bits/predefined_ops.h \ - /usr/include/c++/14/bits/refwrap.h /usr/include/c++/14/bits/invoke.h \ - /usr/include/c++/14/bits/range_access.h \ - /usr/include/c++/14/initializer_list \ - /usr/include/c++/14/bits/basic_string.h \ - /usr/include/c++/14/ext/alloc_traits.h \ - /usr/include/c++/14/bits/alloc_traits.h \ - /usr/include/c++/14/bits/stl_construct.h \ - /usr/include/c++/14/ext/string_conversions.h /usr/include/c++/14/cstdlib \ - /usr/include/stdlib.h /usr/include/bits/waitflags.h \ - /usr/include/bits/waitstatus.h /usr/include/sys/types.h \ - /usr/include/bits/types/clock_t.h /usr/include/bits/types/clockid_t.h \ - /usr/include/bits/types/time_t.h /usr/include/bits/types/timer_t.h \ - /usr/include/bits/stdint-intn.h /usr/include/endian.h \ - /usr/include/bits/byteswap.h /usr/include/bits/uintn-identity.h \ - /usr/include/sys/select.h /usr/include/bits/select.h \ - /usr/include/bits/types/sigset_t.h /usr/include/bits/types/__sigset_t.h \ - /usr/include/bits/types/struct_timeval.h \ - /usr/include/bits/types/struct_timespec.h \ - /usr/include/bits/pthreadtypes.h /usr/include/bits/thread-shared-types.h \ - /usr/include/bits/pthreadtypes-arch.h \ - /usr/include/bits/atomic_wide_counter.h /usr/include/bits/struct_mutex.h \ - /usr/include/bits/struct_rwlock.h /usr/include/alloca.h \ - /usr/include/bits/stdlib-bsearch.h /usr/include/bits/stdlib-float.h \ - /usr/include/c++/14/bits/std_abs.h /usr/include/c++/14/cstdio \ - /usr/include/stdio.h /usr/include/bits/types/__fpos_t.h \ - /usr/include/bits/types/__fpos64_t.h \ - /usr/include/bits/types/struct_FILE.h \ - /usr/include/bits/types/cookie_io_functions_t.h \ - /usr/include/bits/stdio_lim.h /usr/include/bits/stdio.h \ - /usr/include/c++/14/cerrno /usr/include/errno.h \ - /usr/include/bits/errno.h /usr/include/linux/errno.h \ - /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ - /usr/include/asm-generic/errno-base.h /usr/include/bits/types/error_t.h \ - /usr/include/c++/14/bits/charconv.h \ - /usr/include/c++/14/bits/functional_hash.h \ - /usr/include/c++/14/bits/hash_bytes.h \ - /usr/include/c++/14/bits/basic_string.tcc /usr/include/c++/14/utility \ - /usr/include/c++/14/bits/stl_relops.h /usr/include/c++/14/iterator \ - /usr/include/c++/14/bits/stream_iterator.h \ - /usr/include/c++/14/bits/streambuf_iterator.h \ - /usr/include/c++/14/streambuf /usr/include/c++/14/bits/ios_base.h \ - /usr/include/c++/14/ext/atomicity.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/gthr.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ - /usr/include/bits/types/struct_sched_param.h /usr/include/bits/cpu-set.h \ - /usr/include/time.h /usr/include/bits/time.h /usr/include/bits/timex.h \ - /usr/include/bits/types/struct_tm.h \ - /usr/include/bits/types/struct_itimerspec.h /usr/include/bits/setjmp.h \ - /usr/include/bits/types/struct___jmp_buf_tag.h \ - /usr/include/bits/pthread_stack_min-dynamic.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/atomic_word.h \ - /usr/include/sys/single_threaded.h \ - /usr/include/c++/14/bits/locale_classes.h \ - /usr/include/c++/14/bits/locale_classes.tcc \ - /usr/include/c++/14/system_error \ - /usr/include/c++/14/x86_64-redhat-linux/bits/error_constants.h \ - /usr/include/c++/14/stdexcept /usr/include/c++/14/exception \ - /usr/include/c++/14/bits/exception_ptr.h \ - /usr/include/c++/14/bits/cxxabi_init_exception.h \ - /usr/include/c++/14/typeinfo /usr/include/c++/14/bits/nested_exception.h \ - /usr/include/c++/14/bits/streambuf.tcc \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/optional.hpp \ - /usr/include/c++/14/memory /usr/include/c++/14/bits/stl_tempbuf.h \ - /usr/include/c++/14/bits/stl_uninitialized.h \ - /usr/include/c++/14/bits/stl_raw_storage_iter.h \ - /usr/include/c++/14/bits/align.h /usr/include/c++/14/bit \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stdint.h \ - /usr/include/stdint.h /usr/include/bits/stdint-uintn.h \ - /usr/include/bits/stdint-least.h \ - /usr/include/c++/14/bits/uses_allocator.h \ - /usr/include/c++/14/bits/unique_ptr.h /usr/include/c++/14/tuple \ - /usr/include/c++/14/bits/shared_ptr.h \ - /usr/include/c++/14/bits/shared_ptr_base.h \ - /usr/include/c++/14/bits/allocated_ptr.h \ - /usr/include/c++/14/ext/aligned_buffer.h \ - /usr/include/c++/14/ext/concurrence.h \ - /usr/include/c++/14/bits/shared_ptr_atomic.h \ - /usr/include/c++/14/bits/atomic_base.h \ - /usr/include/c++/14/bits/atomic_lockfree_defines.h \ - /usr/include/c++/14/backward/auto_ptr.h /usr/include/c++/14/algorithm \ - /usr/include/c++/14/bits/stl_algo.h \ - /usr/include/c++/14/bits/algorithmfwd.h \ - /usr/include/c++/14/bits/stl_heap.h \ - /usr/include/c++/14/bits/uniform_int_dist.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/string_view.hpp \ - /usr/include/c++/14/cassert /usr/include/assert.h \ - /usr/include/c++/14/limits diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o Binary files differdeleted file mode 100644 index bce9091fc9..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o +++ /dev/null diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o.d b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o.d deleted file mode 100644 index a85e6a75a0..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o.d +++ /dev/null @@ -1,171 +0,0 @@ -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o: \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_normalize.cpp \ - /usr/include/stdc-predef.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_normalize.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/uri.hpp \ - /usr/include/c++/14/iterator \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++config.h \ - /usr/include/bits/wordsize.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/os_defines.h \ - /usr/include/features.h /usr/include/features-time64.h \ - /usr/include/bits/timesize.h /usr/include/sys/cdefs.h \ - /usr/include/bits/long-double.h /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-64.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/cpu_defines.h \ - /usr/include/c++/14/bits/stl_iterator_base_types.h \ - /usr/include/c++/14/type_traits /usr/include/c++/14/bits/version.h \ - /usr/include/c++/14/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/14/bits/concept_check.h \ - /usr/include/c++/14/debug/assertions.h \ - /usr/include/c++/14/bits/stl_iterator.h \ - /usr/include/c++/14/bits/cpp_type_traits.h \ - /usr/include/c++/14/ext/type_traits.h /usr/include/c++/14/bits/move.h \ - /usr/include/c++/14/bits/ptr_traits.h \ - /usr/include/c++/14/bits/stream_iterator.h /usr/include/c++/14/iosfwd \ - /usr/include/c++/14/bits/requires_hosted.h \ - /usr/include/c++/14/bits/stringfwd.h \ - /usr/include/c++/14/bits/memoryfwd.h /usr/include/c++/14/bits/postypes.h \ - /usr/include/c++/14/cwchar /usr/include/wchar.h \ - /usr/include/bits/libc-header-start.h /usr/include/bits/floatn.h \ - /usr/include/bits/floatn-common.h \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stddef.h \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stdarg.h \ - /usr/include/bits/wchar.h /usr/include/bits/types/wint_t.h \ - /usr/include/bits/types/mbstate_t.h \ - /usr/include/bits/types/__mbstate_t.h /usr/include/bits/types/__FILE.h \ - /usr/include/bits/types/FILE.h /usr/include/bits/types/locale_t.h \ - /usr/include/bits/types/__locale_t.h /usr/include/c++/14/debug/debug.h \ - /usr/include/c++/14/bits/streambuf_iterator.h \ - /usr/include/c++/14/streambuf /usr/include/c++/14/bits/localefwd.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++locale.h \ - /usr/include/c++/14/clocale /usr/include/locale.h \ - /usr/include/bits/locale.h /usr/include/c++/14/cctype \ - /usr/include/ctype.h /usr/include/bits/types.h \ - /usr/include/bits/typesizes.h /usr/include/bits/time64.h \ - /usr/include/bits/endian.h /usr/include/bits/endianness.h \ - /usr/include/c++/14/bits/ios_base.h /usr/include/c++/14/ext/atomicity.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/gthr.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/sched.h \ - /usr/include/bits/types/time_t.h \ - /usr/include/bits/types/struct_timespec.h /usr/include/bits/sched.h \ - /usr/include/bits/types/struct_sched_param.h /usr/include/bits/cpu-set.h \ - /usr/include/time.h /usr/include/bits/time.h /usr/include/bits/timex.h \ - /usr/include/bits/types/struct_timeval.h \ - /usr/include/bits/types/clock_t.h /usr/include/bits/types/struct_tm.h \ - /usr/include/bits/types/clockid_t.h /usr/include/bits/types/timer_t.h \ - /usr/include/bits/types/struct_itimerspec.h \ - /usr/include/bits/pthreadtypes.h /usr/include/bits/thread-shared-types.h \ - /usr/include/bits/pthreadtypes-arch.h \ - /usr/include/bits/atomic_wide_counter.h /usr/include/bits/struct_mutex.h \ - /usr/include/bits/struct_rwlock.h /usr/include/bits/setjmp.h \ - /usr/include/bits/types/__sigset_t.h \ - /usr/include/bits/types/struct___jmp_buf_tag.h \ - /usr/include/bits/pthread_stack_min-dynamic.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/atomic_word.h \ - /usr/include/sys/single_threaded.h \ - /usr/include/c++/14/bits/locale_classes.h /usr/include/c++/14/string \ - /usr/include/c++/14/bits/char_traits.h \ - /usr/include/c++/14/bits/allocator.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++allocator.h \ - /usr/include/c++/14/bits/new_allocator.h /usr/include/c++/14/new \ - /usr/include/c++/14/bits/exception.h \ - /usr/include/c++/14/bits/functexcept.h \ - /usr/include/c++/14/bits/exception_defines.h \ - /usr/include/c++/14/bits/ostream_insert.h \ - /usr/include/c++/14/bits/cxxabi_forced.h \ - /usr/include/c++/14/bits/stl_function.h \ - /usr/include/c++/14/backward/binders.h \ - /usr/include/c++/14/ext/numeric_traits.h \ - /usr/include/c++/14/bits/stl_algobase.h \ - /usr/include/c++/14/bits/stl_pair.h /usr/include/c++/14/bits/utility.h \ - /usr/include/c++/14/bits/predefined_ops.h \ - /usr/include/c++/14/bits/refwrap.h /usr/include/c++/14/bits/invoke.h \ - /usr/include/c++/14/bits/range_access.h \ - /usr/include/c++/14/initializer_list \ - /usr/include/c++/14/bits/basic_string.h \ - /usr/include/c++/14/ext/alloc_traits.h \ - /usr/include/c++/14/bits/alloc_traits.h \ - /usr/include/c++/14/bits/stl_construct.h \ - /usr/include/c++/14/ext/string_conversions.h /usr/include/c++/14/cstdlib \ - /usr/include/stdlib.h /usr/include/bits/waitflags.h \ - /usr/include/bits/waitstatus.h /usr/include/sys/types.h \ - /usr/include/bits/stdint-intn.h /usr/include/endian.h \ - /usr/include/bits/byteswap.h /usr/include/bits/uintn-identity.h \ - /usr/include/sys/select.h /usr/include/bits/select.h \ - /usr/include/bits/types/sigset_t.h /usr/include/alloca.h \ - /usr/include/bits/stdlib-bsearch.h /usr/include/bits/stdlib-float.h \ - /usr/include/c++/14/bits/std_abs.h /usr/include/c++/14/cstdio \ - /usr/include/stdio.h /usr/include/bits/types/__fpos_t.h \ - /usr/include/bits/types/__fpos64_t.h \ - /usr/include/bits/types/struct_FILE.h \ - /usr/include/bits/types/cookie_io_functions_t.h \ - /usr/include/bits/stdio_lim.h /usr/include/bits/stdio.h \ - /usr/include/c++/14/cerrno /usr/include/errno.h \ - /usr/include/bits/errno.h /usr/include/linux/errno.h \ - /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ - /usr/include/asm-generic/errno-base.h /usr/include/bits/types/error_t.h \ - /usr/include/c++/14/bits/charconv.h \ - /usr/include/c++/14/bits/functional_hash.h \ - /usr/include/c++/14/bits/hash_bytes.h \ - /usr/include/c++/14/bits/basic_string.tcc \ - /usr/include/c++/14/bits/locale_classes.tcc \ - /usr/include/c++/14/system_error \ - /usr/include/c++/14/x86_64-redhat-linux/bits/error_constants.h \ - /usr/include/c++/14/stdexcept /usr/include/c++/14/exception \ - /usr/include/c++/14/bits/exception_ptr.h \ - /usr/include/c++/14/bits/cxxabi_init_exception.h \ - /usr/include/c++/14/typeinfo /usr/include/c++/14/bits/nested_exception.h \ - /usr/include/c++/14/bits/streambuf.tcc /usr/include/c++/14/algorithm \ - /usr/include/c++/14/bits/stl_algo.h \ - /usr/include/c++/14/bits/algorithmfwd.h \ - /usr/include/c++/14/bits/stl_heap.h \ - /usr/include/c++/14/bits/uniform_int_dist.h \ - /usr/include/c++/14/bits/stl_tempbuf.h /usr/include/c++/14/functional \ - /usr/include/c++/14/tuple /usr/include/c++/14/bits/uses_allocator.h \ - /usr/include/c++/14/bits/std_function.h /usr/include/c++/14/memory \ - /usr/include/c++/14/bits/stl_uninitialized.h \ - /usr/include/c++/14/bits/stl_raw_storage_iter.h \ - /usr/include/c++/14/bits/align.h /usr/include/c++/14/bit \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stdint.h \ - /usr/include/stdint.h /usr/include/bits/stdint-uintn.h \ - /usr/include/bits/stdint-least.h /usr/include/c++/14/bits/unique_ptr.h \ - /usr/include/c++/14/bits/shared_ptr.h \ - /usr/include/c++/14/bits/shared_ptr_base.h \ - /usr/include/c++/14/bits/allocated_ptr.h \ - /usr/include/c++/14/ext/aligned_buffer.h \ - /usr/include/c++/14/ext/concurrence.h \ - /usr/include/c++/14/bits/shared_ptr_atomic.h \ - /usr/include/c++/14/bits/atomic_base.h \ - /usr/include/c++/14/bits/atomic_lockfree_defines.h \ - /usr/include/c++/14/backward/auto_ptr.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/string_view.hpp \ - /usr/include/c++/14/cassert /usr/include/assert.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/optional.hpp \ - /usr/include/c++/14/utility /usr/include/c++/14/bits/stl_relops.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/config.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/uri_errors.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/uri_parts.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/encode.hpp \ - /usr/include/c++/14/cstring /usr/include/string.h /usr/include/strings.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/decode.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/translate.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/uri_builder.hpp \ - /usr/include/c++/14/cstdint \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_percent_encode.hpp \ - /usr/include/c++/14/vector /usr/include/c++/14/bits/stl_vector.h \ - /usr/include/c++/14/bits/stl_bvector.h \ - /usr/include/c++/14/bits/vector.tcc /usr/include/c++/14/locale \ - /usr/include/c++/14/bits/locale_facets.h /usr/include/c++/14/cwctype \ - /usr/include/wctype.h /usr/include/bits/wctype-wchar.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/ctype_base.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/ctype_inline.h \ - /usr/include/c++/14/bits/locale_facets.tcc \ - /usr/include/c++/14/bits/locale_facets_nonio.h /usr/include/c++/14/ctime \ - /usr/include/c++/14/x86_64-redhat-linux/bits/time_members.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/messages_members.h \ - /usr/include/libintl.h /usr/include/c++/14/bits/codecvt.h \ - /usr/include/c++/14/bits/locale_facets_nonio.tcc \ - /usr/include/c++/14/bits/locale_conv.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/algorithm.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/algorithm_split.hpp diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o Binary files differdeleted file mode 100644 index e20e21a8a5..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o +++ /dev/null diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o.d b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o.d deleted file mode 100644 index 0d5164010a..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o.d +++ /dev/null @@ -1,159 +0,0 @@ -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o: \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_parse.cpp \ - /usr/include/stdc-predef.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_parse.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/string_view.hpp \ - /usr/include/c++/14/string /usr/include/c++/14/bits/requires_hosted.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++config.h \ - /usr/include/bits/wordsize.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/os_defines.h \ - /usr/include/features.h /usr/include/features-time64.h \ - /usr/include/bits/timesize.h /usr/include/sys/cdefs.h \ - /usr/include/bits/long-double.h /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-64.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/cpu_defines.h \ - /usr/include/c++/14/bits/stringfwd.h \ - /usr/include/c++/14/bits/memoryfwd.h \ - /usr/include/c++/14/bits/char_traits.h \ - /usr/include/c++/14/bits/postypes.h /usr/include/c++/14/cwchar \ - /usr/include/wchar.h /usr/include/bits/libc-header-start.h \ - /usr/include/bits/floatn.h /usr/include/bits/floatn-common.h \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stddef.h \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stdarg.h \ - /usr/include/bits/wchar.h /usr/include/bits/types/wint_t.h \ - /usr/include/bits/types/mbstate_t.h \ - /usr/include/bits/types/__mbstate_t.h /usr/include/bits/types/__FILE.h \ - /usr/include/bits/types/FILE.h /usr/include/bits/types/locale_t.h \ - /usr/include/bits/types/__locale_t.h /usr/include/c++/14/type_traits \ - /usr/include/c++/14/bits/version.h /usr/include/c++/14/bits/allocator.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++allocator.h \ - /usr/include/c++/14/bits/new_allocator.h /usr/include/c++/14/new \ - /usr/include/c++/14/bits/exception.h \ - /usr/include/c++/14/bits/functexcept.h \ - /usr/include/c++/14/bits/exception_defines.h \ - /usr/include/c++/14/bits/move.h \ - /usr/include/c++/14/bits/cpp_type_traits.h \ - /usr/include/c++/14/bits/localefwd.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++locale.h \ - /usr/include/c++/14/clocale /usr/include/locale.h \ - /usr/include/bits/locale.h /usr/include/c++/14/iosfwd \ - /usr/include/c++/14/cctype /usr/include/ctype.h \ - /usr/include/bits/types.h /usr/include/bits/typesizes.h \ - /usr/include/bits/time64.h /usr/include/bits/endian.h \ - /usr/include/bits/endianness.h /usr/include/c++/14/bits/ostream_insert.h \ - /usr/include/c++/14/bits/cxxabi_forced.h \ - /usr/include/c++/14/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/14/bits/concept_check.h \ - /usr/include/c++/14/debug/assertions.h \ - /usr/include/c++/14/bits/stl_iterator_base_types.h \ - /usr/include/c++/14/bits/stl_iterator.h \ - /usr/include/c++/14/ext/type_traits.h \ - /usr/include/c++/14/bits/ptr_traits.h \ - /usr/include/c++/14/bits/stl_function.h \ - /usr/include/c++/14/backward/binders.h \ - /usr/include/c++/14/ext/numeric_traits.h \ - /usr/include/c++/14/bits/stl_algobase.h \ - /usr/include/c++/14/bits/stl_pair.h /usr/include/c++/14/bits/utility.h \ - /usr/include/c++/14/debug/debug.h \ - /usr/include/c++/14/bits/predefined_ops.h \ - /usr/include/c++/14/bits/refwrap.h /usr/include/c++/14/bits/invoke.h \ - /usr/include/c++/14/bits/range_access.h \ - /usr/include/c++/14/initializer_list \ - /usr/include/c++/14/bits/basic_string.h \ - /usr/include/c++/14/ext/alloc_traits.h \ - /usr/include/c++/14/bits/alloc_traits.h \ - /usr/include/c++/14/bits/stl_construct.h \ - /usr/include/c++/14/ext/string_conversions.h /usr/include/c++/14/cstdlib \ - /usr/include/stdlib.h /usr/include/bits/waitflags.h \ - /usr/include/bits/waitstatus.h /usr/include/sys/types.h \ - /usr/include/bits/types/clock_t.h /usr/include/bits/types/clockid_t.h \ - /usr/include/bits/types/time_t.h /usr/include/bits/types/timer_t.h \ - /usr/include/bits/stdint-intn.h /usr/include/endian.h \ - /usr/include/bits/byteswap.h /usr/include/bits/uintn-identity.h \ - /usr/include/sys/select.h /usr/include/bits/select.h \ - /usr/include/bits/types/sigset_t.h /usr/include/bits/types/__sigset_t.h \ - /usr/include/bits/types/struct_timeval.h \ - /usr/include/bits/types/struct_timespec.h \ - /usr/include/bits/pthreadtypes.h /usr/include/bits/thread-shared-types.h \ - /usr/include/bits/pthreadtypes-arch.h \ - /usr/include/bits/atomic_wide_counter.h /usr/include/bits/struct_mutex.h \ - /usr/include/bits/struct_rwlock.h /usr/include/alloca.h \ - /usr/include/bits/stdlib-bsearch.h /usr/include/bits/stdlib-float.h \ - /usr/include/c++/14/bits/std_abs.h /usr/include/c++/14/cstdio \ - /usr/include/stdio.h /usr/include/bits/types/__fpos_t.h \ - /usr/include/bits/types/__fpos64_t.h \ - /usr/include/bits/types/struct_FILE.h \ - /usr/include/bits/types/cookie_io_functions_t.h \ - /usr/include/bits/stdio_lim.h /usr/include/bits/stdio.h \ - /usr/include/c++/14/cerrno /usr/include/errno.h \ - /usr/include/bits/errno.h /usr/include/linux/errno.h \ - /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ - /usr/include/asm-generic/errno-base.h /usr/include/bits/types/error_t.h \ - /usr/include/c++/14/bits/charconv.h \ - /usr/include/c++/14/bits/functional_hash.h \ - /usr/include/c++/14/bits/hash_bytes.h \ - /usr/include/c++/14/bits/basic_string.tcc /usr/include/c++/14/iterator \ - /usr/include/c++/14/bits/stream_iterator.h \ - /usr/include/c++/14/bits/streambuf_iterator.h \ - /usr/include/c++/14/streambuf /usr/include/c++/14/bits/ios_base.h \ - /usr/include/c++/14/ext/atomicity.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/gthr.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ - /usr/include/bits/types/struct_sched_param.h /usr/include/bits/cpu-set.h \ - /usr/include/time.h /usr/include/bits/time.h /usr/include/bits/timex.h \ - /usr/include/bits/types/struct_tm.h \ - /usr/include/bits/types/struct_itimerspec.h /usr/include/bits/setjmp.h \ - /usr/include/bits/types/struct___jmp_buf_tag.h \ - /usr/include/bits/pthread_stack_min-dynamic.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/atomic_word.h \ - /usr/include/sys/single_threaded.h \ - /usr/include/c++/14/bits/locale_classes.h \ - /usr/include/c++/14/bits/locale_classes.tcc \ - /usr/include/c++/14/system_error \ - /usr/include/c++/14/x86_64-redhat-linux/bits/error_constants.h \ - /usr/include/c++/14/stdexcept /usr/include/c++/14/exception \ - /usr/include/c++/14/bits/exception_ptr.h \ - /usr/include/c++/14/bits/cxxabi_init_exception.h \ - /usr/include/c++/14/typeinfo /usr/include/c++/14/bits/nested_exception.h \ - /usr/include/c++/14/bits/streambuf.tcc /usr/include/c++/14/cassert \ - /usr/include/assert.h /usr/include/c++/14/algorithm \ - /usr/include/c++/14/bits/stl_algo.h \ - /usr/include/c++/14/bits/algorithmfwd.h \ - /usr/include/c++/14/bits/stl_heap.h \ - /usr/include/c++/14/bits/uniform_int_dist.h \ - /usr/include/c++/14/bits/stl_tempbuf.h /usr/include/c++/14/limits \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/grammar.hpp \ - /usr/include/c++/14/locale /usr/include/c++/14/bits/locale_facets.h \ - /usr/include/c++/14/cwctype /usr/include/wctype.h \ - /usr/include/bits/wctype-wchar.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/ctype_base.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/ctype_inline.h \ - /usr/include/c++/14/bits/locale_facets.tcc \ - /usr/include/c++/14/bits/locale_facets_nonio.h /usr/include/c++/14/ctime \ - /usr/include/c++/14/x86_64-redhat-linux/bits/time_members.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/messages_members.h \ - /usr/include/libintl.h /usr/include/c++/14/bits/codecvt.h \ - /usr/include/c++/14/bits/locale_facets_nonio.tcc \ - /usr/include/c++/14/bits/locale_conv.h /usr/include/c++/14/cstring \ - /usr/include/string.h /usr/include/strings.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/uri_parts.hpp \ - /usr/include/c++/14/utility /usr/include/c++/14/bits/stl_relops.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/optional.hpp \ - /usr/include/c++/14/memory /usr/include/c++/14/bits/stl_uninitialized.h \ - /usr/include/c++/14/bits/stl_raw_storage_iter.h \ - /usr/include/c++/14/bits/align.h /usr/include/c++/14/bit \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stdint.h \ - /usr/include/stdint.h /usr/include/bits/stdint-uintn.h \ - /usr/include/bits/stdint-least.h \ - /usr/include/c++/14/bits/uses_allocator.h \ - /usr/include/c++/14/bits/unique_ptr.h /usr/include/c++/14/tuple \ - /usr/include/c++/14/bits/shared_ptr.h \ - /usr/include/c++/14/bits/shared_ptr_base.h \ - /usr/include/c++/14/bits/allocated_ptr.h \ - /usr/include/c++/14/ext/aligned_buffer.h \ - /usr/include/c++/14/ext/concurrence.h \ - /usr/include/c++/14/bits/shared_ptr_atomic.h \ - /usr/include/c++/14/bits/atomic_base.h \ - /usr/include/c++/14/bits/atomic_lockfree_defines.h \ - /usr/include/c++/14/backward/auto_ptr.h diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o Binary files differdeleted file mode 100644 index b7436c46fc..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o +++ /dev/null diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o.d b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o.d deleted file mode 100644 index eccb30e15d..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o.d +++ /dev/null @@ -1,160 +0,0 @@ -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o: \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_parse_authority.cpp \ - /usr/include/stdc-predef.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_parse_authority.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/uri_parts.hpp \ - /usr/include/c++/14/string /usr/include/c++/14/bits/requires_hosted.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++config.h \ - /usr/include/bits/wordsize.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/os_defines.h \ - /usr/include/features.h /usr/include/features-time64.h \ - /usr/include/bits/timesize.h /usr/include/sys/cdefs.h \ - /usr/include/bits/long-double.h /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-64.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/cpu_defines.h \ - /usr/include/c++/14/bits/stringfwd.h \ - /usr/include/c++/14/bits/memoryfwd.h \ - /usr/include/c++/14/bits/char_traits.h \ - /usr/include/c++/14/bits/postypes.h /usr/include/c++/14/cwchar \ - /usr/include/wchar.h /usr/include/bits/libc-header-start.h \ - /usr/include/bits/floatn.h /usr/include/bits/floatn-common.h \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stddef.h \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stdarg.h \ - /usr/include/bits/wchar.h /usr/include/bits/types/wint_t.h \ - /usr/include/bits/types/mbstate_t.h \ - /usr/include/bits/types/__mbstate_t.h /usr/include/bits/types/__FILE.h \ - /usr/include/bits/types/FILE.h /usr/include/bits/types/locale_t.h \ - /usr/include/bits/types/__locale_t.h /usr/include/c++/14/type_traits \ - /usr/include/c++/14/bits/version.h /usr/include/c++/14/bits/allocator.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++allocator.h \ - /usr/include/c++/14/bits/new_allocator.h /usr/include/c++/14/new \ - /usr/include/c++/14/bits/exception.h \ - /usr/include/c++/14/bits/functexcept.h \ - /usr/include/c++/14/bits/exception_defines.h \ - /usr/include/c++/14/bits/move.h \ - /usr/include/c++/14/bits/cpp_type_traits.h \ - /usr/include/c++/14/bits/localefwd.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++locale.h \ - /usr/include/c++/14/clocale /usr/include/locale.h \ - /usr/include/bits/locale.h /usr/include/c++/14/iosfwd \ - /usr/include/c++/14/cctype /usr/include/ctype.h \ - /usr/include/bits/types.h /usr/include/bits/typesizes.h \ - /usr/include/bits/time64.h /usr/include/bits/endian.h \ - /usr/include/bits/endianness.h /usr/include/c++/14/bits/ostream_insert.h \ - /usr/include/c++/14/bits/cxxabi_forced.h \ - /usr/include/c++/14/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/14/bits/concept_check.h \ - /usr/include/c++/14/debug/assertions.h \ - /usr/include/c++/14/bits/stl_iterator_base_types.h \ - /usr/include/c++/14/bits/stl_iterator.h \ - /usr/include/c++/14/ext/type_traits.h \ - /usr/include/c++/14/bits/ptr_traits.h \ - /usr/include/c++/14/bits/stl_function.h \ - /usr/include/c++/14/backward/binders.h \ - /usr/include/c++/14/ext/numeric_traits.h \ - /usr/include/c++/14/bits/stl_algobase.h \ - /usr/include/c++/14/bits/stl_pair.h /usr/include/c++/14/bits/utility.h \ - /usr/include/c++/14/debug/debug.h \ - /usr/include/c++/14/bits/predefined_ops.h \ - /usr/include/c++/14/bits/refwrap.h /usr/include/c++/14/bits/invoke.h \ - /usr/include/c++/14/bits/range_access.h \ - /usr/include/c++/14/initializer_list \ - /usr/include/c++/14/bits/basic_string.h \ - /usr/include/c++/14/ext/alloc_traits.h \ - /usr/include/c++/14/bits/alloc_traits.h \ - /usr/include/c++/14/bits/stl_construct.h \ - /usr/include/c++/14/ext/string_conversions.h /usr/include/c++/14/cstdlib \ - /usr/include/stdlib.h /usr/include/bits/waitflags.h \ - /usr/include/bits/waitstatus.h /usr/include/sys/types.h \ - /usr/include/bits/types/clock_t.h /usr/include/bits/types/clockid_t.h \ - /usr/include/bits/types/time_t.h /usr/include/bits/types/timer_t.h \ - /usr/include/bits/stdint-intn.h /usr/include/endian.h \ - /usr/include/bits/byteswap.h /usr/include/bits/uintn-identity.h \ - /usr/include/sys/select.h /usr/include/bits/select.h \ - /usr/include/bits/types/sigset_t.h /usr/include/bits/types/__sigset_t.h \ - /usr/include/bits/types/struct_timeval.h \ - /usr/include/bits/types/struct_timespec.h \ - /usr/include/bits/pthreadtypes.h /usr/include/bits/thread-shared-types.h \ - /usr/include/bits/pthreadtypes-arch.h \ - /usr/include/bits/atomic_wide_counter.h /usr/include/bits/struct_mutex.h \ - /usr/include/bits/struct_rwlock.h /usr/include/alloca.h \ - /usr/include/bits/stdlib-bsearch.h /usr/include/bits/stdlib-float.h \ - /usr/include/c++/14/bits/std_abs.h /usr/include/c++/14/cstdio \ - /usr/include/stdio.h /usr/include/bits/types/__fpos_t.h \ - /usr/include/bits/types/__fpos64_t.h \ - /usr/include/bits/types/struct_FILE.h \ - /usr/include/bits/types/cookie_io_functions_t.h \ - /usr/include/bits/stdio_lim.h /usr/include/bits/stdio.h \ - /usr/include/c++/14/cerrno /usr/include/errno.h \ - /usr/include/bits/errno.h /usr/include/linux/errno.h \ - /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ - /usr/include/asm-generic/errno-base.h /usr/include/bits/types/error_t.h \ - /usr/include/c++/14/bits/charconv.h \ - /usr/include/c++/14/bits/functional_hash.h \ - /usr/include/c++/14/bits/hash_bytes.h \ - /usr/include/c++/14/bits/basic_string.tcc /usr/include/c++/14/utility \ - /usr/include/c++/14/bits/stl_relops.h /usr/include/c++/14/iterator \ - /usr/include/c++/14/bits/stream_iterator.h \ - /usr/include/c++/14/bits/streambuf_iterator.h \ - /usr/include/c++/14/streambuf /usr/include/c++/14/bits/ios_base.h \ - /usr/include/c++/14/ext/atomicity.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/gthr.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ - /usr/include/bits/types/struct_sched_param.h /usr/include/bits/cpu-set.h \ - /usr/include/time.h /usr/include/bits/time.h /usr/include/bits/timex.h \ - /usr/include/bits/types/struct_tm.h \ - /usr/include/bits/types/struct_itimerspec.h /usr/include/bits/setjmp.h \ - /usr/include/bits/types/struct___jmp_buf_tag.h \ - /usr/include/bits/pthread_stack_min-dynamic.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/atomic_word.h \ - /usr/include/sys/single_threaded.h \ - /usr/include/c++/14/bits/locale_classes.h \ - /usr/include/c++/14/bits/locale_classes.tcc \ - /usr/include/c++/14/system_error \ - /usr/include/c++/14/x86_64-redhat-linux/bits/error_constants.h \ - /usr/include/c++/14/stdexcept /usr/include/c++/14/exception \ - /usr/include/c++/14/bits/exception_ptr.h \ - /usr/include/c++/14/bits/cxxabi_init_exception.h \ - /usr/include/c++/14/typeinfo /usr/include/c++/14/bits/nested_exception.h \ - /usr/include/c++/14/bits/streambuf.tcc \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/optional.hpp \ - /usr/include/c++/14/memory /usr/include/c++/14/bits/stl_tempbuf.h \ - /usr/include/c++/14/bits/stl_uninitialized.h \ - /usr/include/c++/14/bits/stl_raw_storage_iter.h \ - /usr/include/c++/14/bits/align.h /usr/include/c++/14/bit \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stdint.h \ - /usr/include/stdint.h /usr/include/bits/stdint-uintn.h \ - /usr/include/bits/stdint-least.h \ - /usr/include/c++/14/bits/uses_allocator.h \ - /usr/include/c++/14/bits/unique_ptr.h /usr/include/c++/14/tuple \ - /usr/include/c++/14/bits/shared_ptr.h \ - /usr/include/c++/14/bits/shared_ptr_base.h \ - /usr/include/c++/14/bits/allocated_ptr.h \ - /usr/include/c++/14/ext/aligned_buffer.h \ - /usr/include/c++/14/ext/concurrence.h \ - /usr/include/c++/14/bits/shared_ptr_atomic.h \ - /usr/include/c++/14/bits/atomic_base.h \ - /usr/include/c++/14/bits/atomic_lockfree_defines.h \ - /usr/include/c++/14/backward/auto_ptr.h /usr/include/c++/14/algorithm \ - /usr/include/c++/14/bits/stl_algo.h \ - /usr/include/c++/14/bits/algorithmfwd.h \ - /usr/include/c++/14/bits/stl_heap.h \ - /usr/include/c++/14/bits/uniform_int_dist.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/string_view.hpp \ - /usr/include/c++/14/cassert /usr/include/assert.h \ - /usr/include/c++/14/limits \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/grammar.hpp \ - /usr/include/c++/14/locale /usr/include/c++/14/bits/locale_facets.h \ - /usr/include/c++/14/cwctype /usr/include/wctype.h \ - /usr/include/bits/wctype-wchar.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/ctype_base.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/ctype_inline.h \ - /usr/include/c++/14/bits/locale_facets.tcc \ - /usr/include/c++/14/bits/locale_facets_nonio.h /usr/include/c++/14/ctime \ - /usr/include/c++/14/x86_64-redhat-linux/bits/time_members.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/messages_members.h \ - /usr/include/libintl.h /usr/include/c++/14/bits/codecvt.h \ - /usr/include/c++/14/bits/locale_facets_nonio.tcc \ - /usr/include/c++/14/bits/locale_conv.h /usr/include/c++/14/cstring \ - /usr/include/string.h /usr/include/strings.h diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o Binary files differdeleted file mode 100644 index da598e29ee..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o +++ /dev/null diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o.d b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o.d deleted file mode 100644 index b3f7b40ced..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o.d +++ /dev/null @@ -1,156 +0,0 @@ -third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o: \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_resolve.cpp \ - /usr/include/stdc-predef.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_resolve.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/uri.hpp \ - /usr/include/c++/14/iterator \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++config.h \ - /usr/include/bits/wordsize.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/os_defines.h \ - /usr/include/features.h /usr/include/features-time64.h \ - /usr/include/bits/timesize.h /usr/include/sys/cdefs.h \ - /usr/include/bits/long-double.h /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-64.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/cpu_defines.h \ - /usr/include/c++/14/bits/stl_iterator_base_types.h \ - /usr/include/c++/14/type_traits /usr/include/c++/14/bits/version.h \ - /usr/include/c++/14/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/14/bits/concept_check.h \ - /usr/include/c++/14/debug/assertions.h \ - /usr/include/c++/14/bits/stl_iterator.h \ - /usr/include/c++/14/bits/cpp_type_traits.h \ - /usr/include/c++/14/ext/type_traits.h /usr/include/c++/14/bits/move.h \ - /usr/include/c++/14/bits/ptr_traits.h \ - /usr/include/c++/14/bits/stream_iterator.h /usr/include/c++/14/iosfwd \ - /usr/include/c++/14/bits/requires_hosted.h \ - /usr/include/c++/14/bits/stringfwd.h \ - /usr/include/c++/14/bits/memoryfwd.h /usr/include/c++/14/bits/postypes.h \ - /usr/include/c++/14/cwchar /usr/include/wchar.h \ - /usr/include/bits/libc-header-start.h /usr/include/bits/floatn.h \ - /usr/include/bits/floatn-common.h \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stddef.h \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stdarg.h \ - /usr/include/bits/wchar.h /usr/include/bits/types/wint_t.h \ - /usr/include/bits/types/mbstate_t.h \ - /usr/include/bits/types/__mbstate_t.h /usr/include/bits/types/__FILE.h \ - /usr/include/bits/types/FILE.h /usr/include/bits/types/locale_t.h \ - /usr/include/bits/types/__locale_t.h /usr/include/c++/14/debug/debug.h \ - /usr/include/c++/14/bits/streambuf_iterator.h \ - /usr/include/c++/14/streambuf /usr/include/c++/14/bits/localefwd.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++locale.h \ - /usr/include/c++/14/clocale /usr/include/locale.h \ - /usr/include/bits/locale.h /usr/include/c++/14/cctype \ - /usr/include/ctype.h /usr/include/bits/types.h \ - /usr/include/bits/typesizes.h /usr/include/bits/time64.h \ - /usr/include/bits/endian.h /usr/include/bits/endianness.h \ - /usr/include/c++/14/bits/ios_base.h /usr/include/c++/14/ext/atomicity.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/gthr.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/sched.h \ - /usr/include/bits/types/time_t.h \ - /usr/include/bits/types/struct_timespec.h /usr/include/bits/sched.h \ - /usr/include/bits/types/struct_sched_param.h /usr/include/bits/cpu-set.h \ - /usr/include/time.h /usr/include/bits/time.h /usr/include/bits/timex.h \ - /usr/include/bits/types/struct_timeval.h \ - /usr/include/bits/types/clock_t.h /usr/include/bits/types/struct_tm.h \ - /usr/include/bits/types/clockid_t.h /usr/include/bits/types/timer_t.h \ - /usr/include/bits/types/struct_itimerspec.h \ - /usr/include/bits/pthreadtypes.h /usr/include/bits/thread-shared-types.h \ - /usr/include/bits/pthreadtypes-arch.h \ - /usr/include/bits/atomic_wide_counter.h /usr/include/bits/struct_mutex.h \ - /usr/include/bits/struct_rwlock.h /usr/include/bits/setjmp.h \ - /usr/include/bits/types/__sigset_t.h \ - /usr/include/bits/types/struct___jmp_buf_tag.h \ - /usr/include/bits/pthread_stack_min-dynamic.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/atomic_word.h \ - /usr/include/sys/single_threaded.h \ - /usr/include/c++/14/bits/locale_classes.h /usr/include/c++/14/string \ - /usr/include/c++/14/bits/char_traits.h \ - /usr/include/c++/14/bits/allocator.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++allocator.h \ - /usr/include/c++/14/bits/new_allocator.h /usr/include/c++/14/new \ - /usr/include/c++/14/bits/exception.h \ - /usr/include/c++/14/bits/functexcept.h \ - /usr/include/c++/14/bits/exception_defines.h \ - /usr/include/c++/14/bits/ostream_insert.h \ - /usr/include/c++/14/bits/cxxabi_forced.h \ - /usr/include/c++/14/bits/stl_function.h \ - /usr/include/c++/14/backward/binders.h \ - /usr/include/c++/14/ext/numeric_traits.h \ - /usr/include/c++/14/bits/stl_algobase.h \ - /usr/include/c++/14/bits/stl_pair.h /usr/include/c++/14/bits/utility.h \ - /usr/include/c++/14/bits/predefined_ops.h \ - /usr/include/c++/14/bits/refwrap.h /usr/include/c++/14/bits/invoke.h \ - /usr/include/c++/14/bits/range_access.h \ - /usr/include/c++/14/initializer_list \ - /usr/include/c++/14/bits/basic_string.h \ - /usr/include/c++/14/ext/alloc_traits.h \ - /usr/include/c++/14/bits/alloc_traits.h \ - /usr/include/c++/14/bits/stl_construct.h \ - /usr/include/c++/14/ext/string_conversions.h /usr/include/c++/14/cstdlib \ - /usr/include/stdlib.h /usr/include/bits/waitflags.h \ - /usr/include/bits/waitstatus.h /usr/include/sys/types.h \ - /usr/include/bits/stdint-intn.h /usr/include/endian.h \ - /usr/include/bits/byteswap.h /usr/include/bits/uintn-identity.h \ - /usr/include/sys/select.h /usr/include/bits/select.h \ - /usr/include/bits/types/sigset_t.h /usr/include/alloca.h \ - /usr/include/bits/stdlib-bsearch.h /usr/include/bits/stdlib-float.h \ - /usr/include/c++/14/bits/std_abs.h /usr/include/c++/14/cstdio \ - /usr/include/stdio.h /usr/include/bits/types/__fpos_t.h \ - /usr/include/bits/types/__fpos64_t.h \ - /usr/include/bits/types/struct_FILE.h \ - /usr/include/bits/types/cookie_io_functions_t.h \ - /usr/include/bits/stdio_lim.h /usr/include/bits/stdio.h \ - /usr/include/c++/14/cerrno /usr/include/errno.h \ - /usr/include/bits/errno.h /usr/include/linux/errno.h \ - /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ - /usr/include/asm-generic/errno-base.h /usr/include/bits/types/error_t.h \ - /usr/include/c++/14/bits/charconv.h \ - /usr/include/c++/14/bits/functional_hash.h \ - /usr/include/c++/14/bits/hash_bytes.h \ - /usr/include/c++/14/bits/basic_string.tcc \ - /usr/include/c++/14/bits/locale_classes.tcc \ - /usr/include/c++/14/system_error \ - /usr/include/c++/14/x86_64-redhat-linux/bits/error_constants.h \ - /usr/include/c++/14/stdexcept /usr/include/c++/14/exception \ - /usr/include/c++/14/bits/exception_ptr.h \ - /usr/include/c++/14/bits/cxxabi_init_exception.h \ - /usr/include/c++/14/typeinfo /usr/include/c++/14/bits/nested_exception.h \ - /usr/include/c++/14/bits/streambuf.tcc /usr/include/c++/14/algorithm \ - /usr/include/c++/14/bits/stl_algo.h \ - /usr/include/c++/14/bits/algorithmfwd.h \ - /usr/include/c++/14/bits/stl_heap.h \ - /usr/include/c++/14/bits/uniform_int_dist.h \ - /usr/include/c++/14/bits/stl_tempbuf.h /usr/include/c++/14/functional \ - /usr/include/c++/14/tuple /usr/include/c++/14/bits/uses_allocator.h \ - /usr/include/c++/14/bits/std_function.h /usr/include/c++/14/memory \ - /usr/include/c++/14/bits/stl_uninitialized.h \ - /usr/include/c++/14/bits/stl_raw_storage_iter.h \ - /usr/include/c++/14/bits/align.h /usr/include/c++/14/bit \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stdint.h \ - /usr/include/stdint.h /usr/include/bits/stdint-uintn.h \ - /usr/include/bits/stdint-least.h /usr/include/c++/14/bits/unique_ptr.h \ - /usr/include/c++/14/bits/shared_ptr.h \ - /usr/include/c++/14/bits/shared_ptr_base.h \ - /usr/include/c++/14/bits/allocated_ptr.h \ - /usr/include/c++/14/ext/aligned_buffer.h \ - /usr/include/c++/14/ext/concurrence.h \ - /usr/include/c++/14/bits/shared_ptr_atomic.h \ - /usr/include/c++/14/bits/atomic_base.h \ - /usr/include/c++/14/bits/atomic_lockfree_defines.h \ - /usr/include/c++/14/backward/auto_ptr.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/string_view.hpp \ - /usr/include/c++/14/cassert /usr/include/assert.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/optional.hpp \ - /usr/include/c++/14/utility /usr/include/c++/14/bits/stl_relops.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/config.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/uri_errors.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/uri_parts.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/encode.hpp \ - /usr/include/c++/14/cstring /usr/include/string.h /usr/include/strings.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/decode.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/translate.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/uri_builder.hpp \ - /usr/include/c++/14/cstdint \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/algorithm_find.hpp \ - /usr/include/c++/14/cstddef diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/flags.make b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/flags.make deleted file mode 100644 index 0eb1468afb..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/flags.make +++ /dev/null @@ -1,10 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.28 - -# compile CXX with /bin/c++ -CXX_DEFINES = - -CXX_INCLUDES = -I/usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src -I/usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include - -CXX_FLAGS = -fPIE -std=c++11 -Wall -Werror -Wno-parentheses -O2 -g -DNDEBUG - diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/link.txt b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/link.txt deleted file mode 100644 index f804330c4f..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/link.txt +++ /dev/null @@ -1,2 +0,0 @@ -/bin/ar qc libnetwork-uri.a "CMakeFiles/network-uri.dir/uri.cpp.o" "CMakeFiles/network-uri.dir/uri_builder.cpp.o" "CMakeFiles/network-uri.dir/uri_errors.cpp.o" "CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o" "CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o" "CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o" "CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o" "CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o" -/bin/ranlib libnetwork-uri.a diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/progress.make b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/progress.make deleted file mode 100644 index 03848ccb80..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/progress.make +++ /dev/null @@ -1,10 +0,0 @@ -CMAKE_PROGRESS_1 = 23 -CMAKE_PROGRESS_2 = 24 -CMAKE_PROGRESS_3 = 25 -CMAKE_PROGRESS_4 = 26 -CMAKE_PROGRESS_5 = 27 -CMAKE_PROGRESS_6 = 28 -CMAKE_PROGRESS_7 = 29 -CMAKE_PROGRESS_8 = 30 -CMAKE_PROGRESS_9 = 31 - diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.o b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.o Binary files differdeleted file mode 100644 index bcef6a566e..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.o +++ /dev/null diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.o.d b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.o.d deleted file mode 100644 index 8f3e240d15..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.o.d +++ /dev/null @@ -1,172 +0,0 @@ -third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.o: \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/uri.cpp \ - /usr/include/stdc-predef.h /usr/include/c++/14/cassert \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++config.h \ - /usr/include/bits/wordsize.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/os_defines.h \ - /usr/include/features.h /usr/include/features-time64.h \ - /usr/include/bits/timesize.h /usr/include/sys/cdefs.h \ - /usr/include/bits/long-double.h /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-64.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/cpu_defines.h \ - /usr/include/assert.h /usr/include/c++/14/locale \ - /usr/include/c++/14/bits/requires_hosted.h \ - /usr/include/c++/14/bits/localefwd.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++locale.h \ - /usr/include/c++/14/clocale /usr/include/locale.h \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stddef.h \ - /usr/include/bits/locale.h /usr/include/bits/types/locale_t.h \ - /usr/include/bits/types/__locale_t.h /usr/include/c++/14/iosfwd \ - /usr/include/c++/14/bits/stringfwd.h \ - /usr/include/c++/14/bits/memoryfwd.h /usr/include/c++/14/bits/postypes.h \ - /usr/include/c++/14/cwchar /usr/include/wchar.h \ - /usr/include/bits/libc-header-start.h /usr/include/bits/floatn.h \ - /usr/include/bits/floatn-common.h \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stdarg.h \ - /usr/include/bits/wchar.h /usr/include/bits/types/wint_t.h \ - /usr/include/bits/types/mbstate_t.h \ - /usr/include/bits/types/__mbstate_t.h /usr/include/bits/types/__FILE.h \ - /usr/include/bits/types/FILE.h /usr/include/c++/14/cctype \ - /usr/include/ctype.h /usr/include/bits/types.h \ - /usr/include/bits/typesizes.h /usr/include/bits/time64.h \ - /usr/include/bits/endian.h /usr/include/bits/endianness.h \ - /usr/include/c++/14/bits/locale_classes.h /usr/include/c++/14/string \ - /usr/include/c++/14/bits/char_traits.h /usr/include/c++/14/type_traits \ - /usr/include/c++/14/bits/version.h /usr/include/c++/14/bits/allocator.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++allocator.h \ - /usr/include/c++/14/bits/new_allocator.h /usr/include/c++/14/new \ - /usr/include/c++/14/bits/exception.h \ - /usr/include/c++/14/bits/functexcept.h \ - /usr/include/c++/14/bits/exception_defines.h \ - /usr/include/c++/14/bits/move.h \ - /usr/include/c++/14/bits/cpp_type_traits.h \ - /usr/include/c++/14/bits/ostream_insert.h \ - /usr/include/c++/14/bits/cxxabi_forced.h \ - /usr/include/c++/14/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/14/bits/concept_check.h \ - /usr/include/c++/14/debug/assertions.h \ - /usr/include/c++/14/bits/stl_iterator_base_types.h \ - /usr/include/c++/14/bits/stl_iterator.h \ - /usr/include/c++/14/ext/type_traits.h \ - /usr/include/c++/14/bits/ptr_traits.h \ - /usr/include/c++/14/bits/stl_function.h \ - /usr/include/c++/14/backward/binders.h \ - /usr/include/c++/14/ext/numeric_traits.h \ - /usr/include/c++/14/bits/stl_algobase.h \ - /usr/include/c++/14/bits/stl_pair.h /usr/include/c++/14/bits/utility.h \ - /usr/include/c++/14/debug/debug.h \ - /usr/include/c++/14/bits/predefined_ops.h \ - /usr/include/c++/14/bits/refwrap.h /usr/include/c++/14/bits/invoke.h \ - /usr/include/c++/14/bits/range_access.h \ - /usr/include/c++/14/initializer_list \ - /usr/include/c++/14/bits/basic_string.h \ - /usr/include/c++/14/ext/alloc_traits.h \ - /usr/include/c++/14/bits/alloc_traits.h \ - /usr/include/c++/14/bits/stl_construct.h \ - /usr/include/c++/14/ext/string_conversions.h /usr/include/c++/14/cstdlib \ - /usr/include/stdlib.h /usr/include/bits/waitflags.h \ - /usr/include/bits/waitstatus.h /usr/include/sys/types.h \ - /usr/include/bits/types/clock_t.h /usr/include/bits/types/clockid_t.h \ - /usr/include/bits/types/time_t.h /usr/include/bits/types/timer_t.h \ - /usr/include/bits/stdint-intn.h /usr/include/endian.h \ - /usr/include/bits/byteswap.h /usr/include/bits/uintn-identity.h \ - /usr/include/sys/select.h /usr/include/bits/select.h \ - /usr/include/bits/types/sigset_t.h /usr/include/bits/types/__sigset_t.h \ - /usr/include/bits/types/struct_timeval.h \ - /usr/include/bits/types/struct_timespec.h \ - /usr/include/bits/pthreadtypes.h /usr/include/bits/thread-shared-types.h \ - /usr/include/bits/pthreadtypes-arch.h \ - /usr/include/bits/atomic_wide_counter.h /usr/include/bits/struct_mutex.h \ - /usr/include/bits/struct_rwlock.h /usr/include/alloca.h \ - /usr/include/bits/stdlib-bsearch.h /usr/include/bits/stdlib-float.h \ - /usr/include/c++/14/bits/std_abs.h /usr/include/c++/14/cstdio \ - /usr/include/stdio.h /usr/include/bits/types/__fpos_t.h \ - /usr/include/bits/types/__fpos64_t.h \ - /usr/include/bits/types/struct_FILE.h \ - /usr/include/bits/types/cookie_io_functions_t.h \ - /usr/include/bits/stdio_lim.h /usr/include/bits/stdio.h \ - /usr/include/c++/14/cerrno /usr/include/errno.h \ - /usr/include/bits/errno.h /usr/include/linux/errno.h \ - /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ - /usr/include/asm-generic/errno-base.h /usr/include/bits/types/error_t.h \ - /usr/include/c++/14/bits/charconv.h \ - /usr/include/c++/14/bits/functional_hash.h \ - /usr/include/c++/14/bits/hash_bytes.h \ - /usr/include/c++/14/bits/basic_string.tcc \ - /usr/include/c++/14/ext/atomicity.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/gthr.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ - /usr/include/bits/types/struct_sched_param.h /usr/include/bits/cpu-set.h \ - /usr/include/time.h /usr/include/bits/time.h /usr/include/bits/timex.h \ - /usr/include/bits/types/struct_tm.h \ - /usr/include/bits/types/struct_itimerspec.h /usr/include/bits/setjmp.h \ - /usr/include/bits/types/struct___jmp_buf_tag.h \ - /usr/include/bits/pthread_stack_min-dynamic.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/atomic_word.h \ - /usr/include/sys/single_threaded.h \ - /usr/include/c++/14/bits/locale_classes.tcc \ - /usr/include/c++/14/bits/locale_facets.h /usr/include/c++/14/cwctype \ - /usr/include/wctype.h /usr/include/bits/wctype-wchar.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/ctype_base.h \ - /usr/include/c++/14/bits/ios_base.h /usr/include/c++/14/system_error \ - /usr/include/c++/14/x86_64-redhat-linux/bits/error_constants.h \ - /usr/include/c++/14/stdexcept /usr/include/c++/14/exception \ - /usr/include/c++/14/bits/exception_ptr.h \ - /usr/include/c++/14/bits/cxxabi_init_exception.h \ - /usr/include/c++/14/typeinfo /usr/include/c++/14/bits/nested_exception.h \ - /usr/include/c++/14/streambuf /usr/include/c++/14/bits/streambuf.tcc \ - /usr/include/c++/14/bits/streambuf_iterator.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/ctype_inline.h \ - /usr/include/c++/14/bits/locale_facets.tcc \ - /usr/include/c++/14/bits/locale_facets_nonio.h /usr/include/c++/14/ctime \ - /usr/include/c++/14/x86_64-redhat-linux/bits/time_members.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/messages_members.h \ - /usr/include/libintl.h /usr/include/c++/14/bits/codecvt.h \ - /usr/include/c++/14/bits/locale_facets_nonio.tcc \ - /usr/include/c++/14/bits/locale_conv.h /usr/include/c++/14/algorithm \ - /usr/include/c++/14/bits/stl_algo.h \ - /usr/include/c++/14/bits/algorithmfwd.h \ - /usr/include/c++/14/bits/stl_heap.h \ - /usr/include/c++/14/bits/uniform_int_dist.h \ - /usr/include/c++/14/bits/stl_tempbuf.h /usr/include/c++/14/functional \ - /usr/include/c++/14/tuple /usr/include/c++/14/bits/uses_allocator.h \ - /usr/include/c++/14/bits/std_function.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/uri.hpp \ - /usr/include/c++/14/iterator /usr/include/c++/14/bits/stream_iterator.h \ - /usr/include/c++/14/memory /usr/include/c++/14/bits/stl_uninitialized.h \ - /usr/include/c++/14/bits/stl_raw_storage_iter.h \ - /usr/include/c++/14/bits/align.h /usr/include/c++/14/bit \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stdint.h \ - /usr/include/stdint.h /usr/include/bits/stdint-uintn.h \ - /usr/include/bits/stdint-least.h /usr/include/c++/14/bits/unique_ptr.h \ - /usr/include/c++/14/bits/shared_ptr.h \ - /usr/include/c++/14/bits/shared_ptr_base.h \ - /usr/include/c++/14/bits/allocated_ptr.h \ - /usr/include/c++/14/ext/aligned_buffer.h \ - /usr/include/c++/14/ext/concurrence.h \ - /usr/include/c++/14/bits/shared_ptr_atomic.h \ - /usr/include/c++/14/bits/atomic_base.h \ - /usr/include/c++/14/bits/atomic_lockfree_defines.h \ - /usr/include/c++/14/backward/auto_ptr.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/string_view.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/optional.hpp \ - /usr/include/c++/14/utility /usr/include/c++/14/bits/stl_relops.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/config.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/uri_errors.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/uri_parts.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/encode.hpp \ - /usr/include/c++/14/cstring /usr/include/string.h /usr/include/strings.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/decode.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/translate.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/uri_builder.hpp \ - /usr/include/c++/14/cstdint \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_parse.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_advance_parts.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_percent_encode.hpp \ - /usr/include/c++/14/vector /usr/include/c++/14/bits/stl_vector.h \ - /usr/include/c++/14/bits/stl_bvector.h \ - /usr/include/c++/14/bits/vector.tcc \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_normalize.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_resolve.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/algorithm.hpp diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.o b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.o Binary files differdeleted file mode 100644 index 930a1185a3..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.o +++ /dev/null diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.o.d b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.o.d deleted file mode 100644 index 67c198cb22..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.o.d +++ /dev/null @@ -1,167 +0,0 @@ -third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.o: \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/uri_builder.cpp \ - /usr/include/stdc-predef.h /usr/include/c++/14/locale \ - /usr/include/c++/14/bits/requires_hosted.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++config.h \ - /usr/include/bits/wordsize.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/os_defines.h \ - /usr/include/features.h /usr/include/features-time64.h \ - /usr/include/bits/timesize.h /usr/include/sys/cdefs.h \ - /usr/include/bits/long-double.h /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-64.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/cpu_defines.h \ - /usr/include/c++/14/bits/localefwd.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++locale.h \ - /usr/include/c++/14/clocale /usr/include/locale.h \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stddef.h \ - /usr/include/bits/locale.h /usr/include/bits/types/locale_t.h \ - /usr/include/bits/types/__locale_t.h /usr/include/c++/14/iosfwd \ - /usr/include/c++/14/bits/stringfwd.h \ - /usr/include/c++/14/bits/memoryfwd.h /usr/include/c++/14/bits/postypes.h \ - /usr/include/c++/14/cwchar /usr/include/wchar.h \ - /usr/include/bits/libc-header-start.h /usr/include/bits/floatn.h \ - /usr/include/bits/floatn-common.h \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stdarg.h \ - /usr/include/bits/wchar.h /usr/include/bits/types/wint_t.h \ - /usr/include/bits/types/mbstate_t.h \ - /usr/include/bits/types/__mbstate_t.h /usr/include/bits/types/__FILE.h \ - /usr/include/bits/types/FILE.h /usr/include/c++/14/cctype \ - /usr/include/ctype.h /usr/include/bits/types.h \ - /usr/include/bits/typesizes.h /usr/include/bits/time64.h \ - /usr/include/bits/endian.h /usr/include/bits/endianness.h \ - /usr/include/c++/14/bits/locale_classes.h /usr/include/c++/14/string \ - /usr/include/c++/14/bits/char_traits.h /usr/include/c++/14/type_traits \ - /usr/include/c++/14/bits/version.h /usr/include/c++/14/bits/allocator.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++allocator.h \ - /usr/include/c++/14/bits/new_allocator.h /usr/include/c++/14/new \ - /usr/include/c++/14/bits/exception.h \ - /usr/include/c++/14/bits/functexcept.h \ - /usr/include/c++/14/bits/exception_defines.h \ - /usr/include/c++/14/bits/move.h \ - /usr/include/c++/14/bits/cpp_type_traits.h \ - /usr/include/c++/14/bits/ostream_insert.h \ - /usr/include/c++/14/bits/cxxabi_forced.h \ - /usr/include/c++/14/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/14/bits/concept_check.h \ - /usr/include/c++/14/debug/assertions.h \ - /usr/include/c++/14/bits/stl_iterator_base_types.h \ - /usr/include/c++/14/bits/stl_iterator.h \ - /usr/include/c++/14/ext/type_traits.h \ - /usr/include/c++/14/bits/ptr_traits.h \ - /usr/include/c++/14/bits/stl_function.h \ - /usr/include/c++/14/backward/binders.h \ - /usr/include/c++/14/ext/numeric_traits.h \ - /usr/include/c++/14/bits/stl_algobase.h \ - /usr/include/c++/14/bits/stl_pair.h /usr/include/c++/14/bits/utility.h \ - /usr/include/c++/14/debug/debug.h \ - /usr/include/c++/14/bits/predefined_ops.h \ - /usr/include/c++/14/bits/refwrap.h /usr/include/c++/14/bits/invoke.h \ - /usr/include/c++/14/bits/range_access.h \ - /usr/include/c++/14/initializer_list \ - /usr/include/c++/14/bits/basic_string.h \ - /usr/include/c++/14/ext/alloc_traits.h \ - /usr/include/c++/14/bits/alloc_traits.h \ - /usr/include/c++/14/bits/stl_construct.h \ - /usr/include/c++/14/ext/string_conversions.h /usr/include/c++/14/cstdlib \ - /usr/include/stdlib.h /usr/include/bits/waitflags.h \ - /usr/include/bits/waitstatus.h /usr/include/sys/types.h \ - /usr/include/bits/types/clock_t.h /usr/include/bits/types/clockid_t.h \ - /usr/include/bits/types/time_t.h /usr/include/bits/types/timer_t.h \ - /usr/include/bits/stdint-intn.h /usr/include/endian.h \ - /usr/include/bits/byteswap.h /usr/include/bits/uintn-identity.h \ - /usr/include/sys/select.h /usr/include/bits/select.h \ - /usr/include/bits/types/sigset_t.h /usr/include/bits/types/__sigset_t.h \ - /usr/include/bits/types/struct_timeval.h \ - /usr/include/bits/types/struct_timespec.h \ - /usr/include/bits/pthreadtypes.h /usr/include/bits/thread-shared-types.h \ - /usr/include/bits/pthreadtypes-arch.h \ - /usr/include/bits/atomic_wide_counter.h /usr/include/bits/struct_mutex.h \ - /usr/include/bits/struct_rwlock.h /usr/include/alloca.h \ - /usr/include/bits/stdlib-bsearch.h /usr/include/bits/stdlib-float.h \ - /usr/include/c++/14/bits/std_abs.h /usr/include/c++/14/cstdio \ - /usr/include/stdio.h /usr/include/bits/types/__fpos_t.h \ - /usr/include/bits/types/__fpos64_t.h \ - /usr/include/bits/types/struct_FILE.h \ - /usr/include/bits/types/cookie_io_functions_t.h \ - /usr/include/bits/stdio_lim.h /usr/include/bits/stdio.h \ - /usr/include/c++/14/cerrno /usr/include/errno.h \ - /usr/include/bits/errno.h /usr/include/linux/errno.h \ - /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ - /usr/include/asm-generic/errno-base.h /usr/include/bits/types/error_t.h \ - /usr/include/c++/14/bits/charconv.h \ - /usr/include/c++/14/bits/functional_hash.h \ - /usr/include/c++/14/bits/hash_bytes.h \ - /usr/include/c++/14/bits/basic_string.tcc \ - /usr/include/c++/14/ext/atomicity.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/gthr.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ - /usr/include/bits/types/struct_sched_param.h /usr/include/bits/cpu-set.h \ - /usr/include/time.h /usr/include/bits/time.h /usr/include/bits/timex.h \ - /usr/include/bits/types/struct_tm.h \ - /usr/include/bits/types/struct_itimerspec.h /usr/include/bits/setjmp.h \ - /usr/include/bits/types/struct___jmp_buf_tag.h \ - /usr/include/bits/pthread_stack_min-dynamic.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/atomic_word.h \ - /usr/include/sys/single_threaded.h \ - /usr/include/c++/14/bits/locale_classes.tcc \ - /usr/include/c++/14/bits/locale_facets.h /usr/include/c++/14/cwctype \ - /usr/include/wctype.h /usr/include/bits/wctype-wchar.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/ctype_base.h \ - /usr/include/c++/14/bits/ios_base.h /usr/include/c++/14/system_error \ - /usr/include/c++/14/x86_64-redhat-linux/bits/error_constants.h \ - /usr/include/c++/14/stdexcept /usr/include/c++/14/exception \ - /usr/include/c++/14/bits/exception_ptr.h \ - /usr/include/c++/14/bits/cxxabi_init_exception.h \ - /usr/include/c++/14/typeinfo /usr/include/c++/14/bits/nested_exception.h \ - /usr/include/c++/14/streambuf /usr/include/c++/14/bits/streambuf.tcc \ - /usr/include/c++/14/bits/streambuf_iterator.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/ctype_inline.h \ - /usr/include/c++/14/bits/locale_facets.tcc \ - /usr/include/c++/14/bits/locale_facets_nonio.h /usr/include/c++/14/ctime \ - /usr/include/c++/14/x86_64-redhat-linux/bits/time_members.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/messages_members.h \ - /usr/include/libintl.h /usr/include/c++/14/bits/codecvt.h \ - /usr/include/c++/14/bits/locale_facets_nonio.tcc \ - /usr/include/c++/14/bits/locale_conv.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/uri_builder.hpp \ - /usr/include/c++/14/cstdint \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stdint.h \ - /usr/include/stdint.h /usr/include/bits/stdint-uintn.h \ - /usr/include/bits/stdint-least.h /usr/include/c++/14/utility \ - /usr/include/c++/14/bits/stl_relops.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/uri.hpp \ - /usr/include/c++/14/iterator /usr/include/c++/14/bits/stream_iterator.h \ - /usr/include/c++/14/algorithm /usr/include/c++/14/bits/stl_algo.h \ - /usr/include/c++/14/bits/algorithmfwd.h \ - /usr/include/c++/14/bits/stl_heap.h \ - /usr/include/c++/14/bits/uniform_int_dist.h \ - /usr/include/c++/14/bits/stl_tempbuf.h /usr/include/c++/14/functional \ - /usr/include/c++/14/tuple /usr/include/c++/14/bits/uses_allocator.h \ - /usr/include/c++/14/bits/std_function.h /usr/include/c++/14/memory \ - /usr/include/c++/14/bits/stl_uninitialized.h \ - /usr/include/c++/14/bits/stl_raw_storage_iter.h \ - /usr/include/c++/14/bits/align.h /usr/include/c++/14/bit \ - /usr/include/c++/14/bits/unique_ptr.h \ - /usr/include/c++/14/bits/shared_ptr.h \ - /usr/include/c++/14/bits/shared_ptr_base.h \ - /usr/include/c++/14/bits/allocated_ptr.h \ - /usr/include/c++/14/ext/aligned_buffer.h \ - /usr/include/c++/14/ext/concurrence.h \ - /usr/include/c++/14/bits/shared_ptr_atomic.h \ - /usr/include/c++/14/bits/atomic_base.h \ - /usr/include/c++/14/bits/atomic_lockfree_defines.h \ - /usr/include/c++/14/backward/auto_ptr.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/string_view.hpp \ - /usr/include/c++/14/cassert /usr/include/assert.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/optional.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/config.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/uri_errors.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/uri_parts.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/encode.hpp \ - /usr/include/c++/14/cstring /usr/include/string.h /usr/include/strings.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/decode.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/detail/translate.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_normalize.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/uri_parse_authority.hpp \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/detail/algorithm.hpp diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.o b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.o Binary files differdeleted file mode 100644 index 832103d65a..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.o +++ /dev/null diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.o.d b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.o.d deleted file mode 100644 index 2f083cd4f0..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.o.d +++ /dev/null @@ -1,101 +0,0 @@ -third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.o: \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/src/uri_errors.cpp \ - /usr/include/stdc-predef.h /usr/include/c++/14/string \ - /usr/include/c++/14/bits/requires_hosted.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++config.h \ - /usr/include/bits/wordsize.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/os_defines.h \ - /usr/include/features.h /usr/include/features-time64.h \ - /usr/include/bits/timesize.h /usr/include/sys/cdefs.h \ - /usr/include/bits/long-double.h /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-64.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/cpu_defines.h \ - /usr/include/c++/14/bits/stringfwd.h \ - /usr/include/c++/14/bits/memoryfwd.h \ - /usr/include/c++/14/bits/char_traits.h \ - /usr/include/c++/14/bits/postypes.h /usr/include/c++/14/cwchar \ - /usr/include/wchar.h /usr/include/bits/libc-header-start.h \ - /usr/include/bits/floatn.h /usr/include/bits/floatn-common.h \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stddef.h \ - /usr/lib/gcc/x86_64-redhat-linux/14/include/stdarg.h \ - /usr/include/bits/wchar.h /usr/include/bits/types/wint_t.h \ - /usr/include/bits/types/mbstate_t.h \ - /usr/include/bits/types/__mbstate_t.h /usr/include/bits/types/__FILE.h \ - /usr/include/bits/types/FILE.h /usr/include/bits/types/locale_t.h \ - /usr/include/bits/types/__locale_t.h /usr/include/c++/14/type_traits \ - /usr/include/c++/14/bits/version.h /usr/include/c++/14/bits/allocator.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++allocator.h \ - /usr/include/c++/14/bits/new_allocator.h /usr/include/c++/14/new \ - /usr/include/c++/14/bits/exception.h \ - /usr/include/c++/14/bits/functexcept.h \ - /usr/include/c++/14/bits/exception_defines.h \ - /usr/include/c++/14/bits/move.h \ - /usr/include/c++/14/bits/cpp_type_traits.h \ - /usr/include/c++/14/bits/localefwd.h \ - /usr/include/c++/14/x86_64-redhat-linux/bits/c++locale.h \ - /usr/include/c++/14/clocale /usr/include/locale.h \ - /usr/include/bits/locale.h /usr/include/c++/14/iosfwd \ - /usr/include/c++/14/cctype /usr/include/ctype.h \ - /usr/include/bits/types.h /usr/include/bits/typesizes.h \ - /usr/include/bits/time64.h /usr/include/bits/endian.h \ - /usr/include/bits/endianness.h /usr/include/c++/14/bits/ostream_insert.h \ - /usr/include/c++/14/bits/cxxabi_forced.h \ - /usr/include/c++/14/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/14/bits/concept_check.h \ - /usr/include/c++/14/debug/assertions.h \ - /usr/include/c++/14/bits/stl_iterator_base_types.h \ - /usr/include/c++/14/bits/stl_iterator.h \ - /usr/include/c++/14/ext/type_traits.h \ - /usr/include/c++/14/bits/ptr_traits.h \ - /usr/include/c++/14/bits/stl_function.h \ - /usr/include/c++/14/backward/binders.h \ - /usr/include/c++/14/ext/numeric_traits.h \ - /usr/include/c++/14/bits/stl_algobase.h \ - /usr/include/c++/14/bits/stl_pair.h /usr/include/c++/14/bits/utility.h \ - /usr/include/c++/14/debug/debug.h \ - /usr/include/c++/14/bits/predefined_ops.h \ - /usr/include/c++/14/bits/refwrap.h /usr/include/c++/14/bits/invoke.h \ - /usr/include/c++/14/bits/range_access.h \ - /usr/include/c++/14/initializer_list \ - /usr/include/c++/14/bits/basic_string.h \ - /usr/include/c++/14/ext/alloc_traits.h \ - /usr/include/c++/14/bits/alloc_traits.h \ - /usr/include/c++/14/bits/stl_construct.h \ - /usr/include/c++/14/ext/string_conversions.h /usr/include/c++/14/cstdlib \ - /usr/include/stdlib.h /usr/include/bits/waitflags.h \ - /usr/include/bits/waitstatus.h /usr/include/sys/types.h \ - /usr/include/bits/types/clock_t.h /usr/include/bits/types/clockid_t.h \ - /usr/include/bits/types/time_t.h /usr/include/bits/types/timer_t.h \ - /usr/include/bits/stdint-intn.h /usr/include/endian.h \ - /usr/include/bits/byteswap.h /usr/include/bits/uintn-identity.h \ - /usr/include/sys/select.h /usr/include/bits/select.h \ - /usr/include/bits/types/sigset_t.h /usr/include/bits/types/__sigset_t.h \ - /usr/include/bits/types/struct_timeval.h \ - /usr/include/bits/types/struct_timespec.h \ - /usr/include/bits/pthreadtypes.h /usr/include/bits/thread-shared-types.h \ - /usr/include/bits/pthreadtypes-arch.h \ - /usr/include/bits/atomic_wide_counter.h /usr/include/bits/struct_mutex.h \ - /usr/include/bits/struct_rwlock.h /usr/include/alloca.h \ - /usr/include/bits/stdlib-bsearch.h /usr/include/bits/stdlib-float.h \ - /usr/include/c++/14/bits/std_abs.h /usr/include/c++/14/cstdio \ - /usr/include/stdio.h /usr/include/bits/types/__fpos_t.h \ - /usr/include/bits/types/__fpos64_t.h \ - /usr/include/bits/types/struct_FILE.h \ - /usr/include/bits/types/cookie_io_functions_t.h \ - /usr/include/bits/stdio_lim.h /usr/include/bits/stdio.h \ - /usr/include/c++/14/cerrno /usr/include/errno.h \ - /usr/include/bits/errno.h /usr/include/linux/errno.h \ - /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ - /usr/include/asm-generic/errno-base.h /usr/include/bits/types/error_t.h \ - /usr/include/c++/14/bits/charconv.h \ - /usr/include/c++/14/bits/functional_hash.h \ - /usr/include/c++/14/bits/hash_bytes.h \ - /usr/include/c++/14/bits/basic_string.tcc \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/uri_errors.hpp \ - /usr/include/c++/14/system_error \ - /usr/include/c++/14/x86_64-redhat-linux/bits/error_constants.h \ - /usr/include/c++/14/stdexcept /usr/include/c++/14/exception \ - /usr/include/c++/14/bits/exception_ptr.h \ - /usr/include/c++/14/bits/cxxabi_init_exception.h \ - /usr/include/c++/14/typeinfo /usr/include/c++/14/bits/nested_exception.h \ - /usr/local/src/asymptote-2.95/LspCpp/third_party/uri/include/network/uri/config.hpp diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/progress.marks b/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/progress.marks deleted file mode 100644 index ec635144f6..0000000000 --- a/graphics/asymptote/LspCpp/third_party/uri/src/CMakeFiles/progress.marks +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/Makefile b/graphics/asymptote/LspCpp/third_party/uri/src/Makefile new file mode 100644 index 0000000000..93d1c1612d --- /dev/null +++ b/graphics/asymptote/LspCpp/third_party/uri/src/Makefile @@ -0,0 +1,423 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.30 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Produce verbose output by default. +VERBOSE = 1 + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /usr/local/src/asymptote-2.96/LspCpp + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /usr/local/src/asymptote-2.96/LspCpp + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake cache editor..." + /usr/bin/ccmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Available install components are: \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components +.PHONY : list_install_components/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# The main all target +all: cmake_check_build_system + cd /usr/local/src/asymptote-2.96/LspCpp && $(CMAKE_COMMAND) -E cmake_progress_start /usr/local/src/asymptote-2.96/LspCpp/CMakeFiles /usr/local/src/asymptote-2.96/LspCpp/third_party/uri/src//CMakeFiles/progress.marks + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 third_party/uri/src/all + $(CMAKE_COMMAND) -E cmake_progress_start /usr/local/src/asymptote-2.96/LspCpp/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 third_party/uri/src/clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 third_party/uri/src/preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 third_party/uri/src/preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + cd /usr/local/src/asymptote-2.96/LspCpp && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +# Convenience name for target. +third_party/uri/src/CMakeFiles/network-uri.dir/rule: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 third_party/uri/src/CMakeFiles/network-uri.dir/rule +.PHONY : third_party/uri/src/CMakeFiles/network-uri.dir/rule + +# Convenience name for target. +network-uri: third_party/uri/src/CMakeFiles/network-uri.dir/rule +.PHONY : network-uri + +# fast build rule for target. +network-uri/fast: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/build +.PHONY : network-uri/fast + +detail/uri_advance_parts.o: detail/uri_advance_parts.cpp.o +.PHONY : detail/uri_advance_parts.o + +# target to build an object file +detail/uri_advance_parts.cpp.o: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.o +.PHONY : detail/uri_advance_parts.cpp.o + +detail/uri_advance_parts.i: detail/uri_advance_parts.cpp.i +.PHONY : detail/uri_advance_parts.i + +# target to preprocess a source file +detail/uri_advance_parts.cpp.i: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.i +.PHONY : detail/uri_advance_parts.cpp.i + +detail/uri_advance_parts.s: detail/uri_advance_parts.cpp.s +.PHONY : detail/uri_advance_parts.s + +# target to generate assembly for a file +detail/uri_advance_parts.cpp.s: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_advance_parts.cpp.s +.PHONY : detail/uri_advance_parts.cpp.s + +detail/uri_normalize.o: detail/uri_normalize.cpp.o +.PHONY : detail/uri_normalize.o + +# target to build an object file +detail/uri_normalize.cpp.o: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.o +.PHONY : detail/uri_normalize.cpp.o + +detail/uri_normalize.i: detail/uri_normalize.cpp.i +.PHONY : detail/uri_normalize.i + +# target to preprocess a source file +detail/uri_normalize.cpp.i: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.i +.PHONY : detail/uri_normalize.cpp.i + +detail/uri_normalize.s: detail/uri_normalize.cpp.s +.PHONY : detail/uri_normalize.s + +# target to generate assembly for a file +detail/uri_normalize.cpp.s: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_normalize.cpp.s +.PHONY : detail/uri_normalize.cpp.s + +detail/uri_parse.o: detail/uri_parse.cpp.o +.PHONY : detail/uri_parse.o + +# target to build an object file +detail/uri_parse.cpp.o: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.o +.PHONY : detail/uri_parse.cpp.o + +detail/uri_parse.i: detail/uri_parse.cpp.i +.PHONY : detail/uri_parse.i + +# target to preprocess a source file +detail/uri_parse.cpp.i: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.i +.PHONY : detail/uri_parse.cpp.i + +detail/uri_parse.s: detail/uri_parse.cpp.s +.PHONY : detail/uri_parse.s + +# target to generate assembly for a file +detail/uri_parse.cpp.s: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse.cpp.s +.PHONY : detail/uri_parse.cpp.s + +detail/uri_parse_authority.o: detail/uri_parse_authority.cpp.o +.PHONY : detail/uri_parse_authority.o + +# target to build an object file +detail/uri_parse_authority.cpp.o: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.o +.PHONY : detail/uri_parse_authority.cpp.o + +detail/uri_parse_authority.i: detail/uri_parse_authority.cpp.i +.PHONY : detail/uri_parse_authority.i + +# target to preprocess a source file +detail/uri_parse_authority.cpp.i: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.i +.PHONY : detail/uri_parse_authority.cpp.i + +detail/uri_parse_authority.s: detail/uri_parse_authority.cpp.s +.PHONY : detail/uri_parse_authority.s + +# target to generate assembly for a file +detail/uri_parse_authority.cpp.s: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_parse_authority.cpp.s +.PHONY : detail/uri_parse_authority.cpp.s + +detail/uri_resolve.o: detail/uri_resolve.cpp.o +.PHONY : detail/uri_resolve.o + +# target to build an object file +detail/uri_resolve.cpp.o: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.o +.PHONY : detail/uri_resolve.cpp.o + +detail/uri_resolve.i: detail/uri_resolve.cpp.i +.PHONY : detail/uri_resolve.i + +# target to preprocess a source file +detail/uri_resolve.cpp.i: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.i +.PHONY : detail/uri_resolve.cpp.i + +detail/uri_resolve.s: detail/uri_resolve.cpp.s +.PHONY : detail/uri_resolve.s + +# target to generate assembly for a file +detail/uri_resolve.cpp.s: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/detail/uri_resolve.cpp.s +.PHONY : detail/uri_resolve.cpp.s + +uri.o: uri.cpp.o +.PHONY : uri.o + +# target to build an object file +uri.cpp.o: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.o +.PHONY : uri.cpp.o + +uri.i: uri.cpp.i +.PHONY : uri.i + +# target to preprocess a source file +uri.cpp.i: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.i +.PHONY : uri.cpp.i + +uri.s: uri.cpp.s +.PHONY : uri.s + +# target to generate assembly for a file +uri.cpp.s: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/uri.cpp.s +.PHONY : uri.cpp.s + +uri_builder.o: uri_builder.cpp.o +.PHONY : uri_builder.o + +# target to build an object file +uri_builder.cpp.o: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.o +.PHONY : uri_builder.cpp.o + +uri_builder.i: uri_builder.cpp.i +.PHONY : uri_builder.i + +# target to preprocess a source file +uri_builder.cpp.i: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.i +.PHONY : uri_builder.cpp.i + +uri_builder.s: uri_builder.cpp.s +.PHONY : uri_builder.s + +# target to generate assembly for a file +uri_builder.cpp.s: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/uri_builder.cpp.s +.PHONY : uri_builder.cpp.s + +uri_errors.o: uri_errors.cpp.o +.PHONY : uri_errors.o + +# target to build an object file +uri_errors.cpp.o: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.o +.PHONY : uri_errors.cpp.o + +uri_errors.i: uri_errors.cpp.i +.PHONY : uri_errors.i + +# target to preprocess a source file +uri_errors.cpp.i: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.i +.PHONY : uri_errors.cpp.i + +uri_errors.s: uri_errors.cpp.s +.PHONY : uri_errors.s + +# target to generate assembly for a file +uri_errors.cpp.s: + cd /usr/local/src/asymptote-2.96/LspCpp && $(MAKE) $(MAKESILENT) -f third_party/uri/src/CMakeFiles/network-uri.dir/build.make third_party/uri/src/CMakeFiles/network-uri.dir/uri_errors.cpp.s +.PHONY : uri_errors.cpp.s + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... install" + @echo "... install/local" + @echo "... install/strip" + @echo "... list_install_components" + @echo "... rebuild_cache" + @echo "... network-uri" + @echo "... detail/uri_advance_parts.o" + @echo "... detail/uri_advance_parts.i" + @echo "... detail/uri_advance_parts.s" + @echo "... detail/uri_normalize.o" + @echo "... detail/uri_normalize.i" + @echo "... detail/uri_normalize.s" + @echo "... detail/uri_parse.o" + @echo "... detail/uri_parse.i" + @echo "... detail/uri_parse.s" + @echo "... detail/uri_parse_authority.o" + @echo "... detail/uri_parse_authority.i" + @echo "... detail/uri_parse_authority.s" + @echo "... detail/uri_resolve.o" + @echo "... detail/uri_resolve.i" + @echo "... detail/uri_resolve.s" + @echo "... uri.o" + @echo "... uri.i" + @echo "... uri.s" + @echo "... uri_builder.o" + @echo "... uri_builder.i" + @echo "... uri_builder.s" + @echo "... uri_errors.o" + @echo "... uri_errors.i" + @echo "... uri_errors.s" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + cd /usr/local/src/asymptote-2.96/LspCpp && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/cmake_install.cmake b/graphics/asymptote/LspCpp/third_party/uri/src/cmake_install.cmake new file mode 100644 index 0000000000..229b3c2cb2 --- /dev/null +++ b/graphics/asymptote/LspCpp/third_party/uri/src/cmake_install.cmake @@ -0,0 +1,48 @@ +# Install script for directory: /usr/local/src/asymptote-2.96/LspCpp/third_party/uri/src + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "0") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set path to fallback-tool for dependency-resolution. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE STATIC_LIBRARY FILES "/usr/local/src/asymptote-2.96/LspCpp/third_party/uri/src/libnetwork-uri.a") +endif() + diff --git a/graphics/asymptote/LspCpp/third_party/uri/src/libnetwork-uri.a b/graphics/asymptote/LspCpp/third_party/uri/src/libnetwork-uri.a Binary files differindex c65daa9d0f..a1ad653464 100644 --- a/graphics/asymptote/LspCpp/third_party/uri/src/libnetwork-uri.a +++ b/graphics/asymptote/LspCpp/third_party/uri/src/libnetwork-uri.a diff --git a/graphics/asymptote/LspCpp/vcpkg.json b/graphics/asymptote/LspCpp/vcpkg.json new file mode 100644 index 0000000000..9b7ae0c86f --- /dev/null +++ b/graphics/asymptote/LspCpp/vcpkg.json @@ -0,0 +1,27 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "name": "lspcpp", + "builtin-baseline": "5e5d0e1cd7785623065e77eff011afdeec1a3574", + "version": "0.0-snapshot", + "dependencies": [ + "rapidjson", + "boost-asio", + "boost-beast", + "boost-date-time", + "boost-chrono", + "boost-filesystem", + "boost-system", + "boost-uuid", + "boost-thread", + "boost-process", + "boost-program-options" + ], + "features": { + "bdwgc": { + "description": "Build with bdwgc support", + "dependencies": [ + "bdwgc" + ] + } + } +} |