Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blank code cells added after reopening a notebook #36

Closed
yanghua-ola opened this issue Nov 25, 2021 · 7 comments
Closed

blank code cells added after reopening a notebook #36

yanghua-ola opened this issue Nov 25, 2021 · 7 comments

Comments

@yanghua-ola
Copy link

A lot of blank code cells were inserted after I reopen the notebook.
image
I've turned 'Save With Region Delimiter' off, it didn't make a difference though
image

@AnWeber
Copy link
Owner

AnWeber commented Nov 25, 2021

I would never have that issue before. Does the issue always occur? Do you have a code example.

@AnWeber
Copy link
Owner

AnWeber commented Nov 25, 2021

The setting httpbook.saveWithRegionDelimiter only change if always region delimiter are used or only if needed. If it is a RequestLine with Http Method and no script or variable is present, you can omit the ###, e.g.

GET https://httpbin.org/anything

GET https://httpbin.org/anything

I still have no idea how the behavior can occur. Each cell is currently an httpRegion/request for me. It would be interesting to know if the file also has the ### persisted (error occurs on save) or not (error occurs on load).

@rngtng
Copy link

rngtng commented Nov 28, 2021

fyi I experienced the same..

@AnWeber
Copy link
Owner

AnWeber commented Nov 28, 2021

Some hints how to reproduce issue. I do not use httpbook really often. First got hyped with Notebook UI, but now I prefer default editor. Did you edit file, before closing and reopening. Some special content. Anything special with files producing this error?

@rngtng
Copy link

rngtng commented Nov 28, 2021

This allows you to reproduce:

GET https://example.com/

###
GET https://example.com/

Open this in httpbook, execute the first. Response will be added. Then save and you'll get extra ###.

@AnWeber
Copy link
Owner

AnWeber commented Nov 30, 2021

The cause is a change in the behavior of the separator. Until recently, this was not considered to belong to a httpRegion/ request. However, since this can now contain the title and name of the httpRegion, it was included in the source.
I have now noticed that other recently made extensions (GRPC, MQTT) would cause errors because they are not taken into account.
https://github.com/AnWeber/httpbook/blob/main/src/extension/notebook/httpNotebookSerializer.ts#L142-L154

AnWeber added a commit that referenced this issue Nov 30, 2021
@AnWeber
Copy link
Owner

AnWeber commented Nov 30, 2021

I have fixed the cause of the empty cells. I am not quite happy with the as-is state, as unnecessary ### lines now appear in the cell. However, these are needed when setting the name of the httpRegion/ request. I don't have the necessary time to do the correct fix right now though. I will make up for it after Christmas.

@AnWeber AnWeber closed this as completed Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants