FSI send ignore comments #1859#2049
Conversation
Add functionality to skip comments and warn if a line is too long for the interactive session in `src/Components/Fsi.fs`. - **Skip Comments**: Modify the `sendSelection` function to filter out lines that start with `//` before sending the text to the terminal. - **Warn for Long Lines**: Add a `detectTerminalSize` function to get the terminal size and modify the `send` function to check if the number of lines exceeds the terminal rows. If it does, show a warning message to the user. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/jkone27/ionide-vscode-fsharp?shareId=XXXX-XXXX-XXXX-XXXX).
Revert changes in RELEASE_NOTES.md to match master
vzarytovskii
left a comment
There was a problem hiding this comment.
Are there any interactions with line numbers and fsi in ionide? I.e. if we strip comments, and then repl will emit a diagnostic, is it navigable back to editor? In this case, it needs to somehow be compensated.
| let private commentRegex = | ||
| Regex(@"\/{2,3}.+\S+", RegexOptions.ECMAScript) | ||
|
|
||
| let private multilineCommentRegex = | ||
| Regex(@"\(\*[\s\S]*?\*\)", RegexOptions.ECMAScript) |
There was a problem hiding this comment.
@vzarytovskii these are compiled to JS regexes, and I don't think there's a 'compiled' equivalent on that runtime.
|
@vzarytovskii you make a good point about the compensation - right now the closest thing we have to an 'in-editor' link is the fact that some terminals will look for things that look like a file path/line/column and will auto-link to it. VSCode does do this, so the line numbers might be a bit off. This is something that would be fixed for real if Ionide managed FSI sessions interactively via the FCS APIs instead of by 'driving' |
The "cheapest" solution might be is to not remove comments, but strip them to just |
| } | ||
|
|
||
| let private commentRegex = | ||
| Regex(@"\/{2,3}.+\S+", RegexOptions.ECMAScript) |
There was a problem hiding this comment.
This won't match the following:
//a
<any number of spaces here>//a<any number of spaces here>
First is quite short, so I suppose it's not an issue, second one might cause some issues?
This will match the following:
let foo = "// asdasdasdasdasdasd"
Which probably is not desired.
Second regex probably has some similar issues.
|
🤖 This is an automated response from Repo Assist. Hi @jkone27 — just a friendly check-in! This PR has been open since November 2024, and the last discussion suggested a potential tweak: rather than fully removing comments, stripping them to Are you still interested in pursuing this? If so, updating the PR to implement the line-preserving approach might help move it forward for review. If you'd like to hand it off or close it, that's also totally fine — just let us know!
|
fixes issue with comments too long , partial fix for general issue 1859, to avoid
FS0193: operation not supportedbut comments can be safely ignored and skip FSI send, even if very long