Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Selector autocompletate #303

Conversation

workgroupengineering
Copy link
Contributor

Selector Autocompletate

Allow autocompletate for selector:

  • Property
  • Type
  • Namespace
  • Attached Property
  • Name
  • Property and Attached Property value (Nullable)

@workgroupengineering
Copy link
Contributor Author

if anyone has time can try it and report any problems. In the tests I'm doing at the moment I haven't found any.

@workgroupengineering
Copy link
Contributor Author

wait merge #302

@workgroupengineering workgroupengineering force-pushed the features/PropertySelector_Autocompletate branch from 32e290b to ea23d4d Compare February 27, 2023 17:31
@workgroupengineering
Copy link
Contributor Author

@amwx
Thanks for the review, I'll fix it as soon as possible.

@workgroupengineering workgroupengineering force-pushed the features/PropertySelector_Autocompletate branch from 6983321 to f9d9d2e Compare March 1, 2023 10:54
@workgroupengineering
Copy link
Contributor Author

@amwx I finished. You can download the artifact from here.

@workgroupengineering workgroupengineering marked this pull request as ready for review March 1, 2023 11:14
@amwx
Copy link
Contributor

amwx commented Mar 1, 2023

Found a few issues:

  • After :not(), :is(), etc, trying to add a name after will only suggest pseudoclasses (same thing if you type '/` to start /template/ without a space, which is allowed by the compiler). Normal pseudoclasses work fine, (e.g., Button:pointerover# will present names)

image

  • Names aren't auto selected in the intellisense popup, requiring you to manually select them:
    image

What I think is happening here, (line 374 in CompletionEngine), you're calculating the current start for the autocompletion as textToCursor.Length - delta where the delta includes the #, but all the completion sets are built without the # on the DisplayText member, which is what VS uses to match typed text. Adjusting the start position to start after the # should fix this

  • Trying to add names or pseudoclasses after a property doesn't give autocomplete suggestions (hitting space will resume normally):
    Button[Tag=Value]: or Button[Tag=Value]#.

  • I think pseudoclasses should be suggested in cases where its appropriate for types (the operators like :is(), :not() are the only things suggested after : if there's a space). Otherwise something like Button :pointerover won't suggest the pseudoclasses (there's no spec that says pseudoclasses, etc have to be right up against the type so spaces are allowed). This also fails in ControlTheme child styles:

image

Edit: Oh, also I got a random IndexOutOfRangeException inside SelectorParser. Of course I can't repro it now, but it occurred while backspacing trying to fix a typo

@workgroupengineering workgroupengineering marked this pull request as draft March 2, 2023 17:00
@workgroupengineering workgroupengineering force-pushed the features/PropertySelector_Autocompletate branch from 4979a46 to fd7926d Compare March 6, 2023 17:59
@workgroupengineering
Copy link
Contributor Author

Hi @amwx here there is a new build.
Can you test?
There is lot of debug code, i will remove after.

@workgroupengineering workgroupengineering force-pushed the features/PropertySelector_Autocompletate branch from d0a5cdd to b779b25 Compare March 11, 2023 10:05
@amwx
Copy link
Contributor

amwx commented Mar 12, 2023

From above:
1- typing something like Button:not(:disabled), closing the parenthesis for :not() will enter an infinite loop & freeze VS. I didn't have the debugger attached so I don't know where

2- Still not fixed (names aren't auto selected)

3- Still not fixed (no suggestions are offered after a property unless you hit space)

4- fixed

@workgroupengineering workgroupengineering force-pushed the features/PropertySelector_Autocompletate branch from b779b25 to 3e8684d Compare March 13, 2023 10:33
@workgroupengineering
Copy link
Contributor Author

Thanks again for taking the time to test.

Here you can find the build with fixes.

I added parts name detection.
If you type # after templete it shows you the list of parts, or after the template enter the type and pressing # it displays only the parts of the corresponding type.

@amwx
Copy link
Contributor

amwx commented Mar 17, 2023

Latest changes look good to me. Adding support for TemplatePartAttribute is nice feature

Item 2 still isn't fixed, but I'll handle that in the future so don't worry about it. Its related to differences between what we send to our completion engine and what VS uses internally and I'm seeing that affect other places too, and in #302 I hinted I wanted to rework that aspect anyway, but that's a bigger project

@workgroupengineering workgroupengineering force-pushed the features/PropertySelector_Autocompletate branch from 3e8684d to decbcd5 Compare March 20, 2023 14:04
@workgroupengineering workgroupengineering marked this pull request as ready for review March 20, 2023 14:05
Copy link
Contributor

@amwx amwx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly just typos in "public" (or relating to public) members. I've only tagged their declaration, the usages will need to be updated too - but VS's renaming refactor should make that easy

@grokys
Copy link
Member

grokys commented Mar 29, 2023

Sorry for the delay in approving/merging these PRs, we've not had much time recently to review the VS extension PRs. Will try to resolve that shortly.

@workgroupengineering workgroupengineering force-pushed the features/PropertySelector_Autocompletate branch from e4d658f to 7817aad Compare April 18, 2023 08:57
@maxkatz6 maxkatz6 merged commit 20556a5 into AvaloniaUI:master Jun 9, 2023
@workgroupengineering workgroupengineering deleted the features/PropertySelector_Autocompletate branch June 9, 2023 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants