ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "Eregon (Benoit Daloze) via ruby-core" <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: "Eregon (Benoit Daloze)" <noreply@ruby-lang.org>
Subject: [ruby-core:120577] [Ruby master Feature#8751] Add offsets to method#source_location
Date: Thu, 09 Jan 2025 14:33:15 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-111404.20250109143315.73@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-8751.20130808140329.73@ruby-lang.org>

Issue #8751 has been updated by Eregon (Benoit Daloze).


In light of end line and column information being added in #6012 do you think there is still a need for byte offsets?

----------------------------------------
Feature #8751: Add offsets to method#source_location
https://bugs.ruby-lang.org/issues/8751#change-111404

* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
----------------------------------------
Hello,

I would like to have byte offsets returned on the source_location for methods.  For example:

def foo(&b)
  b.source_location # => [file_name, line_number, start_byte, end_byte]
end

If we had the start and end byte for a method or proc, then we could find the source for methods and procs in each file.  There are some cases (like with heredocuments) where the "end of the method" could be after the `end` keyword.  But I think if we just have offsets for the start of `def` and the end of `end`, I think it would cover 99% of usecases.



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

       reply	other threads:[~2025-01-09 14:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-8751.20130808140329.73@ruby-lang.org>
2025-01-09 14:33 ` Eregon (Benoit Daloze) via ruby-core [this message]
2025-01-09 18:31 ` [ruby-core:120589] " rocky (Rocky Bernstein) via ruby-core

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-111404.20250109143315.73@ruby-lang.org \
    --to=ruby-core@ml.ruby-lang.org \
    --cc=noreply@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).