`v[1].toLocaleUpperCase` error while trying to add header
I cannot configure the header in any workspaces, because when trying to add the header I get the following error message
v[1].toLocaleUpperCase is not a function
My User settings:
"psi-header.templates": [
{
"language": "*",
"template": [
"===========================================================================",
"Copyright (C) <<projectCreationYear>> - <<year>>, <<company>> - All Rights Reserved",
// Blah Blah Blah
"",
"File: <<filename>>",
"Project: <<projectname>>",
"File Created: <<filecreated('dddd, Do MMMM YYYY h:mm:ss a')>>",
"Author: <<author>> (<<authorEmail>>)",
"----",
"Last Modified: <<date>>",
"Modified By: <<author>> (<<authorEmail>>>)",
"----",
"HISTORY:",
"Date \tBy\tComments",
"----------\t---\t---------------------------------------------------------",
"==========================================================================="
],
"changeLogCaption": "HISTORY:",
"changeLogHeaderLineCount": 2,
"changeLogNaturalOrder": false,
"changeLogEntryTemplate": [
"",
"<<dateformat('YYYY-MM-DD')>>\t<<initials>>\t"
],
"changeLogFooterLineCount": 0
}
],
"psi-header.config": {
"forceToTop": true,
"blankLinesAfter": 1,
"spacesBetweenYears": false,
"author": "Mitrajeet Golsangi",
"authorEmail": "[email protected]",
"initials": "MG",
"company": "My Company",
"creationDateZero": "asIs",
"hostname": "myhostname" // This is the actual value
},
"psi-header.lang-config": [
{
"language": "python",
"begin": "\"\"\"",
"end": "\"\"\"",
"prefix": "# ",
"suffix": " # ",
"rootDirFileName": "manage.py"
},
{
"language": "makefile",
"begin": "#",
"end": "#",
"prefix": "# ",
"suffix": " # ",
"rootDirFileName": "Makefile"
},
{
"language": "dockerfile",
"begin": "#",
"end": "#",
"prefix": "# ",
"suffix": " # ",
"rootDirFileName": "Dockerfile"
}
],
"psi-header.changes-tracking": {
"isActive": true,
"modAuthor": "Modified By:",
"modDate": "Last Modified:",
"modDateFormat": "dddd, Do MMMM YYYY h:mm:ss a",
"include": [],
"includeGlob": [],
"exclude": [
"markdown",
"json",
"jsonc",
"shellscript",
"snippets",
"toml",
"ignore",
"plaintext",
"yaml",
"env",
"log"
],
"excludeGlob": ["./**/*/ignoreme.*"],
"autoHeader": "autoSave",
"enforceHeader": true,
"replace": ["File:", "Project:"],
"updateLicenseVariables": false
}
My workspace settings
{
"psi-header.variables": [
["company", "My Company"],
["projectCreationYear", 2024]
]
}
I can't see anything obvious in your setup. However, there is only one place in the extension where toLocaleUpperCase() is called, so I have put a conditional statement around that to only call that method if v[1] is a string.
I cannot replicate the issue so will need you to test if this fixes it, and if there is anything obvious in the header that looks wrong. It could show in a substituted variable value or in the license text - is it possible that you are inserting license text that has the character sequence !U anywhere in it?
I hope to upload this at some point today as v1.23.1.
Regards D
The update is available now.
D
Hey thanks for the quick update.
After tinkering around a bit I located the issue to the projectCreationYear variable. Since I was passing it as an integer, TS does not recognise the toLocaleUpperCase function. I fixed it by making it a string, but now with this fix it probably will work with other data types too.
Anyway I appreciate the extension and love using it.
Excellent! And thanks for debugging it.
Regards D