# Chat window can not recognize the correct line number

**URL:** <https://forum.cursor.com/t/chat-window-can-not-recognize-the-correct-line-number/3723>\
**Category:** Help\
**Created:** [March 26, 2024, 10:05am UTC](https://forum.cursor.com/t/chat-window-can-not-recognize-the-correct-line-number/3723 "2024-03-26T10:05:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tangjun](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/tangjun/32/16356_2.png) [@tangjun](https://forum.cursor.com/u/tangjun)\
**Post date:** [March 26, 2024, 10:05am UTC](https://forum.cursor.com/t/chat-window-can-not-recognize-the-correct-line-number/3723/1 "2024-03-26T10:05:57Z")

</div>

![image](https://us1.discourse-cdn.com/cursor1/original/2X/b/b8ccbe9ec0b714838bede8815fd1581ced2d25a2.png)

The chat window cannot correctly know the line number position, so an incorrect response is given.

Sometimes, we need to **edit code in the specified location** or **explain the code at the specified location**. If line numbers are used to represent the location, the chat window cannot correctly identify it.

so can you fix this bug?

or add a new feature like:

**@line**

the usage case like:

> can you explain this code at @line 25-30

> add a div tag at @line 15

---

<div class="post-metadata">

**Author:** ![tangjun](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/tangjun/32/16356_2.png) [@tangjun](https://forum.cursor.com/u/tangjun)\
**Post date:** [March 26, 2024, 10:15am UTC](https://forum.cursor.com/t/chat-window-can-not-recognize-the-correct-line-number/3723/2 "2024-03-26T10:15:09Z")

</div>

Or, is there any alternative way to point out ‘specify a certain location’?

---

<div class="post-metadata">

**Author:** ![debian3](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@debian3](https://forum.cursor.com/u/debian3)\
**Post date:** [March 26, 2024, 10:19am UTC](https://forum.cursor.com/t/chat-window-can-not-recognize-the-correct-line-number/3723/3 "2024-03-26T10:19:47Z")

</div>

Highlight the section you want, click on “add to chat”, then ask your question. The full file will be sent as context, and it will know which part you are referring to.

---

<div class="post-metadata">

**Author:** ![tangjun](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/tangjun/32/16356_2.png) [@tangjun](https://forum.cursor.com/u/tangjun)\
**Post date:** [March 26, 2024, 1:18pm UTC](https://forum.cursor.com/t/chat-window-can-not-recognize-the-correct-line-number/3723/4 "2024-03-26T13:18:12Z")

</div>

ok, that’s right, but it is still a bug. 😭

---

<div class="post-metadata">

**Author:** ![tangjun](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/tangjun/32/16356_2.png) [@tangjun](https://forum.cursor.com/u/tangjun)\
**Post date:** [March 26, 2024, 1:22pm UTC](https://forum.cursor.com/t/chat-window-can-not-recognize-the-correct-line-number/3723/5 "2024-03-26T13:22:57Z")

</div>

your method worked, thx.

---

<div class="post-metadata">

**Author:** ![AlteriusOmega](https://avatars.discourse-cdn.com/v4/letter/a/f14d63/32.png) [@AlteriusOmega](https://forum.cursor.com/u/AlteriusOmega)\
**Post date:** [January 16, 2025, 7:54pm UTC](https://forum.cursor.com/t/chat-window-can-not-recognize-the-correct-line-number/3723/6 "2025-01-16T19:54:53Z")

</div>

Yeah this is very annoying. @debian3’s workaround works as a band-aid fix, but this is a pretty basic functionality that needs to be rectified. The whole point of an AI assistant is to act like a human assistant and use natural language. It’s natural to ask “Can you explain line 35?”, so Cursor needs to be able to handle this common scenario

---

<div class="post-metadata">

**Author:** ![danperks](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/danperks/32/19087_2.png) [@danperks](https://forum.cursor.com/u/danperks)\
**Post date:** [January 18, 2025, 10:18pm UTC](https://forum.cursor.com/t/chat-window-can-not-recognize-the-correct-line-number/3723/7 "2025-01-18T22:18:15Z")

</div>

Even if we were to add the ability for the AI to see the line numbers, I don’t believe it would work correctly as LLMs have a hard time dealing with numbers and occurrences like this!

There’s a cool article here that discusses this issue, as best highlighted when you ask an LLM how many ‘r’ characters there are in the word strawberry (and the AI doesn’t cheat and write code to do it, like ChatGPT does now):

[https://www.inc.com/kit-eaton/how-many-rs-in-strawberry-this-ai-cant-tell-you.html](https://www.inc.com/kit-eaton/how-many-rs-in-strawberry-this-ai-cant-tell-you.html)

---

<div class="post-metadata">

**Author:** ![tangjun](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/tangjun/32/16356_2.png) [@tangjun](https://forum.cursor.com/u/tangjun)\
**Post date:** [January 19, 2025, 9:23am UTC](https://forum.cursor.com/t/chat-window-can-not-recognize-the-correct-line-number/3723/8 "2025-01-19T09:23:02Z")

</div>

“All right. I don’t necessarily have to use the method of specifying line numbers. If there are other ways to specify the position, you can also give me some suggestions.”
