[TOOL] CWTools - a mod validating extension for VS Code

  • Crusader Kings II Expansion Subscription

    Subscribe to the CK II Expansion and enjoy unlimited access to 13 major expansions and more!


  • Paradox Midsummer Sale has arrived! Up to 75% off!

    Enjoy some sun and song this Midsummer, but when the sun goes down, the fun doesn't have to stop! Paradox has a festive sale on plenty of games to keep your summer nights going!


    June 18th - June 30th
  • Crusader Kings III Available Now!

    The realm rejoices as Paradox Interactive announces the launch of Crusader Kings III, the latest entry in the publisher’s grand strategy role-playing game franchise. Advisors may now jockey for positions of influence and adversaries should save their schemes for another day, because on this day Crusader Kings III can be purchased on Steam, the Paradox Store, and other major online retailers.


    Real Strategy Requires Cunning

Dayshine

Second Lieutenant
43 Badges
Aug 25, 2016
110
32
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Horse Lords
  • BATTLETECH
  • Stellaris: Humanoids Species Pack
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome Sign Up
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Cities: Skylines
  • Europa Universalis IV
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Imperator: Rome
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Stellaris: Synthetic Dawn
  • Crusader Kings II: Sword of Islam
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Magicka
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Mare Nostrum
  • Sword of the Stars II
  • Crusader Kings II
I've updated the OP with some of the latest features.

CWTools now provides intelligent validation and completion for all moddable files. These rules are defined here: https://github.com/tboby/cwtools-stellaris-config
If find a mistake or are interested in helping improve the rules, just get in touch!

Next up, EU4 and HOI4 support! Again, help in developing the rules is always welcome.
 

Dayshine

Second Lieutenant
43 Badges
Aug 25, 2016
110
32
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Horse Lords
  • BATTLETECH
  • Stellaris: Humanoids Species Pack
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome Sign Up
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Cities: Skylines
  • Europa Universalis IV
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Imperator: Rome
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Stellaris: Synthetic Dawn
  • Crusader Kings II: Sword of Islam
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Magicka
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Mare Nostrum
  • Sword of the Stars II
  • Crusader Kings II
Just a quick update to say that the latest version of CWTools now supports validation of the majority of 2.2!
 

littleraskol

First Lieutenant
25 Badges
May 29, 2013
214
8
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II
  • Stellaris: Federations
  • Stellaris: Lithoids
  • Stellaris: Ancient Relics
  • Stellaris: Megacorp
  • Shadowrun: Hong Kong
  • Shadowrun: Dragonfall
  • Shadowrun Returns
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Stellaris: Synthetic Dawn
I'm noticing that it throws errors on custom added things. For example, if I create a new civic called my_custom_civic, and have something check for it like:

has_valid_civic = my_custom_civic

It will give an error: "Expected value of type civic CW240(CW240)"

This goes for jobs, buildings, all sorts of things. Is there any way to make the error checker recognize mod-added content so this doesn't happen?

Edit: It also tells me there is no localization for things that absolutely, 100% have defined localization, so I am assuming that there's something I'm doing wrong that it's not looking for localizations properly?

Edit 2: Also uhh maybe I don't understand how the config works, but is there any way to tell it to ignore an entire folder and all its subfolders and their contents for error checking, rather than individual files?

Awesome tool, btw, thank you.
 
Last edited:

Dayshine

Second Lieutenant
43 Badges
Aug 25, 2016
110
32
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Horse Lords
  • BATTLETECH
  • Stellaris: Humanoids Species Pack
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome Sign Up
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Cities: Skylines
  • Europa Universalis IV
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Imperator: Rome
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Stellaris: Synthetic Dawn
  • Crusader Kings II: Sword of Islam
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Magicka
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Mare Nostrum
  • Sword of the Stars II
  • Crusader Kings II
Is there any way to make the error checker recognize mod-added content so this doesn't happen?
This should be the default behaviour :) Your mod content should be used for validation as well as completion.

