guillermooo / dart-sublime-bundle

Sublime Text 3 Dart Package
BSD 3-Clause "New" or "Revised" License
264 stars 42 forks source link

No support for stand-alone .dart files (not in a package dir) #525

Closed sethladd closed 9 years ago

sethladd commented 9 years ago

Now running plugin 1.4.1 with Dart 1.10.0.

I have a single test.dart file:

main(List<String> args) async {
    assert(true);
    print('hi');
    await foo();
    try {
        // stuff
    } catch {
        notHere();
    }
}

foo() {}

which lives on my desktop.

Expected: a warning that notHere() doesn't exist.

Actual: no warning.

Screenshot:

screen shot 2015-05-29 at 8 57 16 am

(see "unknown include #regex.dart" in console... related?)

sethladd commented 9 years ago

Here's what webstorm shows:

screen shot 2015-05-29 at 9 02 17 am

guillermooo commented 9 years ago

It may be that files under "test" are ignored altogether by the DAS.

guillermooo commented 9 years ago

I mean, in the Dart plugin.

sethladd commented 9 years ago

hm, the file 'test.dart' isn't under test. It's in the Desktop directory.

I don't think the DAS is doing any ignoring here, because webstorm is showing errors, and webstorm uses the DAS.

guillermooo commented 9 years ago

Yes, it must be the plugin's fault, but I was thinking maybe the plugin makes the DAS ignore files under "test" in a pub package. Not sure at all, though. Need to look into it.

Is your file in a pub package folder structure?

sethladd commented 9 years ago

My test.dart file is literally inside of the Desktop directory. It's the only file in the Desktop directory.

screen shot 2015-05-29 at 9 13 18 am

guillermooo commented 9 years ago

Thanks. If you get no errors shown at all for broken code, then probably a single-file scenario like this one is unsupported atm by the plugin. I think it always checks for a pubspec.yaml and ignores files if it doesn't find one.

sethladd commented 9 years ago

Thanks for checking it out. The sublime plugin should work for a single stand-alone file, if that file is a library (not a part).

sethladd commented 9 years ago

Hi,

We just ran into this scenario with an internal user. We wanted to open Sublime, create a new Dart file, and analyze it. We didn't have a pubspec.yaml file, so we didn't see errors or warnings.

What do you need from us to make this scenario work? :)

Thanks!!

guillermooo commented 9 years ago

I seem to remember in the very beginning we decided against it. But can't really say for sure any more.

The plugin should be modified to allow this. I don't think it will be too much work, but I havent' gotten around to it yet.

sethladd commented 9 years ago

Perhaps the issue is... how do we know if we're in a Dart project?

If I have an empty directory, with a single Dart file (which is an entry point or a library file (not a part file)), I would want to treat that as a "Dart project".

But, this would require us to assume a bunch more about the environment. So I'll start a thread on analyzer-discuss@ to see what other people think.

sethladd commented 9 years ago

Some logic and ideas for how to detect a Dart project. https://groups.google.com/a/dartlang.org/forum/#!topic/analyzer-discuss/HVLgtVXyB18

sethladd commented 9 years ago

In the meantime, I updated https://github.com/guillermooo/dart-sublime-bundle/wiki/Installation-and-Basic-Configuration with explicit instructions to add a pubspec.yaml file. Hope that helps!

guillermooo commented 9 years ago

Just tried with a sindle main.dart file inside an otherwise empty folder and everything seems to be working (using repo's head, not latest release). I don't remember changing anything related to this scenario.

dart-standalone

sethladd commented 9 years ago

Thanks! On Sat, Jun 13, 2015 at 17:51 Guillermo López-Anglada < notifications@github.com> wrote:

Closed #525 https://github.com/guillermooo/dart-sublime-bundle/issues/525 via 9f565bf https://github.com/guillermooo/dart-sublime-bundle/commit/9f565bf1366e760c8d8a2ccf5738f0f1745136bc .

— Reply to this email directly or view it on GitHub https://github.com/guillermooo/dart-sublime-bundle/issues/525#event-330220833 .