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 substitution variable for line_number #212

Closed
Tracked by #204 ...
bigla opened this issue Feb 24, 2022 · 3 comments · Fixed by #220
Closed
Tracked by #204 ...

add substitution variable for line_number #212

bigla opened this issue Feb 24, 2022 · 3 comments · Fixed by #220
Assignees
Milestone

Comments

@bigla
Copy link

bigla commented Feb 24, 2022

Goal

Open the source of a derived file when debugging derived files at exact same line. Because this makes this great tool even more flexible.

Explanation

I have some project generating derived files from source files with a different extension, without changing the file line numbers.

I'd love to be able to open the source file in an external editor passing the exact same line number where I am currently at (or where warnings and errors are indicating problems) using something along the lines of:
eclipse -name Eclipse --launcher.openFile ${easyshell:container_name}${easyshell:file_separator}${easyshell:resource_basename}.cu:${easyshell:resource_line_number}

Any occuring line breaks in above command not intended!

Example files:
derived file: myDerivedfile.cudato.cpp
source file: myDerivedfile.cu

Suggestion for a substitution variable name

${easyshell:resource_line_number}

@bigla
Copy link
Author

bigla commented Feb 24, 2022

For now I am using a bash script with the Eclipse built in "External Tools Configurations..."
(of course running without rebuilding - contact me if full configuration shall be posted here.)
configured External Tools arguments: ${selected_file} ${selected_text}

This is of course only for my special case described above. And no error handling, nor input sanitization is done.
WARNING: This assumes the first found line containing selected content is the right one.

set -x

selected_file=$1
selected_text=$2

echo "$selected_file"
echo "$selected_text"

selected_file_no_ext=${selected_file%.cudato.cpp}

echo "$selected_file_no_ext"

line_number="$(grep -nF "$selected_text" "$selected_file" | head -n 1 | cut -d : -f 1)"

echo "$line_number"


eclipse -name Eclipse --launcher.openFile "$selected_file_no_ext".cu:$line_number

@anb0s anb0s added this to the TBD milestone Feb 24, 2022
@bigla
Copy link
Author

bigla commented Feb 24, 2022

Workaround can be configured similarly to this Stackoverflow page answer.

FYI:
Sounds like Eclipse forgot about this Idea.
The issue that enabled opening files @ line numbers is here

@anb0s anb0s self-assigned this Mar 13, 2022
@anb0s anb0s modified the milestones: TBD, v2.3 Mar 13, 2022
@anb0s anb0s changed the title Add substitution variable for line_number (Enhancement) add substitution variable for line_number Mar 18, 2022
anb0s added a commit that referenced this issue Mar 18, 2022
... add substitutions for selected text #219

Signed-off-by: Andre Bossert <anb0s@anbos.de>
@anb0s anb0s linked a pull request Mar 18, 2022 that will close this issue
anb0s added a commit that referenced this issue Mar 18, 2022
... add substitutions for selected text #219

Signed-off-by: Andre Bossert <anb0s@anbos.de>
anb0s added a commit that referenced this issue Mar 19, 2022
... add substitutions for selected text #219

Signed-off-by: Andre Bossert <anb0s@anbos.de>
anb0s added a commit that referenced this issue Mar 27, 2022
... add substitutions for selected text #219

Signed-off-by: Andre Bossert <anb0s@anbos.de>
anb0s added a commit that referenced this issue Mar 27, 2022
... add substitutions for selected text #219

Signed-off-by: Andre Bossert <anb0s@anbos.de>
anb0s added a commit that referenced this issue Mar 27, 2022
... add substitutions for selected text #219

Signed-off-by: Andre Bossert <anb0s@anbos.de>
@anb0s
Copy link
Owner

anb0s commented Mar 29, 2022

@bigla see new pre-release v2.3.0-beta.2
that also includes chnages from pre-release v2.3.0-beta.1

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

Successfully merging a pull request may close this issue.

2 participants