Code View in Canvas Not Working?

Is anyone else having issues with canvas and the code view? When I pull it up now it almost treats it like text instead of giving me the code inspector with line numbers etc. When I ask for edits it will disappear. This is happening on web and on desktop.

1 Like

Welcome to the forum.

I have access to canvas but have not used it. If you post an example of what to try, an image capture of what you see and explain what should be expected, I can test and reply.


While waiting I ran this prompt

Create some JavaScript code to check out a UI for JavaScript.

then in the right panel edited the code the same as using an editor such as VSCode. It worked as expected, the code line was added, the line numbers were present, etc.

So it looks like if you just open canvas using a “open canvas” command, it will not recognize that you want to code regardless of what you do after that. You have to Open Canvas with explicit direction that you are intending to work on code. Thanks for the help.

2 Likes

Can you be a bit more specific. I can only infer that you are suggesting to use a windows command dialog with the command open canvas, which I did try and did not work.

No, I’m talking about from a GPT prompt


Or if you try and just paste into it, it is not editable code. It will not spawn the code editor unless you start the conversation off specifically asking to edit code. Also, if you try and edit the code or do anything with it after that, it basically craps out …

1 Like

1 Like

I was re-reading the OpenAI canvas announcement

https://openai.com/index/introducing-canvas/

and noticed a slight variation in the command used

You can also include “use canvas” in your prompt to open canvas and use it to work on an existing project.

might be subtle but it might also be hardcoded. :slightly_smiling_face:

Wow, that is crazy, but the trick! Hard to believe that it is hard coded like that. Nice catch.

1 Like

I can easily see me and others making the same mistake.

Now that you have noted it and it is publicly documented you may have saved many others the same headache.

Thanks for asking!

Was using Canvas for some Lean script code and also used use canvas to start the session. Then pasted in the Lean script code and expected to see the line numbers which you noted were missing. When I read the notice about Canvas noticed that it is not exclusively for just source code and one has to expand the menu in the lower right to notice which mode was used.

For text this is the submenu

image

and for source code this is the submenu

image

So it appears that Canvas does not alway correctly recognize the text as source code and thinks it is just plain text.

Yes, I have had that happen as well where it will not recognize the pasted code as code and treat it like text. That would be good to have a code button to toggle

As a VSCode user, one would come to expect that a selector for the specific type of code be allowed. I often program with Prolog which is *.pl but that defaults to Perl which is just wrong, so I have to manually set it to associate *.pl with Prolog.

Another benefit would be to go even further and select a version of the source code, e.g. Python 3 or Python 4 because the syntax is different and the LLM models often do not get it correct. But if the specific language and version are used then that could be used to give the LLM much better reinforcement learning from human feedback (RLHF)