PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: gleam-lang/gleam (rust)

Issue:
Language server provides completions within constant strings
If you type the following code:
```gleam
const x = "io.|"
```
The language server provides completions such as `io.println`. This should not happen inside strings.

Pull request:
Fix completions inside constant strings
Fixes #4652

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 003ffc8a4..967189b66 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,10 @@
   variable names of the compiler.
   ([Surya Rose](https://github.com/GearsDatapacks))
 
+- Fixed a bug where the language server would provide completions inside a
+  constant string.
+  ([Surya Rose](https://github.com/GearsDatapacks))
+
 ## v1.11.0-rc2 - 2025-05-29
 
 ### Compiler
diff --git a/compiler-core/src/language_server/engine.rs b/compiler-core/src/language_server/engine.rs
index 1cb826d85..2cfd48a1a 100644
--- a/compiler-core/src/language_server/engine.rs
+++ b/compiler-core/src/language_server/engine.rs
@@ -2,8 +2,9 @@ use crate::{
     Error, Result, Warning,
     analyse::name::correct_name_case,
     ast::{
-        self, CustomType, Definition, DefinitionLocation, ModuleConstant, PatternUnusedArguments,
-        SrcSpan, TypedArg, TypedConstant, TypedExpr, TypedFunction, TypedModule, TypedPattern,
+        self, Constant, CustomType, Definition, DefinitionLocation, ModuleConstant,
+        PatternUnusedArguments, SrcSpan, TypedArg, TypedConstant, TypedExpr, TypedFunction,
+        TypedModule, TypedPattern,
     },
     build::{
         ExpressionPosition, Located, Module, UnqualifiedImport, type_constructor_from_modules,
@@ -289,7 +290,8 @@ where
                 Located::Expression {
                     expression: TypedExpr::String { .. },
                     ..
-                } => None,
+                }
+                | Located::Constant(Constant::String { .. }) => None,
                 Located::Expression {
                     expression: TypedExpr::Call { fun, args, .. },
                     ..


Test patch:
diff --git a/compiler-core/src/language_server/tests/completion.rs b/compiler-core/src/language_server/tests/completion.rs
index 9d6dcc824..8899f415e 100644
--- a/compiler-core/src/language_server/tests/completion.rs
+++ b/compiler-core/src/language_server/tests/completion.rs
@@ -2238,3 +2238,17 @@ pub fn main() {
 
     assert_completion!(TestProject::for_source(code), Position::new(3, 18));
 }
+
+// https://github.com/gleam-lang/gleam/issues/4652
+#[test]
+fn no_completions_in_constant_string() {
+    let code = r#"
+const x = "io."
+"#;
+
+    let completions = completion(
+        TestProject::for_source(code).add_hex_module("gleam/io", "pub fn println() {todo}"),
+        Position::new(1, 14),
+    );
+    assert_eq!(completions, vec![],);
+}