The most common reason I see for the kind of problem you're talking about (where it doesn't seem to load all your files) is only opening one file at a time in vscode.
It will only correctly load everything if you use "File -> Open Folder" and then open either:
1. Your mod folder directly
2. The Stellaris folder two levels above it (e.g. either Stellaris in documents, or Vanilla Stellaris)

If you open the Output (View, Output) and then select "Paradox Language Server" in the drop down in the panel that opens, you can see the extension's logging. It narrates its search for your mod files a little, so you might see something useful there!

As to ignoring whole folders, I haven't had anyone ask for that, and I'm not sure why you'd need it. You can type file filters in the "Problems" list to filter to only certain folders, if that's what you're trying to do? The individual file ignores were really meant for things like credits.txt which aren't script files.
 

littleraskol

First Lieutenant
25 Badges
May 29, 2013
214
8
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II
  • Stellaris: Federations
  • Stellaris: Lithoids
  • Stellaris: Ancient Relics
  • Stellaris: Megacorp
  • Shadowrun: Hong Kong
  • Shadowrun: Dragonfall
  • Shadowrun Returns
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Stellaris: Synthetic Dawn
This should be the default behaviour :) Your mod content should be used for validation as well as completion.

The most common reason I see for the kind of problem you're talking about (where it doesn't seem to load all your files) is only opening one file at a time in vscode.
It will only correctly load everything if you use "File -> Open Folder" and then open either:
1. Your mod folder directly
2. The Stellaris folder two levels above it (e.g. either Stellaris in documents, or Vanilla Stellaris)

OK, that fixed it, thanks! The issue was that I had loaded a container folder for both the mod folder and the .mod file into a VBC "workspace" rather than using this method.

As to ignoring whole folders, I haven't had anyone ask for that, and I'm not sure why you'd need it. You can type file filters in the "Problems" list to filter to only certain folders, if that's what you're trying to do? The individual file ignores were really meant for things like credits.txt which aren't script files.

I'm migrating from Atom where I had kept a copy of the Stellaris files loaded as a kind of reference. When I do this in VBC with CWTools, all kinds of errors pop up because it's not technically the base files, just a copy. I guess I could point to the base files instead, I'm just super paranoid about changing them haha.
 

littleraskol

First Lieutenant
25 Badges
May 29, 2013
214
8
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II
  • Stellaris: Federations
  • Stellaris: Lithoids
  • Stellaris: Ancient Relics
  • Stellaris: Megacorp
  • Shadowrun: Hong Kong
  • Shadowrun: Dragonfall
  • Shadowrun Returns
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Stellaris: Synthetic Dawn
Hm, well I can use "Open Folder" to add my mod and have it parse correctly and then save it as a workspace, but if I add even the base game files to that workspace, even if I have error checking for vanilla files turned off, it will show errors. I dunno, maybe there's a better way to do this? I've found it just incredibly useful to have all the vanilla files loaded in my workspace to refer to when modding, but I can't figure out how to make it work here.
 

Dayshine

Second Lieutenant
43 Badges
Aug 25, 2016
110
32
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Horse Lords
  • BATTLETECH
  • Stellaris: Humanoids Species Pack
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome Sign Up
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Cities: Skylines
  • Europa Universalis IV
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Imperator: Rome
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Stellaris: Synthetic Dawn
  • Crusader Kings II: Sword of Islam
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Magicka
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Mare Nostrum
  • Sword of the Stars II
  • Crusader Kings II
Hm, well I can use "Open Folder" to add my mod and have it parse correctly and then save it as a workspace, but if I add even the base game files to that workspace, even if I have error checking for vanilla files turned off, it will show errors. I dunno, maybe there's a better way to do this? I've found it just incredibly useful to have all the vanilla files loaded in my workspace to refer to when modding, but I can't figure out how to make it work here.

Better workspace support is something I'd like to do, but it's far from simple unfortunately.

I can't test this right now, but a workaround might be:
1. Place your Stellaris copy in a path that *does not* contain "Stellaris". E.g. F:/Programming/StellarisCopy/
2. Open your mod folder
3. Activate the extension (by opening a file in your mod).
4. Add the "StellarisCopy" folder to workspace.

