Skip to content

Track integration branch: schema-aware editor work#1

Closed
StarProxima wants to merge 9 commits intomainfrom
integration
Closed

Track integration branch: schema-aware editor work#1
StarProxima wants to merge 9 commits intomainfrom
integration

Conversation

@StarProxima
Copy link
Copy Markdown
Owner

Tracking PR keeping this fork's `integration` branch visible against upstream `main`.

Each feature intended for upstream lives on its own `feat/*` branch merged into `integration`; the tracking PR aggregates the current state.

Currently on `integration`

  • feat/suggestion-provider – adds SuggestionProvider API with Suggestion value type, Autocompleter-backed default, optional CodeController injection, PopupController.showItems.

Downstream design reference

See schema-aware Lab editor spec for the full picture - this fork is the editor half of the work.

Supersedes

…tation

SuggestionProvider decouples the source of completion candidates from
the CodeController. DefaultSuggestionProvider wraps the existing
Autocompleter so the out-of-the-box behavior stays identical: language
keywords, buffer words, and words from setCustomWords are exposed as
text-typed Suggestion items. Callers can now inject their own
implementation (e.g. schema-driven or LSP-backed) without subclassing
or forking Autocompleter.
- `showItems(List<Suggestion>)` is the new primary entry point; the legacy
  `show(List<String>)` now wraps each string in a text-typed Suggestion
  and delegates to `showItems`.
- `items` exposes the rich suggestions; `suggestions` becomes a view
  returning just the labels for backward compatibility with popup
  widgets that were built against the original `List<String>` shape.
- `getSelectedItem()` returns the full Suggestion for callers that need
  `insertText`/`detail`/`documentation`; `getSelectedWord()` still
  returns the label.
- `scrollByArrow` guards against an empty items list.
Adds an optional `suggestionProvider` constructor parameter and a
matching getter/setter. When no provider is supplied the controller
falls back to `DefaultSuggestionProvider(autocompleter)`, preserving
the pre-existing completion behavior.

`generateSuggestions` now builds a `SuggestionRequest` from the current
editor state (text, caret offset, prefix, language) and delegates to
the provider. Results flow through `PopupController.showItems`, so
rich metadata (type, priority, detail, documentation) is retained for
UI layers that want to render it.

No changes in behavior for existing callers.
- Re-export Suggestion, SuggestionType, SuggestionRequest,
  SuggestionProvider and DefaultSuggestionProvider from
  package:flutter_code_editor/flutter_code_editor.dart.
- Small tidy-ups in the new files (import pruning, redundant default
  argument removal, dartdoc link imports).
- Drop a dartdoc reference that required importing CodeController
  just for the link.
- Turn sync `_FixedProvider` tests into plain sync tests (no unused
  async modifier).
- Extra tests:
  - `DefaultSuggestionProvider` respects `Autocompleter.blacklist`.
  - `PopupController.showItems` called twice resets the selection and
    replaces the list.
  - Assigning the same `SuggestionProvider` instance is a no-op
    (no spurious listener notifications).
@StarProxima
Copy link
Copy Markdown
Owner Author

Откатываем downstream изменения - форк редактора не в приоритете. Ветки остаются на случай возврата к идее.

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.

1 participant