Coder Social home page Coder Social logo

Comments (7)

bwilkerson avatar bwilkerson commented on July 2, 2024 2

While doing that, I encountered an issue, so I thought to create an issue and debug.

And we appreciate that, thanks!

I didn't want to create that linter using a non-dart tool since ARB files are used for localization by flutter apps ...

Linting ARB files might very well be a compelling enough case. Thanks!

@mossmana @anderdobo for visibility

from sdk.

bwilkerson avatar bwilkerson commented on July 2, 2024

@srawlins @DanTup

from sdk.

DanTup avatar DanTup commented on July 2, 2024

The dart.additionalAnalyzerFileExtensions setting in the VS Code extension was for the legacy analysis server integration because we needed to know which extensions to interact with the server for.

In LSP, the server can declare these file types itself dynamically, so the setting is unnecessary.

In the code linked above, it uses the getter fullySupportedTypes, which types that plugins declare they are interested in:

List<TextDocumentFilterWithScheme> get fullySupportedTypes {
return {
...dartFiles,
...pluginTypes,
}.toList();

An example of how a plugin declares this interest is here:

https://github.com/dart-lang/sdk/blob/main/pkg/analyzer_plugin/doc/tutorial/getting_started.md#:~:text=String%3E%20get-,fileGlobsToAnalyze,-%3D%3E%20%3CString

It's not clear to me if the plugin here knows what types the lint is trying to use, but I do think it would be better to handle this somehow via the plugin rather than use this setting because that setting requires specific client configuration and this seems like something the server/plugin should be able to just make work automatically.

from sdk.

ishchhabra avatar ishchhabra commented on July 2, 2024

I wasn't aware that dart.additionalAnalyzerFileExtensions setting is only for legacy analysis server integration. Perhaps a documentation update here and in VSCode at some point would make sense?

For the bug, I looked into it more. It looks like there was an update needed in custom_lint and it wasn't a bug in the sdk. However, even after the feature registration is done with the extension included, I still did not see the files getting reanalyzed. I'm not sure if this is correct, but I believe at

if (file_paths.isDart(resourceProvider.pathContext, path)) {
_priorityResults.clear();
_resolvedLibraryCache.clear();
_pendingFileChanges.add(
_FileChange(path, _FileChangeKind.change),
);
_scheduler.notify();
}
since the file is not a dart file, it does not get added to the list of _pendingFileChanges, resulting in affected at
var affected = await analysisContext.applyPendingFileChanges();
await handleAffectedFiles(
analysisContext: analysisContext,
paths: affected,
);
});
to not include the file without the dart extension.

from sdk.

DanTup avatar DanTup commented on July 2, 2024

Perhaps a documentation update here and in VSCode at some point would make sense?

Yes, this should be made clearer - I've opened Dart-Code/Dart-Code#5133 to update the description against the setting (which shows both in VS Code and on the site).

However, even after the feature registration is done with the extension included, I still did not see the files getting reanalyzed. I'm not sure if this is correct, but

I'm not too familiar with this code - @scheglov or @srawlins may be best placed to comment. I think the question is whether ServerPlugin.handleAffectedFiles should be called with/passed non-Dart files that were passed to contentChanged. Currently it gets just the result from analysisContext.applyPendingFileChanges() which seems to only include Dart files.

(I've updated the title to something I think is more accurate for the current issue)

from sdk.

bwilkerson avatar bwilkerson commented on July 2, 2024

IIRC, this support was added to support the Angular Dart plugin. Those products were discontinued a long time ago and a lot of code has changed since then. I suspect that support for this feature has bit-rotted in the interval.

We'd probably need a fairly compelling case to justify the effort required to make it work again. Can you tell us why you want/need support for this?

from sdk.

ishchhabra avatar ishchhabra commented on July 2, 2024

IIRC, this support was added to support the Angular Dart plugin. Those products were discontinued a long time ago and a lot of code has changed since then. I suspect that support for this feature has bit-rotted in the interval.

We'd probably need a fairly compelling case to justify the effort required to make it work again. Can you tell us why you want/need support for this?

I was trying to build a linter that analyzes non dart files. I didn't want to create that linter using a non-dart tool since ARB files are used for localization by flutter apps, and so it made sense to use a tool already available there - dart analyzer. At the time of creating that, it was mostly just a prototype that I built for learning purposes. While doing that, I encountered an issue, so I thought to create an issue and debug.

from sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.