Allow libraries without a '.dart' ending (#1900)

* Fix library files without a .dart ending bug

* Explain more in comment
diff --git a/lib/src/model.dart b/lib/src/model.dart
index 9868133..44c7199 100644
--- a/lib/src/model.dart
+++ b/lib/src/model.dart
@@ -6516,7 +6516,9 @@
       }
     }
     var sourceKind = await driver.getSourceKind(filePath);
-    if (sourceKind == SourceKind.LIBRARY) {
+    // Allow dart source files with inappropriate suffixes (#1897).  Those
+    // do not show up as SourceKind.LIBRARY.
+    if (sourceKind != SourceKind.PART) {
       // Loading libraryElements from part files works, but is painfully slow
       // and creates many duplicates.
       return await driver.currentSession.getResolvedLibrary(source.fullName);
diff --git a/test/model_test.dart b/test/model_test.dart
index da2befc..c7452b9 100644
--- a/test/model_test.dart
+++ b/test/model_test.dart
@@ -675,6 +675,10 @@
       expect(anonLib.isDeprecated, isFalse);
     });
 
+    test('can be reexported even if the file suffix is not .dart', () {
+      expect(fakeLibrary.allClasses.map((c) => c.name), contains('MyClassFromADartFile'));
+    });
+
     test('that is deprecated has a deprecated css class in linkedName', () {
       expect(isDeprecated.linkedName, contains('class="deprecated"'));
     });
diff --git a/testing/test_package/lib/fake.dart b/testing/test_package/lib/fake.dart
index 03b0a69..4af1f2a 100644
--- a/testing/test_package/lib/fake.dart
+++ b/testing/test_package/lib/fake.dart
@@ -58,6 +58,7 @@
 import 'mylibpub.dart' as renamedLib;
 import 'mylibpub.dart' as renamedLib2;
 import 'two_exports.dart' show BaseClass;
+export 'src/notadotdartfile';
 
 // ignore: uri_does_not_exist
 export 'package:test_package_imported/categoryExporting.dart'
diff --git a/testing/test_package/lib/src/notadotdartfile b/testing/test_package/lib/src/notadotdartfile
new file mode 100644
index 0000000..7f9a1a3
--- /dev/null
+++ b/testing/test_package/lib/src/notadotdartfile
@@ -0,0 +1,4 @@
+/// Test importing with an invalid dart file extension. (#1897)
+library test_package.notadotdartfile;
+
+class MyClassFromADartFile {}
\ No newline at end of file