CWTools uses the file path to detect script files (as I can't globally take .txt!) so if your vanilla files aren't stored under a folder called "Stellaris", they shouldn't trigger validation.
 

essi2

per rectum ad astra
136 Badges
Apr 18, 2008
414
214
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Sengoku
  • Victoria 2: A House Divided
  • Majesty 2 Collection
  • Sword of the Stars
  • Mount & Blade: Warband
  • Stellaris: Necroids
  • Hearts of Iron IV: Expansion Pass
  • Steel Division: Normandy 44
  • 500k Club
  • Cities: Skylines - Mass Transit
  • Europa Universalis III: Collection
  • Magicka: Wizard Wars Founder Wizard
  • Stellaris Sign-up
  • Mount & Blade: With Fire and Sword
  • Crusader Kings II: Way of Life
  • Cities: Skylines - Natural Disasters
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Stellaris: Digital Anniversary Edition
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Conclave
  • BATTLETECH
  • Achtung Panzer
  • Imperator: Rome Deluxe Edition
  • Europa Universalis IV: Mandate of Heaven
  • Surviving Mars: First Colony Edition
  • Europa Universalis IV
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Rule Britannia
  • Steel Division: Normandy 44 -  Back to Hell
  • Steel Division: Normand 44 - Second Wave
  • Cities: Skylines - Green Cities
  • Stellaris: Humanoids Species Pack
  • Shadowrun Returns
  • Europa Universalis IV: Dharma
  • Stellaris: Distant Stars
  • Cities: Skylines Industries
  • Cities: Skylines - Parklife
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Field Marshal
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Colonel
  • Europa Universalis IV: Golden Century
  • Surviving Mars
  • Supreme Ruler 2020
  • Victoria 2
I'm getting some errors I can't quite figure out.
{
"resource": "/c:/Users/EspenHansen/OneDrive/Modding/Stellaris/Mods/essi2tweaks/Stellar Naming/common/random_names/00_empire_names.txt",
"owner": "_generated_diagnostic_collection_name_#2",
"code": "CW002",
"severity": 8,
"message": "This block has mixed key/values and values, it is probably a missing equals sign inside it.",
"source": "CW002",
"startLineNumber": 1153,
"startColumn": 2,
"endLineNumber": 1153,
"endColumn": 7
}

{
"resource": "/f:/Steam/steamapps/common/Stellaris/common/random_names/00_empire_names.txt",
"owner": "_generated_diagnostic_collection_name_#2",
"code": "CW002",
"severity": 8,
"message": "This block has mixed key/values and values, it is probably a missing equals sign inside it.",
"source": "CW002",
"startLineNumber": 1153,
"startColumn": 2,
"endLineNumber": 1153,
"endColumn": 7
}

And several of these, but only in the modded file, not the original. Even though the script parts in question are identical in both.

{
"resource": "/c:/Users/EspenHansen/OneDrive/Modding/Stellaris/Mods/essi2tweaks/Stellar Naming/common/random_names/00_empire_names.txt",
"owner": "_generated_diagnostic_collection_name_#2",
"code": "CW251",
"severity": 4,
"message": "This AND is unnecessary",
"source": "CW251",
"startLineNumber": 4941,
"startColumn": 4,
"endLineNumber": 4941,
"endColumn": 7
}

EDIT: Similar issue with 00_rules.txt gives warning in the modded file, but not the original
 
Last edited:

Dayshine

Second Lieutenant
43 Badges
Aug 25, 2016
110
32
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Horse Lords
  • BATTLETECH
  • Stellaris: Humanoids Species Pack
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome Sign Up
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Cities: Skylines
  • Europa Universalis IV
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Imperator: Rome
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Stellaris: Synthetic Dawn
  • Crusader Kings II: Sword of Islam
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Magicka
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Mare Nostrum
  • Sword of the Stars II
  • Crusader Kings II
I'm getting some errors I can't quite figure out.
{
"resource": "/c:/Users/EspenHansen/OneDrive/Modding/Stellaris/Mods/essi2tweaks/Stellar Naming/common/random_names/00_empire_names.txt",
"owner": "_generated_diagnostic_collection_name_#2",
"code": "CW002",
"severity": 8,
"message": "This block has mixed key/values and values, it is probably a missing equals sign inside it.",
"source": "CW002",
"startLineNumber": 1153,
"startColumn": 2,
"endLineNumber": 1153,
"endColumn": 7
}

{
"resource": "/f:/Steam/steamapps/common/Stellaris/common/random_names/00_empire_names.txt",
"owner": "_generated_diagnostic_collection_name_#2",
"code": "CW002",
"severity": 8,
"message": "This block has mixed key/values and values, it is probably a missing equals sign inside it.",
"source": "CW002",
"startLineNumber": 1153,
"startColumn": 2,
"endLineNumber": 1153,
"endColumn": 7
}

And several of these, but only in the modded file, not the original. Even though the script parts in question are identical in both.

{
"resource": "/c:/Users/EspenHansen/OneDrive/Modding/Stellaris/Mods/essi2tweaks/Stellar Naming/common/random_names/00_empire_names.txt",
"owner": "_generated_diagnostic_collection_name_#2",
"code": "CW251",
"severity": 4,
"message": "This AND is unnecessary",
"source": "CW251",
"startLineNumber": 4941,
"startColumn": 4,
"endLineNumber": 4941,
"endColumn": 7
}

EDIT: Similar issue with 00_rules.txt gives warning in the modded file, but not the original
By default errors in Vanilla are hidden (as you usually aren't interested in validating/edited vanilla directly :) ).
If you were to enable the setting "cwtools.errors.vanilla" then you would see the same errors in the vanilla files.

That specific error is there to warn about the following:
Code:
some_cause = {
    first = true
    second = false
    third true
    fourth = true
}

It just happens that those name files are the only place where it's ok to mix "x = y" and "x y" in the same clause.
If the error bothers you, you can always disable it in the "cwtools.errors.ignore" setting.

As to the redundant AND, yes, vanilla isn't perfect! :)
 

essi2

per rectum ad astra
136 Badges
Apr 18, 2008
414
214
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Sengoku
  • Victoria 2: A House Divided
  • Majesty 2 Collection
  • Sword of the Stars
  • Mount & Blade: Warband
  • Stellaris: Necroids
  • Hearts of Iron IV: Expansion Pass
  • Steel Division: Normandy 44
  • 500k Club
  • Cities: Skylines - Mass Transit
  • Europa Universalis III: Collection
  • Magicka: Wizard Wars Founder Wizard
  • Stellaris Sign-up
  • Mount & Blade: With Fire and Sword
  • Crusader Kings II: Way of Life
  • Cities: Skylines - Natural Disasters
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Stellaris: Digital Anniversary Edition
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Conclave
  • BATTLETECH
  • Achtung Panzer
  • Imperator: Rome Deluxe Edition
  • Europa Universalis IV: Mandate of Heaven
  • Surviving Mars: First Colony Edition
  • Europa Universalis IV
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Rule Britannia
  • Steel Division: Normandy 44 -  Back to Hell
  • Steel Division: Normand 44 - Second Wave
  • Cities: Skylines - Green Cities
  • Stellaris: Humanoids Species Pack
  • Shadowrun Returns
  • Europa Universalis IV: Dharma
  • Stellaris: Distant Stars
  • Cities: Skylines Industries
  • Cities: Skylines - Parklife
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Field Marshal
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Colonel
  • Europa Universalis IV: Golden Century
  • Surviving Mars
  • Supreme Ruler 2020
  • Victoria 2
Good to know, thanks :)
 

Dayshine

Second Lieutenant
43 Badges
Aug 25, 2016
110
32
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Horse Lords
  • BATTLETECH
  • Stellaris: Humanoids Species Pack
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome Sign Up
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Cities: Skylines
  • Europa Universalis IV
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Imperator: Rome
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Stellaris: Synthetic Dawn
  • Crusader Kings II: Sword of Islam
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Magicka
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Mare Nostrum
  • Sword of the Stars II
  • Crusader Kings II
Please explain how to validate the files. I have the extensions installed and the syntax highlighting and help with completing all work and I can see how it helps me while typing but how can I get your tool to check my mod for errors in the existing code?

Thanks
If you use "Open folder" and select your mod folder, it will load and validate as soon as you open a file inside it. This can take a minute or two to load depending on your PC's speed. You'll know it's happening because there's some progress text in the bottom left. "Loading project..." then "Validating files...". To test it just set a trigger/effect to a nonsense value, you should see it highlight that as an error.
 

17blue17

Field Marshal
67 Badges
Nov 9, 2003
6.277
266
Visit site
  • Stellaris: Galaxy Edition
  • Cities: Skylines
  • Cities: Skylines Deluxe Edition
  • Europa Universalis III: Collection
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • 500k Club
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Third Rome
  • Hearts of Iron IV: Death or Dishonor
  • Stellaris: Necroids
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Crusader Kings II
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Heir to the Throne
  • Europa Universalis III Complete
  • Leviathan: Warships
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Victoria 2
  • Victoria 2: A House Divided
If you use "Open folder" and select your mod folder, it will load and validate as soon as you open a file inside it. This can take a minute or two to load depending on your PC's speed. You'll know it's happening because there's some progress text in the bottom left. "Loading project..." then "Validating files...". To test it just set a trigger/effect to a nonsense value, you should see it highlight that as an error.

Thank you for your reply.

I understand but I still need some help. It keeps saying generating vanillia cache so I think I have the cache directory syntax wrong. The install is at

I:\Steam\steamapps\common\Stellaris - maybe the program has a problem with the install being on a drive other than c ?

using jason for the setting file it keeps trying to format it as

Code:
{
    "cwtools.cache.stellaris": "\"I\\Steam\\steamapps\\common\\Stellaris\"",
    "cwtools.localisation.languages": [ "English",],
    "cwtools.errors.vanilla":false,
    "cwtools.experimental":true,
    "cwtools.trace.server": "off",
    "cwtools.errors.ignorefiles": ["README.txt,credits.txt,credits_l_simp_chinese.txt,reference.txt,startup_info.txt"],
    "files.associations": {
        "*.txt": "stellaris"
    },
    "workbench.startupEditor": "newUntitledFile"
}

and jason shows no errors in the settings file. If I try to make any changes then jason complains about errors in expected syntax.

1) so is this correct the way jason wants to format the cache location?
2) for file association I have some drive letter short cuts that bypass the Stellaris so I tried to use "mod" but only ".txt" seems to work.

