diagnostics helpers for front-ends
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 1.1k
- Forks
- 266
- Avg merge
- 2h 56m
- Merged PRs (30d)
- 1
Description
I'm taking a look at beefing up the Stan mode in RStudio now. If I understand correctly, right now Stan produces compiler errors as text, e.g.
> rstan:::rstudio_stanc("~/scratch/test.stan")
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
Warning (non-fatal): Comments beginning with # are deprecated. Please use // in place of # for line comments.
Warning (non-fatal): Comments beginning with # are deprecated. Please use // in place of # for line comments.
error in 'model_test' at line 5, column 3
-------------------------------------------------
3: data {
4: int<lower=0> N
5: int<lower=0> nt[N];
^
6: int<lower=0> rt[N];
-------------------------------------------------
PARSER EXPECTED: ";"
Error in stanc(model_code = paste(program, collapse = "\n"), model_name = model_cppname, :
failed to parse Stan model 'test' due to the above error.
Does a similar API exist for getting diagnostic errors, perhaps as a list or data.frame of diagnostic errors? E.g. with each list entry containing a row, column, severity, and message, or similar. What I'd love to see is something like:
list(
list(
row = 1,
column = 2,
severity = "error",
message = "parser expected ';'"
),
< ... other diagnostics ... >
)
We could also just scrape the relevant information from the printed message, but having an explicit helper API would be useful.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining the rstan:::rstudio_stanc helper and the stanc diagnostic output shown in the issue. Determine how structured diagnostics could expose row, column, severity, and message, and consider the requested list or data.frame shape; done means a documented helper API can return those fields instead of requiring message scraping.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100