godotengine / godotengine/godot
Autocomplete searches across newlines to close strings
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
v4.3.beta2.official [b75f0485b]
Every 4.x version I've used to memory
### System information
Godot v4.3.beta2 - Windows 10.0.19044 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2060 (NVIDIA; 31.0.15.5161) - Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz (16 Threads)
### Issue description
Triggering auto complete on strings (most commonly res paths) destroys everything between the string you opened and the next string in the file. Happens with double quotes / quotations and single quotes / quotations.
Code completion should probably just check up to the end of the same line instead of the entire file to close the string, though i don't particularly care if it closes the string at all; I just don't want it to change irrelevant lines.
This has probably been reported with how easy it is to trigger but I couldn't find a duplicate issue through search which is why I'm being particularly verbose. Sorry!
If it hasn't been reported then it's probably because most people use auto brace completion which adds both the opening and closing marks which prevents this issue.
### Steps to reproduce
Open any project with any resource and trigger auto complete this code with the caret placed after the `"r`:
```gdscript
extends Node
var l := preload("r
var foo := "bar"
```
https://github.com/godotengine/godot/assets/3820082/e8359b3f-fa54-4631-aa56-c5ab7314e8af
### Minimal reproduction project (MRP)
N/A
Contributor guide
Research direction
Reproduce the issue in the Godot editor using the GDScript autocomplete example, with an unterminated string followed by another quoted line. Trace the autocomplete string-closing entry point and verify that completion does not modify text across a newline. Done means the reproduction no longer destroys the intervening line, with regression coverage for the demonstrated case.
Written by the indexing model from the issue text.
Assessment
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100