Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

`ark` discussion notes

Đang mở
#24 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
15/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
r
Lĩnh vực
devtools

Hướng nghiên cứu

Issue không nêu tên tệp hay bài kiểm thử nào của ark; trước tiên hãy đọc các tệp debugadapter được tham chiếu là R/breakpoints.R và R/debug_prompt.R, sau đó tái hiện ví dụ về điều kiện debug()/browser() của base R. Trước khi triển khai, hãy chuyển các ghi chú thành một thay đổi cụ thể cho ark kèm điều kiện chấp nhận; issue hiện tại chưa định nghĩa việc hoàn thành.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I had the pleasure of getting to chat a bit with @lionel- at posit::conf and just wanted to track a few notes that came out of the discussion.

tips for debugadapter
  • Recommendation to use later. From what I can tell, this will allow for easy management of a background thread that can affect the global environment. Quick POC:
     i <- 0
     f <- function() { i <<- i + 1; later::later(f, 1) }
     f()
     # wait n seconds.. Sys.sleep will not work because bg thread can't use interrupts
     i
     # [1] <n>
    
    looks like a totally viable solution to me. I don't really care about non-interruptable code as we just need to periodically listen for new state from the adapter at the top level. In fact, it might even offer a better alternative to running the debugger in a separate process.
  • Lionel mentioned a few edge cases where either the source isn't known (not yet sourced.. if there were other cases I forgot them)
  • Lionel mentioned foreseen challenges with getting the source from lines sent to the console from a selection, suggesting that it might require a wrapping function for sending code with a "faked" srcref.
learnings from debugadapter for ark
  • Mentioned that managing trace() insertions of browser() statements was painful. trace will affect the function's body, meaning that multiple insertions need to account for the difference between source and traced version of the code (ie, a breakpoint at line 10 in the file open in a user's editor might actually want to insert a new browser() at line 11 because a browser() statement has already been inserted at some point above). This is otherwise an attractive option, since the browser statement can be inserted at an arbitrary location (easily found with utils::findLineNum())
  • debug() simplifies this, as it will not insert code. However it introduces a new challenge - that debug() always enters the debug prompt upon entering a debugged function. Currently, I automatically step through the function until a breakpoint is hit. This still emits all the debug prompt output, so you get a bunch of messages as R steps through the lines of the function. Definitely still room for improvement.
for both.. potential bug?
  • Mentioned bug with debug(), in which the condition argument seems to have no effect. Might be a base R bug, or at least a devel R bug.
    options(browser.hook = function(hook, condition, envir) { print(condition) })
    f <- function() { print("123"); browser(condition = list(origin = "browser")) }
    debug(f, condition = list(origin = "globalenv"))
    f()
    #  ...
    #> debug at #1: browser(condition = list(origin = "browser"))
    #> NULL  # debug() condition output
    #> $origin  # browser() condition output
    #> [1] "browser"
    
Ngôn ngữ chính
R
Star
20
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của dgkf/debugadapter

Tất cả issue của dgkf/debugadapter

Issue tương tự

Thêm issue về R

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.