Skip to content

Improve Resyntax integration#196

Merged
dannypsnl merged 15 commits intojeapostrophe:masterfrom
6cdh:resyntax2
Mar 16, 2026
Merged

Improve Resyntax integration#196
dannypsnl merged 15 commits intojeapostrophe:masterfrom
6cdh:resyntax2

Conversation

@6cdh
Copy link
Collaborator

@6cdh 6cdh commented Mar 4, 2026

This PR

  • Remove method walk-text, because walk-text is only used by resyntax integration, we will no need it due to the following changes
  • Make resyntax integration to be a standalone pure module in doclib, and decouple resyntax from diagnostic service
  • Add a doc-resyntax function in doc.rkt that calls resyntax and return a list of code actions
  • Remove doc-walk-text function in doc.rkt
  • In lsp layer, runs resyntax using places.
  • Update scribble docs

The internal expand is locked, resyntax's expand interfere documents' expand. By move resyntax into a place that is another Racket instance, documents' expand work better.

This PR can also mitigate performance issue in #191

EDIT: The current design for running resyntax with racket/place is, when a resyntax task is created, a place worker is spawned to execute it. If a task is cancelled (due to a document close or document change event), the place worker cancels the task and becomes idle. Subsequent tasks then reuse the same place worker. Therefore, at most one place exists at any given time.

@6cdh 6cdh changed the title Remove doc-walk-text call in doc-expand! Improve resyntax integration Mar 4, 2026
@6cdh 6cdh changed the title Improve resyntax integration Improve Resyntax integration Mar 4, 2026
@6cdh
Copy link
Collaborator Author

6cdh commented Mar 14, 2026

I was thinking to get rid of the at most 1 place worker limit, and use a place worker pool. Then I realized this is almost the same as the existing scheduler, the difference is, place worker pool executes tasks with place, and current scheduler executes tasks with threads. I'm thinking if I can generalize them, and make a more general implementation of scheduler, or reuse the scheduler.

EDIT:

I've decided to abandon the worker pool implementation. It's overly complex, and offers limited benefit when running multiple slow resyntax tasks in parallel, and consuming unnecessary resources. Our resyntax integration should be used for small files and fast feedback. If a file is too large or complex for resyntax to run fast, the command line is recommended.

For reusing the scheduler and place worker pool design, it's not feasible. Because the place task runner requires serializable inputs and serializable outputs. The output of resyntax task, Resyntax-Result struct can be converted to jsexpr representation. check-syntax runs in scheduler returns a complex trace object that is not currently serializable.

@6cdh 6cdh marked this pull request as ready for review March 15, 2026 03:04
@6cdh 6cdh requested a review from dannypsnl March 15, 2026 03:05
@dannypsnl dannypsnl merged commit d5b7524 into jeapostrophe:master Mar 16, 2026
10 checks passed
@6cdh 6cdh deleted the resyntax2 branch March 16, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants