Repository: gleam-lang/gleam (rust)

Issue:
HTML documentation: "opaque" indicator is mispositioned when there are source links
![image](https://github.com/gleam-lang/gleam/assets/6134406/9a0ec2da-3a12-410e-85b7-13a8dfbb75ed)

This does not look good

Pull request:
right-align and restyle opaque tag
small and simple PR! this just right aligns the `opaque` tag for generated documentation. I've also removed the border and darkened the background to keep it standing out but make it a bit less intense, since it is not something that needs to be so in-your-face. This fixes #3340 

![Pasted image](https://github.com/user-attachments/assets/2b89c282-e6b4-43a5-b766-fef139f2c103)


Patch:
diff --git a/compiler-core/src/ast/visit.rs b/compiler-core/src/ast/visit.rs
index b2c7ea9a2..ba6485d71 100644
--- a/compiler-core/src/ast/visit.rs
+++ b/compiler-core/src/ast/visit.rs
@@ -915,6 +915,11 @@ where
     for pattern in clause.pattern.iter() {
         v.visit_typed_pattern(pattern);
     }
+    for patterns in clause.alternative_patterns.iter() {
+        for pattern in patterns {
+            v.visit_typed_pattern(pattern);
+        }
+    }
     v.visit_typed_expr(&clause.then);
 }
 
diff --git a/compiler-core/src/language_server/code_action.rs b/compiler-core/src/language_server/code_action.rs
index a1c25f6fa..392850054 100644
--- a/compiler-core/src/language_server/code_action.rs
+++ b/compiler-core/src/language_server/code_action.rs
@@ -3,7 +3,10 @@ use std::{iter, sync::Arc};
 use crate::{
     ast::{
         self,
-        visit::{visit_typed_expr_call, Visit as _},
+        visit::{
+            visit_typed_call_arg, visit_typed_expr_call, visit_typed_pattern_call_arg,
+            visit_typed_record_update_arg, Visit as _,
+        },
         AssignName, AssignmentKind, CallArg, ImplicitCallArgOrigin, Pattern, SrcSpan, TypedExpr,
         TypedPattern, TypedRecordUpdateArg,
     },
@@ -481,6 +484,8 @@ impl<'ast> ast::visit::Visit<'ast> for LabelShorthandSyntax<'_> {
             }
             _ => (),
         }
+
+        visit_typed_call_arg(self, arg)
     }
 
     fn visit_typed_pattern_call_arg(&mut self, arg: &'ast CallArg<TypedPattern>) {
@@ -497,6 +502,8 @@ impl<'ast> ast::visit::Visit<'ast> for LabelShorthandSyntax<'_> {
             }
             _ => (),
         }
+
+        visit_typed_pattern_call_arg(self, arg)
     }
 
     fn visit_typed_record_update_arg(&mut self, arg: &'ast TypedRecordUpdateArg) {
@@ -513,6 +520,8 @@ impl<'ast> ast::visit::Visit<'ast> for LabelShorthandSyntax<'_> {
             }
             _ => (),
         }
+
+        visit_typed_record_update_arg(self, arg)
     }
 }
 
diff --git a/compiler-core/templates/docs-css/index.css b/compiler-core/templates/docs-css/index.css
index 361c275ac..b123ff196 100644
--- a/compiler-core/templates/docs-css/index.css
+++ b/compiler-core/templates/docs-css/index.css
@@ -532,16 +532,13 @@ body.drawer-open .label-closed {
 }
 
 .visibility-tag {
-  background-color: var(--bg-shade-2);
+  background-color: var(--bg-shade-3);
   color: var(--text);
-  padding: 2px 6px;
+  padding: 0px 6px 4px;
   border-radius: 4px;
-  border-style: solid;
-  border-width: 1px;
-  border-color: var(--fg-shade-2);
   font-size: 0.9em;
-  margin-left: 8px;
-  float: right;
+  margin-left: auto;
+  line-height: normal;
 }
 
 /* Custom type constructors */


Test patch:
diff --git a/compiler-core/src/language_server/tests/action.rs b/compiler-core/src/language_server/tests/action.rs
index 91a4f5f8c..13714bae0 100644
--- a/compiler-core/src/language_server/tests/action.rs
+++ b/compiler-core/src/language_server/tests/action.rs
@@ -1029,6 +1029,73 @@ pub fn wibble(arg1 arg1, arg2 arg2) { Nil }
     );
 }
 
+#[test]
+fn use_label_shorthand_works_for_nested_calls() {
+    assert_code_action!(
+        USE_LABEL_SHORTHAND_SYNTAX,
+        r#"
+pub fn wibble(arg arg: Int) -> Int { arg }
+
+pub fn main() {
+  let arg = 1
+  wibble(wibble(arg: arg))
+}
+ "#,
+        find_position_of("main").select_until(find_position_of("}").nth_occurrence(2)),
+    );
+}
+
+#[test]
+fn use_label_shorthand_works_for_nested_record_updates() {
+    assert_code_action!(
+        USE_LABEL_SHORTHAND_SYNTAX,
+        r#"
+pub type Wibble { Wibble(arg: Int, arg2: Wobble) }
+pub type Wobble { Wobble(arg: Int, arg2: String) }
+
+pub fn main() {
+  let arg = 1
+  let arg2 = "a"
+  Wibble(..todo, arg2: Wobble(arg: arg, arg2: arg2))
+}
+ "#,
+        find_position_of("todo").select_until(find_position_of("arg2: arg2")),
+    );
+}
+
+#[test]
+fn use_label_shorthand_works_for_nested_patterns() {
+    assert_code_action!(
+        USE_LABEL_SHORTHAND_SYNTAX,
+        r#"
+pub type Wibble { Wibble(arg: Int, arg2: Wobble) }
+pub type Wobble { Wobble(arg: Int, arg2: String) }
+
+pub fn main() {
+  let Wibble(arg2: Wobble(arg: arg, arg2: arg2), ..) = todo
+}
+ "#,
+        find_position_of("main").select_until(find_position_of("todo")),
+    );
+}
+
+#[test]
+fn use_label_shorthand_works_for_alternative_patterns() {
+    assert_code_action!(
+        USE_LABEL_SHORTHAND_SYNTAX,
+        r#"
+pub type Wibble { Wibble(arg: Int, arg2: String) }
+
+pub fn main() {
+  case Wibble(1, "wibble") {
+    Wibble(arg2: arg2, ..) | Wibble(arg: 1, arg2: arg2) -> todo
+  }
+}
+ "#,
+        find_position_of("main").select_until(find_position_of("todo")),
+    );
+}
+
 /* TODO: implement qualified unused location
 #[test]
 fn test_remove_unused_qualified_action() {
diff --git a/compiler-core/src/language_server/tests/snapshots/gleam_core__language_server__tests__action__use_label_shorthand_works_for_alternative_patterns.snap b/compiler-core/src/language_server/tests/snapshots/gleam_core__language_server__tests__action__use_label_shorthand_works_for_alternative_patterns.snap
new file mode 100644
index 000000000..d1437d621
--- /dev/null
+++ b/compiler-core/src/language_server/tests/snapshots/gleam_core__language_server__tests__action__use_label_shorthand_works_for_alternative_patterns.snap
@@ -0,0 +1,28 @@
+---
+source: compiler-core/src/language_server/tests/action.rs
+expression: "\npub type Wibble { Wibble(arg: Int, arg2: String) }\n\npub fn main() {\n  case Wibble(1, \"wibble\") {\n    Wibble(arg2: arg2, ..) | Wibble(arg: 1, arg2: arg2) -> todo\n  }\n}\n "
+---
+----- BEFORE ACTION
+
+pub type Wibble { Wibble(arg: Int, arg2: String) }
+
+pub fn main() {
+       ▔▔▔▔▔▔▔▔
+  case Wibble(1, "wibble") {
+▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
+    Wibble(arg2: arg2, ..) | Wibble(arg: 1, arg2: arg2) -> todo
+▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔↑   
+  }
+}
+ 
+
+
+----- AFTER ACTION
+
+pub type Wibble { Wibble(arg: Int, arg2: String) }
+
+pub fn main() {
+  case Wibble(1, "wibble") {
+    Wibble(arg2: , ..) | Wibble(arg: 1, arg2: ) -> todo
+  }
+}
diff --git a/compiler-core/src/language_server/tests/snapshots/gleam_core__language_server__tests__action__use_label_shorthand_works_for_nested_calls.snap b/compiler-core/src/language_server/tests/snapshots/gleam_core__language_server__tests__action__use_label_shorthand_works_for_nested_calls.snap
new file mode 100644
index 000000000..8dc7e15ca
--- /dev/null
+++ b/compiler-core/src/language_server/tests/snapshots/gleam_core__language_server__tests__action__use_label_shorthand_works_for_nested_calls.snap
@@ -0,0 +1,27 @@
+---
+source: compiler-core/src/language_server/tests/action.rs
+expression: "\npub fn wibble(arg arg: Int) -> Int { arg }\n\npub fn main() {\n  let arg = 1\n  wibble(wibble(arg: arg))\n}\n "
+---
+----- BEFORE ACTION
+
+pub fn wibble(arg arg: Int) -> Int { arg }
+
+pub fn main() {
+       ▔▔▔▔▔▔▔▔
+  let arg = 1
+▔▔▔▔▔▔▔▔▔▔▔▔▔
+  wibble(wibble(arg: arg))
+▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
+}
+↑
+ 
+
+
+----- AFTER ACTION
+
+pub fn wibble(arg arg: Int) -> Int { arg }
+
+pub fn main() {
+  let arg = 1
+  wibble(wibble(arg: ))
+}
diff --git a/compiler-core/src/language_server/tests/snapshots/gleam_core__language_server__tests__action__use_label_shorthand_works_for_nested_patterns.snap b/compiler-core/src/language_server/tests/snapshots/gleam_core__language_server__tests__action__use_label_shorthand_works_for_nested_patterns.snap
new file mode 100644
index 000000000..ebec3434f
--- /dev/null
+++ b/compiler-core/src/language_server/tests/snapshots/gleam_core__language_server__tests__action__use_label_shorthand_works_for_nested_patterns.snap
@@ -0,0 +1,25 @@
+---
+source: compiler-core/src/language_server/tests/action.rs
+expression: "\npub type Wibble { Wibble(arg: Int, arg2: Wobble) }\npub type Wobble { Wobble(arg: Int, arg2: String) }\n\npub fn main() {\n  let Wibble(arg2: Wobble(arg: arg, arg2: arg2), ..) = todo\n}\n "
+---
+----- BEFORE ACTION
+
+pub type Wibble { Wibble(arg: Int, arg2: Wobble) }
+pub type Wobble { Wobble(arg: Int, arg2: String) }
+
+pub fn main() {
+       ▔▔▔▔▔▔▔▔
+  let Wibble(arg2: Wobble(arg: arg, arg2: arg2), ..) = todo
+▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔↑   
+}
+ 
+
+
+----- AFTER ACTION
+
+pub type Wibble { Wibble(arg: Int, arg2: Wobble) }
+pub type Wobble { Wobble(arg: Int, arg2: String) }
+
+pub fn main() {
+  let Wibble(arg2: Wobble(arg: , arg2: ), ..) = todo
+}
diff --git a/compiler-core/src/language_server/tests/snapshots/gleam_core__language_server__tests__action__use_label_shorthand_works_for_nested_record_updates.snap b/compiler-core/src/language_server/tests/snapshots/gleam_core__language_server__tests__action__use_label_shorthand_works_for_nested_record_updates.snap
new file mode 100644
index 000000000..2c5236ebc
--- /dev/null
+++ b/compiler-core/src/language_server/tests/snapshots/gleam_core__language_server__tests__action__use_label_shorthand_works_for_nested_record_updates.snap
@@ -0,0 +1,28 @@
+---
+source: compiler-core/src/language_server/tests/action.rs
+expression: "\npub type Wibble { Wibble(arg: Int, arg2: Wobble) }\npub type Wobble { Wobble(arg: Int, arg2: String) }\n\npub fn main() {\n  let arg = 1\n  let arg2 = \"a\"\n  Wibble(..todo, arg2: Wobble(arg: arg, arg2: arg2))\n}\n "
+---
+----- BEFORE ACTION
+
+pub type Wibble { Wibble(arg: Int, arg2: Wobble) }
+pub type Wobble { Wobble(arg: Int, arg2: String) }
+
+pub fn main() {
+  let arg = 1
+  let arg2 = "a"
+  Wibble(..todo, arg2: Wobble(arg: arg, arg2: arg2))
+           ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔↑           
+}
+ 
+
+
+----- AFTER ACTION
+
+pub type Wibble { Wibble(arg: Int, arg2: Wobble) }
+pub type Wobble { Wobble(arg: Int, arg2: String) }
+
+pub fn main() {
+  let arg = 1
+  let arg2 = "a"
+  Wibble(..todo, arg2: Wobble(arg: , arg2: ))
+}
diff --git a/test/language/Makefile b/test/language/Makefile
index baa950281..211a9f6d1 100644
--- a/test/language/Makefile
+++ b/test/language/Makefile
@@ -22,5 +22,5 @@ deno:
 
 .phony: bun
 bun:
-	@echo test/languate on JavaScript with Bun
+	@echo test/language on JavaScript with Bun
 	cargo run --quiet -- test --target javascript --runtime bun