Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base implementation of inspect request impl. #11

Merged

Conversation

mvassilev
Copy link
Contributor

@mvassilev mvassilev commented Jun 17, 2023

There is a problem here with the inspect_request_impl function not being invoked which prevents handling input like "? std::vector" that is supposed to display documentation to the user.

@vgvassilev
Copy link
Contributor

@SylvainCorlay do you have a clue?

@SylvainCorlay
Copy link
Collaborator

Hey there, sorry for not getting back to you earlier.

The way to trigger these inspect requests from a JupyterLab UI is to open the "Contextual Help" from the "Help" topbar menu.

Then any keystroke will trigger an inspect request when the contextual help is open.

@ioanaif
Copy link
Contributor

ioanaif commented Jul 6, 2023

Hi!

I have this working locally and will be adding the changes here (as discussed with @vgvassilev via Skype) :

mvassilev#1

Screenshot 2023-07-06 at 14 27 08

@SylvainCorlay
Copy link
Collaborator

SylvainCorlay commented Jul 6, 2023

Hourray, this ia amazing!

Ping @gouarin for awareness.

@vgvassilev
Copy link
Contributor

Do we have a clang-format configuration for this project? If not, shall we use the standard one from llvm?

@vgvassilev
Copy link
Contributor

vgvassilev commented Jul 12, 2023

@SylvainCorlay, @gouarin what is the way to move forward here?

@gouarin
Copy link

gouarin commented Jul 20, 2023

@mvassilev and @ioanaif thank you for your PR. It's a nice feature and it's great that it's working again! I'm really sorry for the delay and I will try to make a review soon. I also need to look at what @SylvainCorlay did in this project. Since I wrote xeus-cling, I haven't spent much time contributing to it. I will try to change that ;).

@vgvassilev we have no clang-format for this project for now but I can add one.

CMakeLists.txt Outdated
@@ -171,7 +171,7 @@ macro(xeus_cpp_set_common_options target_name)
endif ()

set_target_properties(${target_name} PROPERTIES
INSTALL_RPATH_USE_LINK_PATH TRUE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why changing the RPATH setting?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This seems to be somewhat unrelated to the rest of the changes.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ioanaif Can you comment on this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made that change to have the install work on my local machine (macos) and avoid this error:

-- Installing: /Users/ioana/opt/anaconda3/envs/xeus-cpp/libn/libxeus-cpp.0.dylib
error: /Users/ioana/opt/anaconda3/envs/xeus-cpp/bin/install_name_tool: for: /Users/ioana/opt/anaconda3/envs/xeus-cpp/libn/libxeus-cpp.0.0.1.dylib (for architecture x86_64) option "-add_rpath /Users/ioana/opt/anaconda3/envs/xeus-cpp/lib" would duplicate path, file already has LC_RPATH for: /Users/ioana/opt/anaconda3/envs/xeus-cpp/lib

From the CI logs it seems this is not a necessary change for macos and it was just my environment that was not properly set up.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in that case I'd propose to revert these changes.

}
*/
clang::QualType QT = E->getType();
return QT.getAsString();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Really happy that we can get away from the typeid approach.

@@ -0,0 +1,4 @@
{
"url": "https://xtensor.readthedocs.io/en/latest/",
"tagfile": "xtensor.tag"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we don't install the xtensor tag files as part of this PR, since it should probably be installed by xtensor itself.

{
{ std::string exp = R"(\w*(?:\:{2}|\<.*\>|\(.*\)|\[.*\])?)";
std::regex re(R"((\w*(?:\:{2}|\<.*\>|\(.*\)|\[.*\])?)(\.?)*$)");
auto inspect_request = is_inspect_request(code, re);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An inspect request is a different type of message, triggered by keystrokes in the editor when the inspector panel is open.

I don't think we should call this function is_inspect_request but more like is_help_magic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_help_magic returns bool so what should be the logic here in the cases of true or false?

auto inspect_request = is_inspect_request(code, re);
if (inspect_request.first)
{
inspect(inspect_request.second[0], kernel_res, *m_interpreter);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to discuss this. Maybe we should not rebind into the inspect function here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this would be related to the previous conversation regarding the replacement of is_inspect_request with is_help_magic

@SylvainCorlay
Copy link
Collaborator

I left a few comments in the review. Happy to discuss the changes. It seems that the CI failures come from an issue with the header inclusion order. I have come across this in earlier PRs and had to make sure some things were included earlier than other.

@mvassilev mvassilev force-pushed the InspectRequestImplementation branch from c0d3681 to 213acd2 Compare July 21, 2023 17:16
This should fix the bot error: expected ')' before 'PRIxPTR'

A similar issue is reported in tensorflow/tensorflow#12998
@vgvassilev vgvassilev force-pushed the InspectRequestImplementation branch 4 times, most recently from 8efe593 to a17da7e Compare July 21, 2023 22:48
@vgvassilev vgvassilev force-pushed the InspectRequestImplementation branch 2 times, most recently from 47b9b6b to 0dbf6b4 Compare July 21, 2023 23:16
@vgvassilev vgvassilev force-pushed the InspectRequestImplementation branch from 0dbf6b4 to a12fe36 Compare July 21, 2023 23:20
@vgvassilev
Copy link
Contributor

@SylvainCorlay, @gouarin, this looks mostly okay to me.

@SylvainCorlay, can you take a look and answer to the remaining questions?

I have a question on my own: Is there a way to avoid putting share/xeus-cpp/tagfiles/cppreference-doxygen-web.tag in the repository and download it from somewhere instead?

Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to move forward here and break the stalemate. We can rely on a post-commit review here. LGTM!

@vgvassilev vgvassilev merged commit eb4d98a into compiler-research:main Aug 30, 2023
2 of 8 checks passed
@SylvainCorlay
Copy link
Collaborator

I have a question on my own: Is there a way to avoid putting share/xeus-cpp/tagfiles/cppreference-doxygen-web.tag in the repository and download it from somewhere instead?

I don't think this file exist otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants