"No Code Selected" error
Describe the bug With code highlighted in VS Code when using any of the slash commands like /edit or /comment the output is always "No Code Selected".
To Reproduce Steps to reproduce the behavior:
- Go to the editor and highlight some code
- Click on the field to input a prompt to Continue and input, "/edit" or "/comment"
- See error
Environment
- Operating System: [Windows 10 Pro]
- Python Version: [3.11.5]
- Continue Version: [v0.0.397]
Logs
[2023-09-24 10:57:40,531] [DEBUG] Testing logs [2023-09-24 10:57:47,186] [DEBUG] Accepted websocket connection from Address(host='127.0.0.1', port=9806) [2023-09-24 10:57:47,190] [DEBUG] Downloading MeiliSearch... [2023-09-24 10:57:47,244] [DEBUG] Received message while initializing workspaceDirectory [2023-09-24 10:57:47,244] [DEBUG] Received message while initializing uniqueId [2023-09-24 10:57:47,247] [DEBUG] New session: None [2023-09-24 10:57:47,620] [DEBUG] Loaded Continue config file from C:\Users\Avatar.Avatar-PC.continue\config.py [2023-09-24 10:57:47,687] [DEBUG] Starting context manager [2023-09-24 10:57:47,689] [WARNING] Failed to load saved_context_groups.json: Expecting value: line 1 column 1 (char 0). Reverting to empty list. [2023-09-24 10:57:49,952] [DEBUG] Sending session id: 8e1b8e99-c6d1-439d-86ba-5113e125c67e [2023-09-24 10:57:49,982] [DEBUG] Received websocket connection at url: ws://localhost:65432/gui/ws?session_id=8e1b8e99-c6d1-439d-86ba-5113e125c67e [2023-09-24 10:57:49,982] [DEBUG] Session started [2023-09-24 10:57:49,982] [DEBUG] Registered websocket for session 8e1b8e99-c6d1-439d-86ba-5113e125c67e [2023-09-24 10:58:04,447] [DEBUG] Starting MeiliSearch... [2023-09-24 10:58:14,721] [DEBUG] Loading Meilisearch index... [2023-09-24 10:58:14,830] [WARNING] Error adding documents to meilisearch for context provider URLContextProvider: "URLContextProvider" object has no field "_static_url_context_items" [2023-09-24 10:58:14,830] [DEBUG] Loaded 0 documents into meilisearch in 0.0019991397857666016 seconds for context provider code [2023-09-24 10:58:14,837] [DEBUG] Loaded 1 documents into meilisearch in 0.011001348495483398 seconds for context provider diff [2023-09-24 10:58:14,841] [DEBUG] Loaded 1 documents into meilisearch in 0.014005661010742188 seconds for context provider terminal [2023-09-24 10:58:34,844] [DEBUG] Error loading meilisearch index: [2023-09-24 10:58:39,462] [DEBUG] Starting MeiliSearch... [2023-09-24 10:58:43,054] [WARNING] Error adding documents to meilisearch for context provider URLContextProvider: "URLContextProvider" object has no field "_static_url_context_items" [2023-09-24 10:58:43,054] [DEBUG] Loaded 0 documents into meilisearch in 0.0 seconds for context provider code [2023-09-24 10:58:43,054] [DEBUG] Loaded 1 documents into meilisearch in 0.0 seconds for context provider diff [2023-09-24 10:58:43,070] [DEBUG] Loaded 1 documents into meilisearch in 0.015629053115844727 seconds for context provider terminal [2023-09-24 10:59:03,063] [DEBUG] Error loading meilisearch index: [2023-09-24 10:59:03,063] [DEBUG] Loaded Meilisearch index [2023-09-24 10:59:20,305] [DEBUG] Received GUI message {"messageType":"add_model_for_role","data":{"role":"","model":{"model":"codellama","title":"Ollama"},"model_class":"Ollama"}} [2023-09-24 10:59:24,384] [WARNING] Error pre-loading Ollama model: Cannot connect to host localhost:11434 ssl:default [The remote computer refused the network connection] [2023-09-24 10:59:57,834] [DEBUG] Received GUI message {"messageType":"set_model_for_role_from_index","data":{"role":"","index":0}} [2023-09-24 11:00:48,403] [DEBUG] IDE websocket disconnected [2023-09-24 11:00:48,403] [DEBUG] Closing ide websocket [2023-09-24 11:00:48,419] [DEBUG] GUI websocket disconnected [2023-09-24 11:00:48,419] [DEBUG] Closing gui websocket [2023-09-24 11:00:48,419] [DEBUG] Removing session: 8e1b8e99-c6d1-439d-86ba-5113e125c67e [2023-09-24 11:01:29,502] [DEBUG] Health check [2023-09-24 11:01:29,512] [DEBUG] Accepted websocket connection from Address(host='127.0.0.1', port=1528) [2023-09-24 11:01:29,538] [DEBUG] Received message while initializing workspaceDirectory [2023-09-24 11:01:29,538] [DEBUG] Received message while initializing uniqueId [2023-09-24 11:01:30,545] [DEBUG] New session: None [2023-09-24 11:01:30,553] [DEBUG] Loaded Continue config file from C:\Users\Avatar.Avatar-PC.continue\config.py [2023-09-24 11:01:30,596] [DEBUG] Starting context manager [2023-09-24 11:01:30,596] [WARNING] Failed to load saved_context_groups.json: Expecting value: line 1 column 1 (char 0). Reverting to empty list. [2023-09-24 11:17:16,646] [DEBUG] Testing logs [2023-09-24 11:19:25,998] [DEBUG] Accepted websocket connection from Address(host='127.0.0.1', port=1781) [2023-09-24 11:19:26,237] [DEBUG] Received message while initializing workspaceDirectory [2023-09-24 11:19:26,238] [DEBUG] Received message while initializing uniqueId [2023-09-24 11:19:27,258] [DEBUG] New session: None [2023-09-24 11:19:27,620] [DEBUG] Loaded Continue config file from C:\Users\Avatar.Avatar-PC.continue\config.py [2023-09-24 11:19:27,688] [DEBUG] Starting context manager [2023-09-24 11:19:27,690] [WARNING] Failed to load saved_context_groups.json: Expecting value: line 1 column 1 (char 0). Reverting to empty list. [2023-09-24 11:19:29,955] [DEBUG] Sending session id: 23ce9834-87d8-470d-b74a-66fc83a168ec [2023-09-24 11:19:29,962] [DEBUG] Loading Meilisearch index... [2023-09-24 11:19:30,025] [DEBUG] Received websocket connection at url: ws://127.0.0.1:65432/gui/ws?session_id=23ce9834-87d8-470d-b74a-66fc83a168ec [2023-09-24 11:19:30,027] [DEBUG] Session started [2023-09-24 11:19:30,027] [DEBUG] Registered websocket for session 23ce9834-87d8-470d-b74a-66fc83a168ec [2023-09-24 11:19:30,047] [WARNING] Error adding documents to meilisearch for context provider URLContextProvider: "URLContextProvider" object has no field "_static_url_context_items" [2023-09-24 11:19:30,048] [DEBUG] Loaded 0 documents into meilisearch in 0.0030095577239990234 seconds for context provider code [2023-09-24 11:19:30,059] [DEBUG] Loaded 1 documents into meilisearch in 0.01300048828125 seconds for context provider diff [2023-09-24 11:19:30,066] [DEBUG] Loaded 1 documents into meilisearch in 0.021001577377319336 seconds for context provider terminal [2023-09-24 11:19:50,062] [DEBUG] Error loading meilisearch index: [2023-09-24 11:19:55,042] [DEBUG] Starting MeiliSearch... [2023-09-24 11:19:58,877] [WARNING] Error adding documents to meilisearch for context provider URLContextProvider: "URLContextProvider" object has no field "_static_url_context_items" [2023-09-24 11:19:58,878] [DEBUG] Loaded 0 documents into meilisearch in 0.0030031204223632812 seconds for context provider code [2023-09-24 11:19:58,887] [DEBUG] Loaded 1 documents into meilisearch in 0.01199960708618164 seconds for context provider diff [2023-09-24 11:19:58,893] [DEBUG] Loaded 1 documents into meilisearch in 0.01799917221069336 seconds for context provider terminal [2023-09-24 11:20:07,478] [DEBUG] Received GUI message {"messageType":"main_input","data":{"input":"Write a science fiction text adventure in Python"}} [2023-09-24 11:20:18,870] [DEBUG] Error loading meilisearch index: [2023-09-24 11:20:18,871] [DEBUG] Loaded Meilisearch index [2023-09-24 11:22:09,419] [DEBUG] Received GUI message {"messageType":"main_input","data":{"input":"Can you make this code more complex?"}} [2023-09-24 11:23:01,345] [DEBUG] Received GUI message {"messageType":"main_input","data":{"input":"/edit"}} [2023-09-24 11:23:01,391] [ERROR] Error while running step: Please highlight some code and try again. No Code Selected [2023-09-24 11:23:23,578] [DEBUG] Received GUI message {"messageType":"main_input","data":{"input":"/edit"}} [2023-09-24 11:23:23,625] [ERROR] Error while running step: Please highlight some code and try again. No Code Selected [2023-09-24 11:24:09,809] [DEBUG] Received GUI message {"messageType":"main_input","data":{"input":"/test"}} [2023-09-24 11:25:14,833] [DEBUG] Received GUI message {"messageType":"add_model_for_role","data":{"role":"*","model":{"model":"gpt-4","title":"GPT-4 Free Trial"},"model_class":"OpenAIFreeTrial"}} [2023-09-24 11:25:48,050] [DEBUG] Received GUI message {"messageType":"main_input","data":{"input":"/edit"}} [2023-09-24 11:25:48,119] [ERROR] Error while running step: Please highlight some code and try again. No Code Selected [2023-09-24 11:26:09,404] [DEBUG] Received GUI message {"messageType":"main_input","data":{"input":"/edit"}} [2023-09-24 11:26:09,463] [ERROR] Error while running step: Please highlight some code and try again. No Code Selected [2023-09-24 11:30:28,342] [DEBUG] Received GUI message {"messageType":"main_input","data":{"input":"When I type the slash command /edit I see the message "No code selected" but I have highlighted code in the editor."}} [2023-09-24 11:31:21,943] [DEBUG] Received GUI message {"messageType":"main_input","data":{"input":"/comment"}} [2023-09-24 11:31:22,043] [ERROR] Error while running step: Please highlight some code and try again. No Code Selected
I think I figured it out. I save the new file with a filename. Select the code and hit Ctrl+M. Now I can use the slash commands without the "No Code Selected error.
Responding in Discord, but I'll leave this open until I feel the root cause, discoverability-wise, is solved. Hopefully we can make this requirement more obvious
We've now changed the first step in the tutorial to cover this topic and the error message will also explain cmd+m, so going to close the issue