For my test error I did

Code:
immediate = {
        add_resource = { fred = 54000 }
    }

and the program never marks fred as being in error but as I said it keeps doing the generate vanilla cache.

EDIT:

I also tried the following with no change

Code:
{
    "cwtools.cache.stellaris": "I\\Steam\\steamapps\\common\\Stellaris",
    "cwtools.localisation.languages": [ "English",],
    "cwtools.errors.vanilla":false,
    "cwtools.experimental":true,
    "cwtools.trace.server": "off",
    "cwtools.errors.ignorefiles": ["README.txt,credits.txt,credits_l_simp_chinese.txt,reference.txt,startup_info.txt"],
    "workbench.startupEditor": "newUntitledFile",
    "files.associations": {
        "*.txt": "stellaris",
        "*.yml": "stellaris",
        "mod": "stellaris",
        "Stellaris": "stellaris"
    }
}

so what should I change to the above?
 
Last edited:

Dayshine

Second Lieutenant
43 Badges
Aug 25, 2016
110
32
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Horse Lords
  • BATTLETECH
  • Stellaris: Humanoids Species Pack
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome Sign Up
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Cities: Skylines
  • Europa Universalis IV
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Imperator: Rome
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Stellaris: Synthetic Dawn
  • Crusader Kings II: Sword of Islam
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Magicka
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Mare Nostrum
  • Sword of the Stars II
  • Crusader Kings II
