zanza00 / random-theme-switcher

a Visual Studio Code extension that chooses a theme for you
https://marketplace.visualstudio.com/items?itemName=zanza00.random-theme-switcher
8 stars 0 forks source link

How it works? #19

Closed rediffusion closed 4 years ago

rediffusion commented 4 years ago

I have the «VS Code» latest version. Every time I open the «VS Code» this menu pop-up:

image

If I want to change some theme I need to open User-Settings .json file then in this line insert theme name:

"workbench.colorTheme": "One Dark Pro"

I've tried to put this in package.json file with no luck:

"randomThemeSwitcher.themeList": [ "Andromeda Italic", "Cobalt2", "Dracula", "Tomorrow Night Blue", "Ayu Dark", "One Monokai", "Night Owl" ]

How could I change the theme with your super plugin!? With regards! ✌️

ghost commented 4 years ago

Hey @rediffusion ! 😄👋🏼

At the first launch it will ask you what kind of themes you would like to preload: both, ligth or dark. (I contributed to that distinction, because i like the dark ones and in previous version it would load all of them). You're actually right: at first glance it's not very clear... (we'll fix it 👍🏼)

This popup will only appear the first time (if you need it a later time, you can call Random Theme: Copy All Installed Theme in settings.

Not sure it's a typo or not, but the rigth file is : settings.json and you can reach it from the settings page: immagine

There you can specify the themeList: immagine

You can also set a workspace themeList creating/writing inside ".vscode/settings.json" a themeList.

Don't forget to look at the Switch Mode option.😉

Have you found a bug ?

p.s. the popup will only appear if at startup it detects that the themeList is empty. Can you read any suspicious warns/errors in the DevTools ?

rediffusion commented 4 years ago

@Denis-net Hello mate 👏

Anyway, it's not working! Here are my entries in Settings.json file:

    "randomThemeSwitcher.themeList": ["Noctis Minimus", "Ayu One", "Dracula Soft", "eppz!"],
    "randomThemeSwitcher.switchMode": "startup",

Should I use such entries? "workbench.colorTheme": "Noctis Minimus", ...with it or without entries, "Theme Random Swither" isn't working when I close the IDE and reopen it!

Regards!

ghost commented 4 years ago

hmmm, very strange. immagine (I only found "Ayu One Dark" but even with "Ayu One" the others still work) Try to set ".vscode/settings.json" inside a workspace (open a folder with vscode and add your keys there), then try to reopen it and see if something has changed. Even with that, does the app still popup the first picker ? What happens when you select an entry in the picker ? What encoding are you using ?

It looks like a problem with the app accessing the configuration. Nothing in the devtools ? Have you tried to remove all the keys, set a theme and then select in the command palette: "Add current theme to settings" ?

rediffusion commented 4 years ago

@Denis-net

At starting the IDE I use vs-dark then press ESC. In this folder, I have the same entries, I don't see any point in rewriting anything. 😕

%APPDATA%\Code\User\settings.json

Even with that the app still popup you the first picker?

Not seen anymore any popup.

What happens when you select an entry in the picker?

Nothing special just some field with prompt (if you... enter or ESC bla bla bla) --> Screencast.

Nothing in the devtools?

Where is it?

Have you tried to remove all the keys, set a theme and then select in the command palette: "Add current theme to settings" ?

Yes with no luck 😕

P.S. ••• if I use only this key "workbench.colorTheme": "Ayu One", then popup always popups when I reopening the IDE. Which theme I insert is no matter, I see this mad**** popup every time...

ghost commented 4 years ago

I forgot that there is also that part😅:

I see the encoding is UTF-8 so no problem with it.

Where is it?

immagine Here: VS Code is a Chrome in disguise (based on Chromium).😜

"workbench.colorTheme" is the standard VS Code key for changing the theme, "randomThemeSwitcher.themeList" is the key that will be examined at startup and belongs only to the extension.

Try to press Enter to the question.

ghost commented 4 years ago

Ok, le's try another way:

Please, try to open a powershell terminal and run this code :

code --list-extensions | % { "code --install-extension $_" }

then send me back the result.

In this way i'll try to emulate your environment in a VM and see what's going wrong. Maybe could be an extension called in some way that raise exceptions or something like that, I don't know yet. The more information we got the faster a solution can be found.👍🏼

rediffusion commented 4 years ago

Deal, here you go:

code --install-extension trfr2h5mxe6eyejgts4uaakmutbhor5ric2zlvrh5yxuswlt326a.webassembly code --install-extension be5invis.vscode-custom-css code --install-extension blackmist.LinkCheckMD code --install-extension DavidAnson.vscode-markdownlint code --install-extension Denis-net.vscode-ahk-manager code --install-extension docsmsft.docs-article-templates code --install-extension docsmsft.docs-authoring-pack code --install-extension docsmsft.docs-images code --install-extension docsmsft.docs-markdown code --install-extension docsmsft.docs-metadata code --install-extension docsmsft.docs-preview code --install-extension docsmsft.docs-yaml code --install-extension donjayamanne.jquerysnippets code --install-extension DotJoshJohnson.xml code --install-extension dracula-theme.theme-dracula code --install-extension eppz.eppz-code code --install-extension esbenp.prettier-vscode code --install-extension formulahendry.code-runner code --install-extension gerane.Theme-FlatlandMonokai code --install-extension jakebathman.mysql-syntax code --install-extension jebbs.plantuml code --install-extension joshpeng.theme-onedark-sublime code --install-extension jprestidge.theme-material-theme code --install-extension liviuschera.noctis code --install-extension mathiasfrohlich.Kotlin code --install-extension mgmcdermott.vscode-language-babel code --install-extension michelemelluso.code-beautifier code --install-extension monokai.theme-monokai-pro-vscode code --install-extension ms-python.anaconda-extension-pack code --install-extension ms-python.python code --install-extension ms-vscode.typescript-javascript-grammar code --install-extension oscarcs.dart-syntax-highlighting-only code --install-extension rbbit.typescript-hero code --install-extension redhat.vscode-yaml code --install-extension SanaAjani.taskrunnercode code --install-extension sldobri.bunker code --install-extension slevesque.vscode-autohotkey code --install-extension spences10.vba code --install-extension streetsidesoftware.code-spell-checker code --install-extension teabyii.ayu code --install-extension techer.open-in-browser code --install-extension zanza00.random-theme-switcher code --install-extension zhuangtongfa.material-theme

ghost commented 4 years ago

Thanks;

Windows on VM had to update itself...🙄😅😂

I restored almost all the extensions, except one. When the popup appeared, i selected "both" and then i pressed "Esc": immagine This is what I saw immediately next.

Two suspicious things:

After the second startup the extension didn't open the popup.

Pheraps could be the unpacked extension that cause the issue, not sure, but worked on the VM (I also updated VSC and retried again)

ghost commented 4 years ago

immagine I tried your setting and it worked too (but as i thought "Ayu One" isn't recognized)

immagine And this is after relaunching VSC

The only thing left is the manually installed extension. immagine immagine

The one that don't appear here.

Try to temporarily remove it and try again.

ghost commented 4 years ago

I tried to install two .vsix extensions, but the extension still works 😭

The strange thing is that even in .vsix extensions i can read their id. So What is this : code --install-extension trfr2h5mxe6eyejgts4uaakmutbhor5ric2zlvrh5yxuswlt326a.webassembly ?

Could you send me your settings.json ? (in order to have the nearest environment possible.)

If you hit Ctrl+K Ctrl+Shift+T("Switch to a Random Theme") nothing happens ?

rediffusion commented 4 years ago

code --install-extension trfr2h5mxe6eyejgts4uaakmutbhor5ric2zlvrh5yxuswlt326a.webassembly

Syntax Highlighting for .wasm files.

Could you send me your settings.json ?

settings.zip

If you hit Ctrl+K Ctrl+Shift+T("Switch to a Random Theme") nothing happens ?

This combinations aren't binding.

Nothing's working anyway, bro.

ghost commented 4 years ago

I found it !!! 🎉🎊

There are two main errors plus one horrible issue:

1) you have an issue with missing colons:

"editor.fontSize": 16
    "[typescript]": {
        "editor.defaultFormatter": "vscode.typescript-language-features"
    },

After the fontSize value (16) there must be a , i.e.:

"editor.fontSize": 16,
    "[typescript]": {
        "editor.defaultFormatter": "vscode.typescript-language-features"
    },

The same for:

"ahk.defaultArgs": "/r"
  "ahk.onArgs.run": true,

after "/r":

"ahk.defaultArgs": "/r",
  "ahk.onArgs.run": true,

Otherwise you will provide an unanalyzable file and VSC won't even be able to update it.

2) not sure is an error (don't think so) but settings.json should not be with comments (I think it still works, but given that a program will parse it, better to keep it simple😉

The other thing is more sneaky: immagine

The "<?>" means that the letter even though are correctly (except space) displayed aren't valid. So if you try to fix the colons you'll see that the workbench.colorTheme changes upon startup, but the theme stays the same. If you hover the cursor over the squiggles, you'll read "Theme is unknown or not installed". This will also happen if you restart vscode or change theme with the binding: immagine (btw, why can't you see the binding? how is it possible to disable extension suggested bindings ?)

To fix i suggest you to one or both the following things:

immagine

This should fix your issue.

ghost commented 4 years ago

Using HEX: immagine You can see that spaces are causing issues. (I have used the pencil and compared the two versions of "Noctis Minimus" and I used a Sticky for better align the two strings);

I'm glad it worked !🎉🎊 Enjoy !😄

rediffusion commented 4 years ago

There are two main errors plus one horrible issue:

I've corrected all the comas!

settings.json should not be with comments

It's simple for me to find what I need without it I'm like a blind cat.

The other thing is more sneaky:

Yes, I do a mistake when I copied entires to .json file directly as you said before. ✌️


How was the problem solved?

  1. Corrected all the comas!

  2. All I left was this key "workbench.colorTheme": "eppz!", and yours was removed.

  3. Restarted the IDE. Screencast switching themes.

Then I saw these entries at the very end of the keys (without any interference on my part):

  // Autohotkey Manager:     
  "ahk.defaultArgs": "/r",
  "ahk.onArgs.run": true,
  "ahk.onSave.run": true,
"ahk.displaySwitchButton": true,
"randomThemeSwitcher.themeList": [
    "Ayu One",
    "Dracula Soft",
    "eppz!",
    "Flatland Monokai",
    "Sublime Material Theme - Dark",
    "Noctis Minimus",
    "Dobri Next -A07- Oxford",
    "One Dark Pro"
]
}

btw, why can't you see the binding?

With bindings problem also was fixed, YAY! 🎈🔫

rediffusion commented 4 years ago

@Denis-net

🙈 It's me again. The question is, how do you set the theme daily? Used these keys with no result:

"randomThemeSwitcher.switchMode": "daily",
"randomThemeSwitcher.lastSwitchDay": 1

After restarting the IDE theme changes like he's shuffling cards. Tested and works only these:

manual typings

What's wrong with me again? 😕

ghost commented 4 years ago

With you ? Nothing With the extension ? I forgot an argument, so the lastSwitchDay could be read but cannot be written😅. I opened a PR in order to fix this issue. 👍🏼

I forgot: Happy new year ! 🥂🍾🎉🎊

rediffusion commented 4 years ago

10x, you're very attentive. Merry Christmas bro.

Merry Christmas

ghost commented 4 years ago

P.S. I found this extension that can be very useful in spotting this kind of issues.

Cheers !

ghost commented 4 years ago

I'm closing this because it's now part of the extension. But stay tuned because new features are coming ! 😉👍🏼 (I have also added a linter that will spot invalid theme names for you)