Open srawlins opened 1 year ago
This is really exciting Sam! If you could use any help trying out prototypes I'd volunteer some time!
@srawlins Would you mind creating go links for your design docs on https://github.com/flutter/website/blob/main/firebase.json? Then you can add them to the top of your docs making them a bit easier to share and discuss publicly.
Community members often follow new go links on flutter.dev as well.
I'm not good about referencing this issue in my CLs, as all the work is sort of just preparation and grooming the code. So I'll write down some of the under-the-hood changes I've been making. They are largely to support two areas: lint rule APIs and correction producer (mostly quick fix) APIs:
lint rule APIs:
LinterContext
:
resolveNameInScope
(replaced with resolveNameInScope2
) (334082) and inTestDir
(replaced with extension getter) (365300).analysisOptions
, declaredVariables
, canBeConst
, canBeConstConstructor
, inTestDir
(replaced with extension getters) (365521), isEnabled
(368524).currentUnit
to definingUnit
(368524).isInLibDir
, libraryElement
(368524).LinterContextImpl
: remove strictCasts
field (344200).LintDriver
and DartLinter
as "only used for linter tools and tests" (334645).CamelCaseString
and SourceLinter
(334645).DartLinter.lintPubspecSource
as @visibleForTesting
(334645).LinterOptions
: mark enabledLints
and analysisOptions
final, and remove
resourceProvider
(334645).lintFiles
, classes ErrorWatchingSink
and FileGlobFilter
to linter's tool/
directory (334645).NodeLintRegistry
: remove deprecated addOnClause
(366404).NodeLintRuleWithContext
(366504), Linter
, getVisitor
, linterVersion
(366840), LinterAnalysis.linterUnit
, LinterContextUnit2
(366405).LibraryAnalyzer._computeLints
(366222).LinterContextUnit.errorReporter
(366405).LinterVisitor.afterLibrary
(368524).DartLinter
out of analyzer package (369562).Group.builtin
and Group.custom
as visible-for-testing (369562).Group
(369782).lintCode
or lintCodes
(372183).messages.yaml
file (382780).diagnosticMatcher
, offset
, length
, and messageContains
, ExpectedError field codes
, ExpectedLint field lintName
, LintRuleTest field collectionIncludedPaths
, _ContextResolutionTest field sdkRoot
(386580).writeTestPackageAnalysisOptionsFile
and writeTestPackagePubspecYamlFile
functions (386580)._LintConfig
like addAsListOrString
both static and private (388960).RuleConfig
's fields final and pass them all as parameters into the constructor (388960).LintFilter
and move it to the linter package (389403).correction producer APIs:
_AbstractCorrectionProducer
:
CorrectionProducer
:
getLinterContext
(364964).assistArguments
, fixArguments
, multiFixArguments
to be List<String>?
(364420).errorMessage
(367363).configure
abstract (367363).coveringNode
(367761).sealed
(367761).configure
(368760).context
as a named parameter to the constructor (368760).MultiCorrectionProducer
: remove typeProvider
, typeSystem
(367363).MultiCorrectionProducer
: add context
(368760).ResolvedCorrectionProducer
: remove coreTypeBool
(367363).CorrectionUtils
:
patternOfBoolCondition
(347781).findPossibleLocalVariableConflicts
(358641).getTypeSource
, targetClassElement
, and
targetExecutableElement
(358663).prepareNewStatementLocation
(360080).prepareNewFieldLocation
and
prepareNewGetterLocation
to DartFileEditBuilder, as
addFieldInsertion
and addGetterInsertion
(360302).addMethodInsert
and addCaseClauseAtEndInsert
to DartEditBuilder (360980).getDefaultValueCode
(361132).DartFileEditBuilder
(362063).prepareNewClassMemberLocation
(362303).addLibraryImports
(363402).indentLeft
, indentRight
(363404).selectionIncludesNonWhitespaceOutsideNode
(363501).DartFileEditBuilder
:
addConstructorInsertion
, a replacement for both CorrectionUtils.prepareEnumNewConstructorLocation
and
CorrectionUtils.prepareNewConstructorLocation
(361624).add___Insertion
APIs to insert___
(362001).insertIntoUnitMember
(362183).writeOverride
called setSelection
which controls whether selection should be set (362183).CorrectionProducerContext
:
AssistProcessor.generators
, multiGenerators
, .assistContext
, .assists
(364420).FixProcessor
:
hasFix
top-level function(345347), classes TransformOverride
(347641), ExpressionCasePattern
(347781), CorrectionUtils_InsertDesc
(347780), CancelCorrectionException
(348083), Baseprocessor
(364360).DartFixContext
and DartFixContextImpl
and change constructor to use all named parameters (358382).Flutter
. Most methods are refactored as extension methods. Some unused ones are deleted.
Some are inlined into their call sites (362300).TransformOverrideSet
(340280).BulkFixProcessor
:
Plugin server API:
Analysis Options
parseConfig
function to take a non-nullable parameter (389022).options
field (389023) and improve doc comments (390266).LinterOptions.analysisOptions
(390563).DriverOptions.strongMode
(390666).applyOptions
extension method into a builder class (390660).I'll update this comment as I make more preparatory changes.
:wave: Is this likely to land within 6months or so?
This seems to be actively worked on ; which is cool! But it also makes me re-evaluate how much effort I should spend working on custom_lint. If this takes a while to land >= 6month, I'll likely keep working on custom_lint in the meantime (such as supporting newer analyzer versions whenever they land). But if it's <=6 months, I'd consider stopping support for custom_lint, to use that time on things more valuable in the long term.
Yes, actively working on it, and hope to send out something in the next month or so. Definitely < 6 months 😁 stay tuned.
Tasks needed to deliver a new analyzer plugin system:
Tech preview
General availability
Product excellence
dart fix
.