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

Support R session requests by hosting a tcp server #1394

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f46da74
wip: start working on connection to the requests by a tcp server.
Jul 17, 2023
0d7f44f
support png plots over TCP
Jul 24, 2023
bbe6d59
remove test logging
Jul 24, 2023
d19307e
improve status bar details and info if connected or not
Jul 24, 2023
4bae0a7
Use active terminal if R is attached already
Jul 24, 2023
5f60ba6
allow attaching in a later stage
Jul 24, 2023
873af37
smart start of new R terminal, with the right TCP address
Jul 24, 2023
0460b3d
fix linting errors
Aug 1, 2023
72d57de
ignore errors on TCP disconnecting in the R side
Aug 1, 2023
099ccea
never call `.vsc.attach` on init automatically, since it happen by se…
Aug 1, 2023
6496252
fix the host passing on `.vsc.attach`
Aug 1, 2023
a4102bf
modify TCP->Tcp in vscode confs
Aug 1, 2023
cc2aa9b
cleaning old active connection if a new one wants to connect
Aug 2, 2023
0d3f446
minor issue fix
Aug 2, 2023
a7abdcf
expose detach function to R API
Aug 2, 2023
b5cb235
fix r-linting error in `init_late.R`
Aug 3, 2023
2a6681c
omit old TODO
Aug 3, 2023
860c8d5
graceful detach that restoring the previous hooks/handlers before vsc
Aug 3, 2023
6f6199d
acknowledgement on successful request and best-effort on server EOF m…
Aug 3, 2023
b45db8d
user button for detaching from session
Aug 3, 2023
9f300ee
add missing TODO
Aug 3, 2023
db53c60
fix webview on local html files by sending the HTML files content via…
Aug 4, 2023
f3490d7
use a more specific hostname if the TCP listening is on localhost
Aug 4, 2023
3702443
Merge branch 'master' into tcp-incoming-request-server
Aug 5, 2023
6056266
fix: better logging and strill create the session watcher tcp server …
Sep 6, 2023
7229e9f
remove an attempt to use type discrimination for now
Oct 10, 2023
62d9a74
Merge branch 'master' into tcp-incoming-request-server, and change to…
Oct 10, 2023
d994bb2
Merge branch 'master' into tcp-incoming-request-server
Dec 21, 2023
582096e
Merge branch 'master' into tcp-incoming-request-server
May 7, 2024
f73521e
remove unsued
May 7, 2024
cfdeb37
error if r.term doesn't exist as file only if the path is absolute
May 7, 2024
75ec0e2
Merge branch 'master' into tcp-incoming-request-server
May 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
modify TCP->Tcp in vscode confs
Tal Hadad committed Aug 1, 2023
commit a4102bf9e544af6ac773542bccdc11bf7d252019
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1730,17 +1730,17 @@
"default": true,
"description": "Enable R session watcher. Required for workspace viewer and most features to work with an R session. Restart required to take effect."
},
"r.sessionWatcherTCPServer": {
"r.sessionWatcherTcpServer": {
"type": "boolean",
"default": true,
"description": "Enable TCP server connection for watching over R sessions. Requires `#r.sessionWatcher#` to be set to `true`. Requires reloading for changes to take effect."
},
"r.sessionWatcherTCPServerHostName": {
"r.sessionWatcherTcpServerHostName": {
"type": "string",
"default": "127.0.0.1",
"description": "The host name to listen for watching over R sessions. E.g. 127.0.0.1 for local connection only, and 0.0.0.0 for global exposure (security note: use the latter only in a secured close local network!). Requires `#r.sessionWatcher#` and `r.sessionWatcher.TCPServer` to be set to `true`. Requires reloading for changes to take effect."
},
"r.sessionWatcherTCPServerPort": {
"r.sessionWatcherTcpServerPort": {
"type": "integer",
"default": 0,
"description": "The port to listen to, or 0 for automatic port selection (recommended). Requires `#r.sessionWatcher#` and `r.sessionWatcher.TCPServer` to be set to `true`. Requires reloading for changes to take effect."
6 changes: 3 additions & 3 deletions src/session.ts
Original file line number Diff line number Diff line change
@@ -120,7 +120,7 @@ export function startRequestWatcher(sessionStatusBarItem: StatusBarItem): void {
void updateRequest(sessionStatusBarItem);
});

if (config().get<boolean>('sessionWatcherTCPServer')) {
if (config().get<boolean>('sessionWatcherTcpServer')) {
void startIncomingRequestServer(sessionStatusBarItem);
}

@@ -875,8 +875,8 @@ function startIncomingRequestServer(sessionStatusBarItem: StatusBarItem) {
}
});

const server = incomingRequestServer.listen(config().get<number>('sessionWatcherTCPServerPort'),
config().get<string>('sessionWatcherTCPServerHostName'), function() {
const server = incomingRequestServer.listen(config().get<number>('sessionWatcherTcpServerPort'),
config().get<string>('sessionWatcherTcpServerHostName'), function() {
incomingRequestServerAddressInfo = server.address() as AddressInfo;
console.info(`Started listening on ${addressToStr(incomingRequestServerAddressInfo)}`);