question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tokenizer treats commands as expandable strings

See original GitHub issue

The tokenizer seems to treat commands (and some other tokens) as expandable strings. Why is this? It makes misleading colorization in PSReadLine.

function crazy$function {echo test} # `$function` appears to be a variable, but is not

crazy$function # again, `$function` appears to be a variable that will expand, but it is not

image

Another one that occurs is if you start a command with a dash, the tokenizer marks it as a parameter, but it should mark it as a command.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
bpayettecommented, Aug 2, 2019

By design, a command name can contain any characters that can be in a file name since, rather obviously, files are commands. And, since it’s also perfectly valid to have a file foo$bar.ps1, such names must be supported as commands. So functionally, everything is fine and cannot change. But it would be nice to fix the highlighting . The token is correct in the AST. Can you not use that?

2reactions
bpayettecommented, Aug 1, 2019

@msftrncs I think @iSazonov means that having a function name likefoo$bar is an edge-case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tokenizers | Apache Solr Reference Guide 6.6
This tokenizer creates tokens from strings of contiguous letters, discarding all non-letter characters. Factory class: solr.LetterTokenizerFactory. Arguments: ...
Read more >
Tokenizer
Converts a sequence of ids in a string, using the tokenizer and vocabulary with options to remove special tokens and clean up tokenization...
Read more >
NLTK Tokenize: Words and Sentences Tokenizer with ...
These tokens are very useful for finding patterns and are considered as a base step for stemming and lemmatization. Tokenization also helps to ......
Read more >
Unleashing the ChatGPT Tokenizer
What is happening here is that the tokenizer actually breaks the given word down into three tokens: “l” ,“oll” and “ipop”. Therefore, ChatGPT ......
Read more >
about Parsing - PowerShell
Argument mode is designed for parsing arguments and parameters for commands in a shell environment. All input is treated as an expandable string...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found