Thank you for your reply.

I understand but I still need some help. It keeps saying generating vanillia cache so I think I have the cache directory syntax wrong. The install is at

I:\Steam\steamapps\common\Stellaris - maybe the program has a problem with the install being on a drive other than c ?

using jason for the setting file it keeps trying to format it as

Code:
{
    "cwtools.cache.stellaris": "\"I\\Steam\\steamapps\\common\\Stellaris\"",
    "cwtools.localisation.languages": [ "English",],
    "cwtools.errors.vanilla":false,
    "cwtools.experimental":true,
    "cwtools.trace.server": "off",
    "cwtools.errors.ignorefiles": ["README.txt,credits.txt,credits_l_simp_chinese.txt,reference.txt,startup_info.txt"],
    "files.associations": {
        "*.txt": "stellaris"
    },
    "workbench.startupEditor": "newUntitledFile"
}

and jason shows no errors in the settings file. If I try to make any changes then jason complains about errors in expected syntax.

1) so is this correct the way jason wants to format the cache location?
2) for file association I have some drive letter short cuts that bypass the Stellaris so I tried to use "mod" but only ".txt" seems to work.

For my test error I did

Code:
immediate = {
        add_resource = { fred = 54000 }
    }

and the program never marks fred as being in error but as I said it keeps doing the generate vanilla cache.

