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

Add Code complete #62

Merged
merged 2 commits into from
May 9, 2024
Merged

Add Code complete #62

merged 2 commits into from
May 9, 2024

Conversation

alexander-penev
Copy link
Collaborator

No description provided.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Comment on lines +257 to +258
std::size_t _cursor_pos = cursor_pos;
auto text = split_line(code, delims, _cursor_pos);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: invalid case style for variable '_cursor_pos' [readability-identifier-naming]

Suggested change
std::size_t _cursor_pos = cursor_pos;
auto text = split_line(code, delims, _cursor_pos);
std::size_t cursor_pos = cursor_pos;
auto text = split_line(code, delims, cursor_pos);

src/xinterpreter.cpp:260:

-         Cpp::CodeComplete(results, code.c_str(), 1, _cursor_pos + 1);
+         Cpp::CodeComplete(results, code.c_str(), 1, cursor_pos + 1);

std::string delims = " \t\n`!@#$^&*()=+[{]}\\|;:\'\",<>?.";
std::size_t _cursor_pos = cursor_pos;
auto text = split_line(code, delims, _cursor_pos);
std::string to_complete = text.back().c_str();
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: redundant call to 'c_str' [readability-redundant-string-cstr]

Suggested change
std::string to_complete = text.back().c_str();
std::string to_complete = text.back();

auto text = split_line(code, delims, _cursor_pos);
std::string to_complete = text.back().c_str();

Cpp::CodeComplete(results, code.c_str(), 1, _cursor_pos + 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: no member named 'CodeComplete' in namespace 'Cpp' [clang-diagnostic-error]

        Cpp::CodeComplete(results, code.c_str(), 1, _cursor_pos + 1);
             ^

Cpp::CodeComplete(results, code.c_str(), 1, _cursor_pos + 1);

return xeus::create_complete_reply(results /*matches*/,
cursor_pos - to_complete.length() /*cursor_start*/,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'unsigned long' to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

            cursor_pos - to_complete.length() /*cursor_start*/,
            ^

std::regex re(ss.str());

std::copy(
std::sregex_token_iterator(input.begin(), input.begin() + cursor_pos + 1, re, -1),
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type '__gnu_cxx::__normal_iterator<const char *, std::basic_string>::difference_type' (aka 'long') is implementation-defined [cppcoreguidelines-narrowing-conversions]

            std::sregex_token_iterator(input.begin(), input.begin() + cursor_pos + 1, re, -1),
                                                                      ^

Copy link
Contributor

github-actions bot commented May 9, 2024

clang-tidy review says "All clean, LGTM! 👍"

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.

LGTM!

@vgvassilev vgvassilev merged commit 04492f2 into main May 9, 2024
7 checks passed
@vgvassilev vgvassilev deleted the AddCodeComplete branch May 9, 2024 18:02
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.

2 participants