-
-
Notifications
You must be signed in to change notification settings - Fork 26
Add resyntax integration #153
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
base: master
Are you sure you want to change the base?
Conversation
And what do you think user defined rules? Should we support it? And how to support it? |
I have a similar question, if user didn’t like a certain suggestions, where can they disable it? It seems we also need magic-racket they give us those configurations? |
misc
|
For user-defined rules, I don't think supporting that should be the editor's responsibility. That should be integrated into Resyntax proper - possibly through some mechanism where some |
@dannypsnl Resyntax's goal is to not provide suggestions that people frequently want to disable. So far, that's mostly been working. If there are suggestions that people don't find to be helpful, I would rather they file issues in the Resyntax github repository than disable them themselves. But see also some of my thoughts for suppressing suggestions within Resyntax itself: jackfirth/resyntax#436. |
@jackfirth I think the difference is that, code actions are annoying in editor, so they better show up only when no one will argue that's a style problem. For another part. Indeed, if resyntax can search user config than no need to change magic-racket, configure options in vscode is painful. |
First off, this a neat feature, thanks for working on it! 😄 I do think some means to at least to disable suggestions entirely is needed, as not everyone will want them to appear. The main pathways I can imagine are:
I can also imagine some people wanting more fine-grained control beyond just off / on, but that's perhaps a future refinement. Looking at other language ecosystems, Rust Analyzer takes the first path of having quite a few editor-level settings which are then passed to the lang server. IIRC, we don't have any concept of that for Racket so far, but it seems like a reasonable way for users to communicate their preferences for tooling features like this. |
Just on or off would be the perfect setting to have in the langserver / editor / what-have-you. Fine-grained configuration should definitely be handled at the Resyntax layer without editors or langservers needing to do anything. |
Racket-langserver now requires minimum version of Racket 8.16, from the previous 7.6. Because resyntax uses treelist (8.13) and I don't know if this is good and is there any way to avoid this requirement? |
For unsupported language files, resyntax can skip them automatically, so we don't need to take any action. But every time resyntax skips a file, it always print this log to stderr
This log cannot be disabled. It could be a problem when debug. |
I added settings to enable editor control features. By default it's this: {
"resyntax": {
"enable": true
}
} @jryans Please test if it works if you have time. |
@6cdh You can use ((with-handlers
([exn? (λ (e) (λ (_) #f))])
(dynamic-require (list 'lib "racket/treelist") 'sequence->treelist1))
(list 1 2 3)) If |
If we create another function, e.g. |
Thanks, I will endeavour to take a look, but it may take me a while (recent illness plus too many things to do), so please don’t feel you need to wait on me. |
Resyntax has so far been built on the assumption it's running in a CI environment where it's easy to use the most recent Racket version. You won't be able to get Resyntax working on an older Racket version from the outside. It would need some fairly extensive work done on Resyntax itself. |
Resyntax probably also uses other new features, and only detect treelist is not enough. But maybe we can use
I don't understand your meaning. In this code (define result-set
(resyntax-analyze
text-source
#:suite default-recommendations
#:lines all-lines)) If the |
@6cdh Indeed, dynamic require resyntax is enough. I mean the stderr output you mentioned, that’s from an resyntax internal logging function.
|
It checks if resyntax is available in the environment and uses it if so. This commit also restore CI and info.rkt to keep old Racket compatibility.
Oh you mean this skip function Yes, I agree. |
That's using a normal racket logger with the topic |
I know. But these stderr messages are sent to the editor. If users enable lsp tracing, and see theses messages, they probably think this is an error that needs attention. But it's actually not. Because it's common to open an unsupported file with lsp (for example, typed racket), and resyntax is expected to not work in this case. I prefer it does not show logs by default and only shows by given this environment variable or some explicit signals. This is probably a difference when it being a command line tool between an internal component. |
You can change the value of |
Doesn't it require all clients to change the way they starts racket-langserver? ( |
Hmm. Yes, that's an issue. Thinking about this more, the problem is that it logs these errors when analyzing files in unsupported languages, correct? I think I can just fix resyntax to handle that more gracefully in general, without logging an error. |
Yes, that's the problem. |
When `resyntax-analyze` is called directly on a non-`#lang racket` file, it currently results in an error during macro expansion being raised and logged. This causes issues when the langserver tries to analyze the current file with Resyntax, see jeapostrophe/racket-langserver#153. This PR moves Resyntax's logic for handling such files out of the file group resolution code and into the core of `resyntax-analyze`.
When `resyntax-analyze` is called directly on a non-`#lang racket` file, it currently results in an error during macro expansion being raised and logged. This causes issues when the langserver tries to analyze the current file with Resyntax, see jeapostrophe/racket-langserver#153. This PR moves Resyntax's logic for handling such files out of the file group resolution code and into the core of `resyntax-analyze`.
When `resyntax-analyze` is called directly on a non-`#lang racket` file, it currently results in an error during macro expansion being raised and logged. This causes issues when the langserver tries to analyze the current file with Resyntax, see jeapostrophe/racket-langserver#153. This PR moves Resyntax's logic for handling such files out of the file group resolution code and into the core of `resyntax-analyze`.
When `resyntax-analyze` is called directly on a non-`#lang racket` file, it currently results in an error during macro expansion being raised and logged. This causes issues when the langserver tries to analyze the current file with Resyntax, see jeapostrophe/racket-langserver#153. This PR moves Resyntax's logic for handling such files out of the file group resolution code and into the core of `resyntax-analyze`.
When `resyntax-analyze` is called directly on a non-`#lang racket` file, it currently results in an error during macro expansion being raised and logged. This causes issues when the langserver tries to analyze the current file with Resyntax, see jeapostrophe/racket-langserver#153. This PR moves Resyntax's logic for handling such files out of the file group resolution code and into the core of `resyntax-analyze`.
When `resyntax-analyze` is called directly on a non-`#lang racket` file, it currently results in an error during macro expansion being raised and logged. This causes issues when the langserver tries to analyze the current file with Resyntax, see jeapostrophe/racket-langserver#153. This PR moves Resyntax's logic for handling such files out of the file group resolution code and into the core of `resyntax-analyze`.
49b4645
to
facb320
Compare
facb320
to
9634ba6
Compare
The new macro removes redundant `disable-resyntax!`.
This is a initial implementation for #40 .
Some screenshot:
Todo:
For code, I added a new function
walk-text
which provides updated text string to services, it is called every timecheck-syntax
succeeds.