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

Open valid url under cursor #4970

Merged
merged 3 commits into from
Oct 29, 2022
Merged

Conversation

anijanyan
Copy link
Contributor

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link

codecov bot commented Oct 19, 2022

Codecov Report

Base: 86.06% // Head: 86.06% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (af4eeca) compared to base (5294aa2).
Patch coverage: 78.57% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4970      +/-   ##
==========================================
- Coverage   86.06%   86.06%   -0.01%     
==========================================
  Files         544      544              
  Lines       41444    41470      +26     
  Branches     6537     6541       +4     
==========================================
+ Hits        35670    35691      +21     
- Misses       5774     5779       +5     
Flag Coverage Δ
unittests 86.06% <78.57%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/commands/default_commands.js 76.61% <0.00%> (-0.39%) ⬇️
src/editor.js 82.72% <75.00%> (-0.12%) ⬇️
src/editor_commands_test.js 99.76% <100.00%> (+<0.01%) ⬆️
src/scrollbar_custom.js 95.15% <0.00%> (ø)
src/layer/text.js 91.35% <0.00%> (+0.21%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@anijanyan anijanyan marked this pull request as draft October 21, 2022 09:55
src/editor.js Outdated
/**
* Open valid url under cursor in another tab
**/
this.jumptodef = function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we call it openLink instead? Jump to definition has usually a different meaning across

src/editor.js Outdated
* Finds link at defined {row} and {column}
* @returns {String}
**/
this.findLinkAt = function (row,column) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add a test for this function?

src/editor.js Outdated
this.findLinkAt = function (row,column) {
var line = this.session.getLine(row);
var wordParts = line.split(/((?:https?|ftp):\/\/[\S]+)/);
var delta = column;
Copy link
Contributor

Choose a reason for hiding this comment

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

can we rename delta to columnPosition instead to reflect the intent?

src/editor.js Outdated
if (delta < 0) delta = 0;
var curLength = 0, itLength = 0, match;
wordParts.forEach(function (item) {
itLength = curLength + item.length;
Copy link
Contributor

Choose a reason for hiding this comment

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

can we rename curLength to previousPosition and itLength to currentPosition?

itLength = curLength + item.length;
if (delta >= curLength && delta <= itLength) {
if (item.match(/((?:https?|ftp):\/\/[\S]+)/)) {
match = item.replace(/[\s:.,'";}\]]+$/, "");
Copy link
Contributor

Choose a reason for hiding this comment

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

should we add break here so we don't look at the rest of the line? it can help with large lines

@anijanyan
Copy link
Contributor Author

@andrewnester Thank you for review! All should be fixed now.

@anijanyan anijanyan marked this pull request as ready for review October 28, 2022 10:15
Copy link
Contributor

@andrewnester andrewnester left a comment

Choose a reason for hiding this comment

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

Build fails with

/home/runner/work/ace/ace/src/editor_commands_test.js
Warning: 8:5 warning 'ace' is assigned a value but never used no-unused-vars
Warning: 9:5 warning 'EditSession' is assigned a value but never used no-unused-vars
Error: 546:6 error Unexpected trailing comma comma-dangle

✖ 3 problems (1 error, 2 warnings)
1 error and 0 warnings potentially fixable with the --fix option.

@anijanyan
Copy link
Contributor Author

Build fails with

/home/runner/work/ace/ace/src/editor_commands_test.js
Warning: 8:5 warning 'ace' is assigned a value but never used no-unused-vars
Warning: 9:5 warning 'EditSession' is assigned a value but never used no-unused-vars
Error: 546:6 error Unexpected trailing comma comma-dangle

✖ 3 problems (1 error, 2 warnings)
1 error and 0 warnings potentially fixable with the --fix option.

Oh, sorry, haven't noticed this. Fixed now.

@andrewnester andrewnester merged commit bf2913a into ajaxorg:master Oct 29, 2022
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