-
Notifications
You must be signed in to change notification settings - Fork 28
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
Codemap generic mapper does not work with UTF-16 encoded files #33
Comments
The generic mapper may not work for two reasons:
So I always eliminate the first reason by adding the existing MD mapper but for a new file extension. And then opening the MD wile renamed into the extension I want. So first ensure you are editing the right file and inserting the mapper value in the right place: I suggest you also do it for the MD mapper (i have attached the file). When you place the file in the When you get it working you can start experimenting with your regex as your infrastructure is already working. ======================== And I will have a look at the missing refresh button. Txs |
The new issue has been raised: #34 And fixed now. |
Thanks very much for the fast reply, and for fixing issue #34. OK, so I understand a lot better now. Firstly, I realise now that it is not a problem that "codemap.ws" shows as 'invalid' in settings.json, I can ignore this. So the issue I have is that Codemap will for some reason not recognise the files I am trying to work with. EDIT: I have identified the problem; my .ws files have UTF-16 LE encoding, and this does not seem to work with Codemap? If I re-save the files as UTF-8, it works immediately. See next comment. First, here's a working example: I followed your suggestion and copied "codemap.md" settings to "codemap.ws", and then renamed a .md file to .ws. This worked fine. Then I edited the settings to include a couple of simple regexes, and confirmed this also worked fine in my test file, as shown here:
So that's all perfect. But then when I try with a real .ws file, I get nothing: So I am thinking there must be some issue specific to the files I'm trying to load? Could it be because these files are in UTF-16 format? I don't know if that affects your code, but I do know I had trouble when I was trying to Below I have attached one of the files I am trying to work with. Would you be able to have a look to see whether it works for you, and if not, what the problem might be? And here is the basic config that I am testing with, which should pick out the
Thanks so much again for your time in helping me. |
* Issue #33: Codemap generic mapper does not work with UTF-16 encoded files. Changed (from reading doc content from the file) to reading the doc content from the text editor buffer. So no dependency on the file encoding.Fix
Can you check this patch before I publish it. It should fix your problem: |
I've grabbed the updated file from the source repo, going to try putting it in place now. One minute.. |
It works! I now have enums and functions visible on my UTF-16 .ws files. I got a few errors when I manually compiled mapper_generic.ts to mapper_generic.js, but the resulting .js file still seems to work fine (and I'm sure these errors are just because I manually compiled it in out/src) So yes, please could you push this to an official release. Thanks very much for the fast resolution! |
Great. Will publish in a min |
Done |
Hello
I just installed CodeMapper in VSCode 1.44.2 for Windows.
The extension seems to be working fine for supported languages, eg C#. But for some reason I am unable to configure the generic mapper to support a custom language.
I have tried following the example from the Wiki, and copied the example "codemap.x" configuration, renaming it "codemap.ws" as I wish to support files with a .ws extension. However my newly added variable "codemap.ws" is shown in settings.json to be invalid, and Codemap shows nothing when I test it on a sample file. I then tried copying the example in exactly, using "codemap.x", and it shows the same thing.
Here's a screenshot demonstrating my attempt to use both "codemap.ws" and "codemap.x" :
As you can see, both show as greyed out, and neither work on sample files with .ws or .x extensions.
I noticed on the Codemap extension configuration page that it has specific entries for Md, Ps1, Py and R , and if I try adding a settings.json value such as "codemap.md" or "codemap.ps1", these show as valid.
Apologies if I've done something wrong, or misunderstood something, or misread the Wiki. I am very new to VSCode.
Thanks in advance, and for creating Codemap, which looks to be exactly what I want - a way to get an outline view for a niche file extension.
PS. A separate issue, much less important - the Wiki and description talks of "Refreshing on demand via Refresh toolbar button"; I do not have any button in my Codemap bar except "Collapse All" :
The text was updated successfully, but these errors were encountered: