Open dailytabs opened 1 week ago
Annotations have a @Target
type to indicate the context in which the annotation is applicable. So if you don't see a particular annotation, it's usually because it cannot be applied in that context. Looking at the sources of these classes from a Spring Initializer project ..
@Target({ ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
@WithSecurityContext(factory = WithMockUserSecurityContextFactory.class)
public @interface WithMockUser {
So @WithMockUser
can only be applied to a type declaration, or method declaration.
@Target({ ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface WithSecurityContext {
so @WithSecurityContext
can only be applied to an annotation declaration, like in the example above. Maybe https://docs.spring.io/spring-security/site/docs/4.2.x/reference/html/test-method.html#test-method-withsecuritycontext explains it better ?
@jdneo , do you remember why this behaviour occurs ? Specifically initiating completion by typing a character correctly removes all items when a character typed doesn't match anything, vs. initiating competion with "ctrl + space" incorrectly preserving all items when a character typed doesn't match anything :
Screencast from 2024-06-24 16-11-22.webm
Is there a known upstream issue for this ?
Is there a known upstream issue for this ?
I'm not aware if there is an issue for this upstream. But I tried it in TS, which is exactly the same behavior.
https://github.com/redhat-developer/vscode-java/assets/6193897/0999cf64-8fb2-4458-8e77-2568e14322bc
At least this does not seem to be an issue with the JLS implementation.
I can confirm the behaviour is exactly the same with just typescript, which indicates this is probably something worth checking upstream.
Had already used
import org.springframework.security.test.context.support.WithMockUser;
without issue. Tried adding@WithSecurityContext
to same class.As I was typing, only 4
With*
classes showed up (there are 6), and not the one I needed.I go up to the imports, duplicate the WithMockUser line, delete "MockUser", hit Ctrl+Space, and all 6 With* classes show up! Why does it work here, but not at the class annotation?
I expect these would always show up.
I expect that after typing the full proper class name, that Ctrl+. would find the class and offer to import it.
If I type "@With", hit Ctrl+Space to bring up completion (still just shows the 4), continue with "Se", the suggestions are logical, but once I hit "c" I would expect the suggestions to go away, as there are no more logical ones. However, it stays up - no matter how much I hit Ctrl+Space to update it. (It appears like me activating it with my earlier Ctrl+Space has now prevented it from closing, even when the data is completed outdated, until you click away or hit Esc.)
Having a single minor issue preventing virtually all completion from working is already annoying enough, can't we have at least 1 thing that's nice?
Environment