-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement infrastructure for R routine registration (#58)
* [WIP] * [WIP] * [WIP] * POC of routine registration * wire up automagic routine registration * fix up some imports
- Loading branch information
1 parent
d3a7961
commit a9ce481
Showing
18 changed files
with
270 additions
and
69 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
extensions/positron-r/amalthea/crates/ark/src/lsp/browser.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// browser.rs | ||
// | ||
// Copyright (C) 2022 by Posit, PBC | ||
// | ||
// | ||
|
||
use libR_sys::*; | ||
use tokio::runtime::Runtime; | ||
use tower_lsp::lsp_types::MessageType; | ||
|
||
use crate::lsp::backend::CLIENT; | ||
|
||
#[harp::register] | ||
pub unsafe extern "C" fn ps_browse_url(url: SEXP) -> SEXP { | ||
|
||
let runtime = Runtime::new().unwrap(); | ||
runtime.block_on(async move { | ||
let client = CLIENT.get().unwrap().lock(); | ||
client.log_message(MessageType::INFO, "This is a message from an R callback!").await; | ||
}); | ||
|
||
R_NilValue | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
// | ||
|
||
pub mod backend; | ||
pub mod browser; | ||
pub mod comm; | ||
pub mod completions; | ||
pub mod definitions; | ||
|
10 changes: 10 additions & 0 deletions
10
extensions/positron-r/amalthea/crates/ark/src/lsp/modules/options.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# | ||
# options.R | ||
# | ||
# Copyright (C) 2022 by Posit, PBC | ||
# | ||
# | ||
|
||
options(browser = function(url) { | ||
.Call("ps_browse_url", as.character(url), PACKAGE = "(embedding)") | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
extensions/positron-r/amalthea/crates/harp/harp-macros/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "harp-macros" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
proc-macro = true | ||
|
||
[dependencies] | ||
proc-macro2 = "*" | ||
quote = "*" | ||
syn = { version = "*", features = ["full"] } | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
Oops, something went wrong.