Git Product home page Git Product logo

Comments (28)

devoncarew avatar devoncarew commented on June 23, 2024 1

Cool; I can re-test and try and narrow down the issue this evening.

from dart-code.

DanTup avatar DanTup commented on June 23, 2024

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?

Search results

from dart-code.

DanTup avatar DanTup commented on June 23, 2024

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.

DanTup avatar DanTup commented on June 23, 2024

@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.

DanTup avatar DanTup commented on June 23, 2024

I went ahead and pushed 0.7. If we can repro this I can always push an update :)

from dart-code.

devoncarew avatar devoncarew commented on June 23, 2024

Hmm; I had two foo methods, and two FooBar classes in that sample project, in separate libraries :( User error -

from dart-code.

devoncarew avatar devoncarew commented on June 23, 2024

If we change the containerName in the workspace search results to be the library path, we get this:

screen shot 2016-08-12 at 7 37 33 pm

which could help users ID where the symbols are coming from.

from dart-code.

DanTup avatar DanTup commented on June 23, 2024

Seems like a good change to me! 👍

from dart-code.

DanTup avatar DanTup commented on June 23, 2024

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.

devoncarew avatar devoncarew commented on June 23, 2024

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.

DanTup avatar DanTup commented on June 23, 2024

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.

devoncarew avatar devoncarew commented on June 23, 2024

👍, makes sense

from dart-code.

DanTup avatar DanTup commented on June 23, 2024

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.

DanTup avatar DanTup commented on June 23, 2024

@devoncarew What do you think about this?

Search

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.

DanTup avatar DanTup commented on June 23, 2024

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.

DanTup avatar DanTup commented on June 23, 2024

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.

Bad

The options currently are:

  1. Let Code display the full file path
  2. 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.

devoncarew avatar devoncarew commented on June 23, 2024

Hmm, seems odd that we could display file paths w/ dots earlier, but not in this latest iteration.

from dart-code.

DanTup avatar DanTup commented on June 23, 2024

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.

DanTup avatar DanTup commented on June 23, 2024

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:

a768869

Dots

Not sure I'm comfortable with that though 😞

from dart-code.

DanTup avatar DanTup commented on June 23, 2024

@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.

devoncarew avatar devoncarew commented on June 23, 2024

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.

devoncarew avatar devoncarew commented on June 23, 2024

That issue w/ truncating everything before the last dot is really annoying :)

from dart-code.

devoncarew avatar devoncarew commented on June 23, 2024

FYI, I don't see the truncating issue in the latest VSCode Insiders build.

from dart-code.

devoncarew avatar devoncarew commented on June 23, 2024

Hmm, disregard the above.

from dart-code.

DanTup avatar DanTup commented on June 23, 2024

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.

DanTup avatar DanTup commented on June 23, 2024

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.

DanTup avatar DanTup commented on June 23, 2024

We should tweak this to not rely on hosted/pub.dartlang.org based on Brian's comments here.

from dart-code.

DanTup avatar DanTup commented on June 23, 2024

Moved last comment to #95; I think it's an edge case.

from dart-code.

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.