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

Question about vscode "problems" tab #28

Closed
christopherpickering opened this issue Jul 28, 2022 · 16 comments
Closed

Question about vscode "problems" tab #28

christopherpickering opened this issue Jul 28, 2022 · 16 comments

Comments

@christopherpickering
Copy link
Contributor

hey @monosans there is a new issue djlint/djLint#305 about the problems tab in vscode. It sounds like vscode lists all problems for all open files in the problems tab. This is the normal vscode behavior, or is there a way to only run djlint on the current file? djlint/djLint#305 (comment)

@holohup
Copy link

holohup commented Jul 29, 2022

Got a little follow-up on this bug:
-New "problems" appear when when the cursor is moved anywhere on the code that has got any problems by itself. It's not enough to just open the file, you also have to move mouse over the code once. Once the errors appear, they stay in the tab forever, untill you restart VSCode
-For each single file with problems, a single temporary file is generated in which all the problems of the open file are highlighted in the "problems" tab. The file is called 0.(16 digits).html, it can be opened in the vscode, but it can not be edited. (The message says: Cannot edit in read-only editor). When moving a mouse over this read-only file, new files do not appear.
-The errors in this file contain errors ignored in the pyproject.toml config (but they are ignored in the original file)

Hope this helps!

@monosans
Copy link
Member

Everything works for me, I'm confused.

Any idea where this temporary file is coming from?

@holohup
Copy link

holohup commented Jul 29, 2022

The hypothesis is it's either a temporary file on disk, on in memory, which is created on the first cycle of file scan to find all the error. It's path is <path_to_file>/<filename.html>/0.<16 digits>.html, it's somehow inside the html file being edited. It's either created by the extension, or by some king of daemon inside the VSCode itself.
I've tried to disable linting for files like that in in the settings by using it's path mask, but failed :)

@christopherpickering
Copy link
Contributor Author

@holohup did you try with all other extensions disabled? Any chance you can take a screenshot video of what is happening?

@christopherpickering
Copy link
Contributor Author

@holohup could you also share your vscode settings? Are you saving files on a removable storage?

@holohup
Copy link

holohup commented Jul 29, 2022

Hi. The config file is:
{
"workbench.colorTheme": "Default Dark+",
"editor.fontWeight": "normal",
"editor.fontLigatures": false,
"window.zoomLevel": 1,

"files.associations": {
"/*.html": "html",
"
/templates//*.html": "django-html",
"
/templates//*": "django-txt",
"
/requirements{/**,*}.{txt,in}": "pip-requirements"
},
"emmet.includeLanguages": {
"django-html": "html"
},
"[html]": {
"editor.defaultFormatter": "monosans.djlint"
},
"[django-html]": {
"editor.defaultFormatter": "monosans.djlint"
},
"[handlebars]": {
"editor.defaultFormatter": "monosans.djlint"
},
"[hbs]": {
"editor.defaultFormatter": "monosans.djlint"
},
"[mustache]": {
"editor.defaultFormatter": "monosans.djlint"
},
"[jinja]": {
"editor.defaultFormatter": "monosans.djlint"
},
"[jinja-html]": {
"editor.defaultFormatter": "monosans.djlint"
},
"[nj]": {
"editor.defaultFormatter": "monosans.djlint"
},
"[njk]": {
"editor.defaultFormatter": "monosans.djlint"
},
"[nunjucks]": {
"editor.defaultFormatter": "monosans.djlint"
},
"[twig]": {
"editor.defaultFormatter": "monosans.djlint"
},
"editor.defaultFormatter": "monosans.djlint",
"[python]": {
"editor.defaultFormatter": "ms-python.python"
},
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"djlint.useEditorIndentation": false,
"explorer.confirmDragAndDrop": false
}

I am using an internal mac SSD, no removable storages attached.

As for the video, I'll try to record it this weekend.

I've tried disabling the extensions, the bugs stops appearing when I turn the pyton/pylance combo off, but the formatting stops working too. The formatting for the comments uses the same syntax as vscode, so the code I've copy-pasted looks out of square, attaching a screenshot for that part
Screen Shot 2022-07-29 at 16 56 42
.

@christopherpickering
Copy link
Contributor Author

Odd, I wonder what makes the problems tab update. I copied in your config and made a few html.j2 files. I only get problems showing up/updating when I save the file.
I also have the pylance and python extensions installed. Do they have their own settings that trigger the linting on hover?

@holohup
Copy link

holohup commented Jul 30, 2022

Hey there,
I've uploaded a 1-minute video: https://youtu.be/xkbqMmvgAyk
Hope it helps!

@monosans
Copy link
Member

Hey there, I've uploaded a 1-minute video: youtu.be/xkbqMmvgAyk Hope it helps!

I tried to do the same thing on Linux and Windows and it works fine. I think we should start by figuring out what exactly creates the temporary files. I was also confused by the fact that on your video linting only works on these temporary files, but not on regular files.

Can you also please upload your pip freeze? I will try to install the same versions of the dependencies and the same version of Python.

@holohup
Copy link

holohup commented Jul 30, 2022

I'm currently working on a mac M1, maybe the vscode works somehow different on this architecture? I think you got it wrong - I was hovering over regular files, and in the end I've opened a temporary file (all text plain white) to show it's path inside the regular file.
My pip freeze looks like this:

asgiref==3.5.2
attrs==21.4.0
autopep8==1.6.0
certifi==2022.6.15
charset-normalizer==2.0.12
click==8.1.3
colorama==0.4.5
coverage==6.4.2
Django==2.2.19
djlint==1.7.2
Faker==12.0.1
flake8==4.0.1
html-tag-names==0.1.2
html-void-elements==0.1.0
idna==3.3
importlib-metadata==4.12.0
iniconfig==1.1.1
mccabe==0.6.1
mixer==7.1.2
packaging==21.3
pathspec==0.9.0
Pillow==8.3.1
pluggy==0.13.1
py==1.11.0
pycodestyle==2.8.0
pyflakes==2.4.0
pyparsing==3.0.9
pytest==6.2.4
pytest-django==4.4.0
pytest-pythonpath==0.7.3
python-dateutil==2.8.2
pytz==2022.1
PyYAML==6.0
regex==2022.7.25
requests==2.26.0
six==1.16.0
sorl-thumbnail==12.7.0
sqlparse==0.4.2
toml==0.10.2
tomli==2.0.1
tqdm==4.64.0
typing_extensions==4.3.0
urllib3==1.26.11
zipp==3.8.1

@monosans
Copy link
Member

I'm currently working on a mac M1, maybe the vscode works somehow different on this architecture?

I don't think it has anything to do with macOS, because the person here had an identical problem, but on Windows.

My pip freeze looks like this:

I installed the same versions of the dependencies, but I still could not reproduce the issue.

@holohup
Copy link

holohup commented Jul 31, 2022

There's still hope that someone who can bring more details into this issue googles this page and helps. Thank you for your efforts!

@christopherpickering
Copy link
Contributor Author

Do any other linters have the same problem? pylint, or htmllint, or another?

@holohup
Copy link

holohup commented Aug 4, 2022

Hey. Got no problems using other linters.

@monosans
Copy link
Member

@holohup is the problem still relevant?

@holohup
Copy link

holohup commented Oct 16, 2022

@monosans hi! I've checked that project again with different scenarions and the bug never came up. I suppose it's gone now. The only thing that changed is the vscode version, I think, so the problem must have had been there. Thank you for your work!

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