EDIT:

I also tried the following with no change

Code:
{
    "cwtools.cache.stellaris": "I\\Steam\\steamapps\\common\\Stellaris",
    "cwtools.localisation.languages": [ "English",],
    "cwtools.errors.vanilla":false,
    "cwtools.experimental":true,
    "cwtools.trace.server": "off",
    "cwtools.errors.ignorefiles": ["README.txt,credits.txt,credits_l_simp_chinese.txt,reference.txt,startup_info.txt"],
    "workbench.startupEditor": "newUntitledFile",
    "files.associations": {
        "*.txt": "stellaris",
        "*.yml": "stellaris",
        "mod": "stellaris",
        "Stellaris": "stellaris"
    }
}

so what should I change to the above?

Assuming you're on windows, the minimum configuration I think you'd want is the following. The path format is different to yours, that double quoting is weird. I would recommend trying without any file association for *.txt, as that might cause cwtools to trigger in places it can't properly support. The "messages" trace value will produce a little more diagnostic info in the log.
Code:
        "cwtools.cache.stellaris": "f:\\Games\\Steam\\steamapps\\common\\Stellaris",
    "cwtools.trace.server": "messages",
        "cwtools.rules_version": "latest",
        "extensions.autoUpdate": true,

You can always try setting the stellaris path to blank and it'll prompt you to select it through the pop-up, which should get the format right.

If that doesn't work, please follow these steps to get some log files and PM them to me so I can have a closer look :)
1. Open vscode/cwtools and let it try and do the initial load (give it a minute or so)
2. View -> Output
3. In the panel that opens, on the right hand side, select "Paradox language server" in the dropdown. If there are multiple, pick the one with more it in.
4.Copy that log into a file/pastebin/somewhere and send it to me in a PM. Please note it might have your user path in there, so make sure to censor that if you don't want me to know it.
 

Dayshine

Second Lieutenant
43 Badges
Aug 25, 2016
110
32
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Horse Lords
  • BATTLETECH
  • Stellaris: Humanoids Species Pack
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome Sign Up
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Cities: Skylines
  • Europa Universalis IV
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Imperator: Rome
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Stellaris: Synthetic Dawn
  • Crusader Kings II: Sword of Islam
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Magicka
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Mare Nostrum
  • Sword of the Stars II
  • Crusader Kings II
Does this work for Vic2 files as well?
simsulla kindly contributed a good amount of the basic support for Vic2, so if you open a vic2 mod it should activate and do basic syntax validation.
However, the rules that provide more detailed validation/completion/etc aren't quite done, so you'll get quite a lot of false positives. If you'd be interested in helping finish support for vic2 send me a PM and I can link you to the github repository where you can contribute :)
 

littleraskol

First Lieutenant
25 Badges
May 29, 2013
214
8
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II
  • Stellaris: Federations
  • Stellaris: Lithoids
  • Stellaris: Ancient Relics
  • Stellaris: Megacorp
  • Shadowrun: Hong Kong
  • Shadowrun: Dragonfall
  • Shadowrun Returns
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Stellaris: Synthetic Dawn
I'm getting error messages on random lists that seem incorrect. It looks like, from the tooltip, what's expected is something like this:

Code:
random_list = {
            0.5 = { do stuff }
}

Because it says it wants a floating point value between 0 and 0.99999. However, the base game code contains plenty of random lists that are like this:

Code:
random_list = {
            50 = { do stuff }
}

With whole number values that are conceptually percentages. What's going on?

OP6arAu.png
 

Dayshine

Second Lieutenant
43 Badges
Aug 25, 2016
110
32
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Horse Lords
  • BATTLETECH
  • Stellaris: Humanoids Species Pack
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome Sign Up
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Cities: Skylines
  • Europa Universalis IV
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Imperator: Rome
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Stellaris: Synthetic Dawn
  • Crusader Kings II: Sword of Islam
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Magicka
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Mare Nostrum
  • Sword of the Stars II
  • Crusader Kings II
I'm getting error messages on random lists that seem incorrect. It looks like, from the tooltip, what's expected is something like this:

Code:
random_list = {
            0.5 = { do stuff }
}

Because it says it wants a floating point value between 0 and 0.99999. However, the base game code contains plenty of random lists that are like this:

Code:
random_list = {
            50 = { do stuff }
}

With whole number values that are conceptually percentages. What's going on?

OP6arAu.png

The odds are that you have an error inside one of the effect blocks inside.

It's a slight flaw with how the rules are set up. It has two versions of `random_list`, one with integers and one with percentages.
It's seeing that inner error and going "Oh, maybe the mistake is that I picked the wrong type of random_list", so gives you that error *in addition to the real error inside*.
I should perhaps try and link the two errors to make it clearer.

Is that right?
 

Starless2001

Second Lieutenant
25 Badges
Sep 29, 2016
187
6
  • Stellaris: Galaxy Edition
  • Stellaris: Humanoids Species Pack
  • Stellaris: Necroids
  • Stellaris: Federations
  • Stellaris: Lithoids
  • Stellaris: Ancient Relics
  • Cities: Skylines - Campus
  • Stellaris: Megacorp
  • Cities: Skylines Industries
  • Shadowrun Returns
  • Stellaris: Distant Stars
  • Cities: Skylines - Parklife
  • Cities: Skylines - Parklife Pre-Order
  • Stellaris: Apocalypse
  • Cities: Skylines
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Mass Transit
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Natural Disasters
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Galaxy Edition
  • Stellaris
  • Stellaris: Synthetic Dawn
  • Cities: Skylines Deluxe Edition
I'm getting a problem since yesterday where autocomplete suggestions on ctrl+space only show the terms already in the file (not even paradox language stuff, it shows as autocomplete even stuff I write on comments) prefixed by an icon containing the letters abc. I suppose this is a Visual Studio Code utility and has nothing to do with your extension.

It appears your extension simply stopped working properly. I can still see it sending and receiving messages, but nothing gets validated and no code suggestion works (the code snippets for events work, by the way, that's the only thing still working).

I don't understand a thing about the internal workings of a Visual Studio Code extension but something is definitely broken. I have both CWTools Paradox Language Server and Paradox Syntax Highlighting.

Now, getting to the point, should I try to reinstall? How to do that properly, just click uninstall on both extensions, close VS Code, open it search for them and install again? Or should I not do that and something else instead to fix it?

Thanks for this great extension and for any help you're willing to offer to solve this issue.