Comments (28)
Cool; I can re-test and try and narrow down the issue this evening.
from dart-code.
Strange; I was sure I tested this and it didn't happen. I just tried now searching for a top-level class but still don't see it. Could you confirm what your Dart file looks like?
from dart-code.
I wonder if something weird is happening with the results, maybe #63 is related. Are you able to capture the service output when this happens? (this might be tricky until there's an option to log to file)
from dart-code.
@devoncarew I'm gonna do a little more testing and then do a build for 0.7. I've pushed some minor things back to 0.8 as I'd like to release the other stuff; this the only remaining case. If you can repro this or think it's potentially an issue, if you let me know before I build, I'll revert that change until 0.8.
from dart-code.
I went ahead and pushed 0.7. If we can repro this I can always push an update :)
from dart-code.
Hmm; I had two foo
methods, and two FooBar
classes in that sample project, in separate libraries :( User error -
from dart-code.
If we change the containerName in the workspace search results to be the library path, we get this:
which could help users ID where the symbols are coming from.
from dart-code.
Seems like a good change to me! 👍
from dart-code.
That said; are we then losing the container name; eg:
/// test.dart
class Foo {
string name;
}
class Bar {
string name;
}
Would these both appear as name (test.dart)
? It's less of an issue in the document one because of the highlighting, but maybe worth doing something here. We could show Bar.name
but I guess with nested classes etc., the issue might continue.
I think the service returns a full path of parents; maybe containerName
could be all parents up the tree?
from dart-code.
We may or may not have enough info to do this, but I think:
- always showing the file path for
containerName
would be consistent - for top-level symbols, we could just display the symbol name
- for class members, we could display
Foo.bar
from dart-code.
Seems reasonable, though there's also nested functions and classes; though I think always combining them (assuming we have the info) would work (eg. Foo.Bar.function.subFunction
)?
from dart-code.
👍, makes sense
from dart-code.
Apparently Dart doesn't have nested classes (https://github.com/dart-lang/sdk/issues/3755)! I'll try and sort the other stuff though.
from dart-code.
@devoncarew What do you think about this?
private convertResult(result: as.SearchResult): SymbolInformation {
let displayName = result.path
.slice(0, -2) // Drop last two items (filename + library).
.reverse() // Reverse so that parents come at start.
.map(p => p.name + (p.parameters || "")) // Extract names and add params onto the end.
.join("."); // Combine into a dotted string.
return {
name: displayName,
kind: getSymbolKindForElementKind(result.path[0].kind),
location: {
uri: Uri.file(result.location.file),
range: toRange(result.location)
},
containerName: null // Code displays filename if we don't set this.
};
}
from dart-code.
Ugh... This looked wonky for imported packages (showed the full pub path as the location). I made a change so that it always displays the name of the last item in the paths
array (this means it'll be library name if there is one, else the filename) which sounded logically sound, but it seems that Code strips everything before the last dot (so it just says dart
) even though when you pass null
it displays the filename (intact)! :(
from dart-code.
Raised microsoft/vscode#10504 about this behaviour. I'd like to go with using the name of the last item, but this Code behaviour makes it useless.
The options currently are:
- Let Code display the full file path
- Provide our own string, but if it contains dots we only get the stuff after the last dot
Neither of these is good; so I'm gonna park this pending a response.
from dart-code.
Hmm, seems odd that we could display file paths w/ dots earlier, but not in this latest iteration.
from dart-code.
I believe all the paths we've ever displayed were by passing null
as containerName
and letting Code do them (which are relative if it's in the project and absolute if not). Though if you think this might not be the case, I would be chuffed if I've just done something wrong!
from dart-code.
It's insanely dirty (and may fail based on the font), but replacing the dots with something that looks a bit like a dot kind works:
Not sure I'm comfortable with that though 😞
from dart-code.
@devoncarew I wasn't happy with this, so I've gone back and forth making lots of changes... I settled on trying to make it as similar to the document symbol list as possible (show name and parent, rather than class.member etc.). I had to do some gymnastics to make filenames display nicely (discussion here).
If you get a min, can you take a look (it's in master) and see if it seems to behave and display reasonably?
from dart-code.
I'll take a look; from a brief glance, I see the long paths in the display. It might be nice to display package refs as package:foo/foo.dart
? And - going forward - we can't rely on having a packages/
top level dir in each project. Dart is moving away from the use of symlinks. In any case, happy to take a look in a bit.
from dart-code.
That issue w/ truncating everything before the last dot is really annoying :)
from dart-code.
FYI, I don't see the truncating issue in the latest VSCode Insiders build.
from dart-code.
Hmm, disregard the above.
from dart-code.
from a brief glance, I see the long paths in the display
Hmm, could you give an example? Or maybe breakpoint/log in the replacePaths
function and see why it isn't matching? (it does only work for hosted/pub.dartlang.org
currently, so if your packages aren't in a folder like that, could be why?)
It might be nice to display package refs as package:foo/foo.dart?
Yeah, I really wanted to do that but thought I didn't have the required info; but now I'm wondering if what I've already done handles that... Maybe I'll take a stab at this tomorrow evening (though you're free to have a stab if you wish).
going forward - we can't rely on having a packages/ top level dir in each project. Dart is moving away from the use of symlinks
I figured with the symlinks gone, /packages
would end up being real copies (like NuGet).. is that not the case? Will pubcache be the only actual location? (How will this work with Dartium?)
That issue w/ truncating everything before the last dot is really annoying :)
Tell me about it! :D I spent so long today just going back and forth trying to make this work.. But, where were you seeing it - the code I pushed shouldn't show that anymore (or were you tweaking the code?)
FYI, I don't see the truncating issue in the latest VSCode Insiders build.
Interesting! Maybe I should install it. I didn't realise it worked side-by-side, so probably makes sense. I don't mind shipping known issues like the filenames being wonky if it'll fix itself in the next Code update!
Oh, just saw your comment on the MS case; does still happen :(
from dart-code.
The crazy behaviour with stripping stuff has gone, so should indeed be fixed in Insiders (that's nightly?). We should just assume veryone will soon update, so if it shows something weird in the meantime, so be it!
from dart-code.
We should tweak this to not rely on hosted/pub.dartlang.org
based on Brian's comments here.
from dart-code.
Moved last comment to #95; I think it's an edge case.
from dart-code.
Related Issues (20)
- add sdk to path on windows not working cause the path is quoted HOT 6
- Flutter: Launch emulator - invalid entries HOT 10
- Multiple `Dart Devtools` Running HOT 4
- avdmanager is missing from the Android SDK HOT 3
- Missing Hot Reload button in debug toolbar HOT 6
- Go to Augmentation CodeLen opens a new editor in the current group instead of jumping to an existing editor in another group HOT 5
- Consider implementing VSCode's new Test Coverage API HOT 1
- option to customize diagnostic severity HOT 7
- Intellisense seems pretty broken with the new VSCode (1.88) HOT 12
- Notify users with large numbers of TODO diagnostics that they can turn them off HOT 1
- RainbowBrackets bug with `Map`/`Set` inside string interpolation. HOT 2
- Open online interactive sample leads to 404 for non-classes (mixins, extension types) HOT 1
- Add support for "Go to Augmented" and "Go to Augmentation" commands + CodeLenses HOT 11
- "Go to Augmented" does not show up for augmentations of augmentations HOT 3
- "Find all references" on invocation of a getter/setter only returns other references as a get (or set) HOT 7
- "Move to File" refactor says it will overwrite existing files even though it adds to them
- Support monorepos
- Color picker should const if it is originally const HOT 3
- Super long hot reload, multiple notifications shown, never finishes HOT 5
- flutter doctor is ok, but vscode is no device, Android Studio can also detected. HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dart-code.