How to view the Scss's #debug result in vscode or in browser dev tools? - sass

How can I watch #debug result in scss?
I'm using the Live Sass Compiler by Glenn Marks in VSCode. Is there a way I can see the debug output in the terminal or chrome console?
Code example:
#debug 'hello world';
#debug math.div(10, 3);

Yes, you just need to set showOutputWindowOn to Debug. You can see details in the settings

More specifically (as from another answer pointed out); (in multiple diff ways)::
|-| ctrl+shift+p > Preferences: Open Settings (UI) (workbench.action.openSettings2) > Workspace > Live Sass Compile > Settings: Show Output Window On > Debug
|-| ctrl+shift+p > Preferences: Open Workspace Settings (JSON) (workbench.action.openWorkspaceSettingsFile) > paste "liveSassCompile.settings.showOutputWindowOn": "Debug"
|-| ctrl+shift+p > exec liveSass.command.showOutputOn.debug
|-| (or you may use comments as an output, as a workaround...)
Reference::
answer above
https://github.com/glenn2223/vscode-live-sass-compiler/blob/master/docs/settings.md#livesasscompilesettingsshowoutputwindowon
https://github.com/glenn2223/vscode-live-sass-compiler/blob/master/docs/settings.md#livesasscommandshowoutputon
https://github.com/ritwickdey/vscode-live-sass-compiler/issues/234#issuecomment-762474594 (outdated?)

Related

ZSH Autocomplete For Custom Script

I've been searching online for a lot of hours, puling an all nighter because i got so lost down this rabbit hole :D but i'm having trouble finding examples with working code.
I have a bash script that is called upon like the following examples:
foo-tools.sh switch <version number>
foo-tools.sh start
foo-tools.sh open-ports on
foo-tools.sh kube get logs
foo-tools.sh kube edit ing default-ingress -oyaml
I use zsh with oh-my-zsh as my shell.
I want to be able to type "foo-tools.sh " to list all availabe options and i want to be able to autocomplete an option with "foo-tools.sh k" meaning it should either list all availabe options starting with "foo-tools.sh k*" or if there is only one option autcomplete the command.
I found this code on some stackoverflow thread, it's the closes I've gotten to having it work fully:
#compdef foo-tools.sh
_foo_tools_sh() {
typeset -A opt_args
local alternatives
alternatives=(
'args:rv options:_foo_tools_sh_options'
)
_alternative $alternatives && return 0
return 1
}
_foo_tools_sh_options() {
local -a arguments=(
'start:Start VP'
'stop:Stop VP]'
'kube:Kube CMD'
'kube logs:Kube logs'
'info:Display info'
'get:Get CMD'
)
_sequence _describe 'cmds' arguments
return 1
}
# invoke the completion command during autoload
_foo_tools_sh "$#"
This works some what. When i type "foo-tools.sh " it shows me the options i configured:
all options displayed when TAB
But when i autocomplete one of the options with tab it adds a , after the command:
, added when TAB cmd
And the option with a space between the words, "kube logs" gets the space escaped when tabbed out:space escpaded + added ,
I also found these two commands, they goes in my .zshrc. The expansion is wierd, it ignores the commands that has spaces in them and it doesnt understand that the commands are nested.
I.e if typing foo-tools.sh open-ports it displays all the options, not just off/on.
local -a _foo_tools_sh=(
"start"
"stop"
"switch"
"install"
"kube"
"kube get"
"kube edit"
"open-ports on"
"open-ports off"
)
complete -W "${_foo_tools_sh}" 'foo-tools.sh'
Options not nestled
I would very much appreciate any help or insights in how to improve the script i have (or throw it out and replace it with something proper).

Ada GNATStudio gdb Breakpoints are not stopping in the debugger

I'm new to Ada, and I created a sample program.
with Text_IO; use Text_IO;
procedure Main is
Index : Integer;
begin
Index := 123;
-- Integer'Image means Int to str
Put_Line (Integer'Image (Index));
New_Line;
end Main;
When I put a breakpoint in Main, on the line Put_Line, the program continues on as if I never set it.
Here's what I do to debug it. Please correct me if I'm doing something wrong.
Set breakpoint on line 12.
Debugger Menu Item -> Initialize -> main
Debugger -> Start
Run Arguments: (nothing)
Unchecked "Stop at the beginning of main subprogram"
Unchecked "Use exec dir instead of current dir"
EDIT:
I solved this myself, I had to do a clean and build all, THEN go into Debugger Menu Item -> Initialize -> main
That gives me the little green line to start the debugger!
I solved this myself, I had to do a clean and build all, THEN go into Debugger Menu Item -> Initialize -> main
That gives me the little green line to start the debugger!
Perform a 'Clean All' and make sure '-g' is used in the build path when you perform a 'Build All'.
Debugger Menu Item -> Initialize -> main
Debugger -> Start
Run Arguments: (nothing) Unchecked "Stop at the beginning of main subprogram" Unchecked "Use exec dir instead of current dir"

Highlighting Github README.md format in Sublime Text 2

I have got README file and I want Sublime to highlight only some pieces of code idented by some "tag", for example:
Here is an example of usage
# This should be highlighted
```ruby
superhero = Superhero.new
superhero.make_world_better
```
or with [code lang=ruby] or whatever
Lazy answer
(for independent fast learners)
Install package control for
sublime-text.
Once you restarted sublime-text, see "Fast Answer".
Fast answer
(for intermediate to advanced sublime-text users)
Ctrl+Shift+P and Package Control: Install Package,
then install Knockdown.
That's it, now you have a Set Syntax: Markdown (Github flavored)
option right at the reach of your fingertips.
Elaborate answer
(powerless to powerfull)
- Installing Package Control
Open sublime-text.
[If you need this functionality available when you edit files on a directory
owned by root or www-data ( i.e. /var/www/ ) you may want to open sublime with admin
privileges using gksu sublime or similar and repeat every step]
Activate sublime's console by pressing ctr+`
[That is CONTROL key plus GRAVE ACCENT key (usually above the TAB key)]
Copy-paste one of the following options to sublime console's prompt.
(and press enter):
If sublime-text 2:
import urllib2,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')
If sublime-text 3:
import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
Close sublime when the console prints back a message saying "Please restart Sublime Text to finish installation" (usually almost instantaneous). Open sublime-text again.
Once you restarted sublime-text, the rest is easy, see "Fast Answer" (above), or read on.
About using Package Control
What you just installed adds a new bunch of commands to your Palette and opens the door to a wonderful world of community contributed plugins; a way to extend sublime's functionality by other people or by yourself! (share your code!).
Now lets use it to install knockdown.
You can access Package Controll simply by pressing ctr+shift+P, and typing Package Control, pc, pack (or anything similar thanks to the fuzzy search feature of the command palette), in this case search the right command by writing Package Control: Install Package (or just pi).
(If something goes wrong you can always Remove Package).
To see all the available packages just enter or click on it. Sublime will search for all the registered packages and will even check and show for you only the ones that are compatible with your version of sublime-text, you'll have to wait a few seconds.
(or less than a second, depending on your internet+computer latency+speed).
Now search for and select knockdown.
After you hit Enter or click on it it will take a brief moment to install.
That's it, it just works.
## - How to use it you ask?
To activate this highlighting in the current loaded buffer:
(lets say "the open file")
Inside sublime-text and with a .md file opened, press ctr+shift+P again.
Search for Set Syntax: Markdown (Github Flavored) and enter or click on it.
IF you want to activate for all .md files (that's a big IF)
On current version (Latest Sublime Text 2 releases & any ver 3 release):
Navigate through the following menus: View -> Syntax -> Open all with current extension as... ->[your syntax choice].
On previous versions of sublime:
Go to a Packages/User, create (or edit) a .sublime-settings file
named after the Syntax where you want to add the extensions,
Markdown (Github Flavored).sublime-settings in your case, then
write there something like this:
{
"extensions":
[
"md"
]
}
And then restart Sublime Text
... pics, else it shant have come to pass:
(it totally works! here's the evidence)
presto!
You just took one further step to be a sublime-text master, I hope my answer helped you
Your example is describing Markdown structured text
Try
1) Save file with .md extension
2) View -> Syntax -> Open all with current extension -> Markdown

.Rprofile: How to set option "browser" correctly (to Chrome) so that help.start() works?

I work on Mac OS X 10.7.3 with R version 2.14.0 (2011-10-31). My ~/.Rprofile is
options(repos=c(CRAN="http://cran.ch.r-project.org",
BioC="http://www.bioconductor.org",
Omegahat="http://www.omegahat.org/R"),
pdfviewer=path.expand("~/R/misc/shell_scripts/skim"),
browser="mybrowser")
where mybrowser is a file in /bin/ which contains open -a "/Applications/Google Chrome.app". When I open R and type help.start(), all I obtain is that Chrome becomes active, but no real output from help.start(). How can I properly set up browser in options so that help.start() works as expected?
I originally just had browser="Chrome", but R couldn't find the browser. I tried several kinds of things to solve this (e.g., browser="/Applications/Google Chrome.app" [and various variants to escape the blank]), but none worked. I guess that's because sh /Applications/Google\ Chrome.app just does not work. On the Mac, applications are opened via open -a ..., that's why I created mybrowser. That finally opened the browser, but I couldn't figure out how to get help.start to work properly.
Create a Renviron file in your home (i.e ~/.Renviron) and add this line.
R_BROWSER=google-chrome
I'm not sure about "chrome" part, i use conkeror and my setup is :
R_BROWSER=conkeror
But this should do the tricks
In the meantime, Hans-Joerg Bibiko helped out: the solution is to set browser to browser="/usr/bin/open -a 'Google Chrome'"
If you look in utils:::print.help_files_with_topic (the function that actually issues the call to browseURL()), there is this really annoying line:
if (.Platform$GUI == "AQUA" && type == "html")
browser <- get("aqua.browser", envir = as.environment("tools:RGUI"))
And since .Platform$GUI == "AQUA" on OSX, this means that you have to do some trickery to browse help files in your favorite browser. Hence, in my .Rprofile (located here path.expand('~/.Rprofile'), of course), I included these lines.
options(help_type='html')
options(browser="/usr/bin/open -a '/applications/Google Chrome.app'")
p <- .Platform
p$GUI = 'unknown'
unlockBinding('.Platform', as.environment('package:base'))
assign('.Platform', p , envir=as.environment('package:base'))
lockBinding('.Platform', as.environment('package:base'))
rm(p)
So far it doesn't seem to have any effect other than enabling use of an alternate browser, but you may want to read the section labeled "Aqua" in ?.Profile if you're worried about messing around with base.

Preventing debug code going into production using Progress 4GL?

How would you prevent chunks of debugging code from accidentally leaking into production enviroment when using Progress 4GL?
I usually just publish a special event - debug-message. In my dev environment there's a menu item in the application which will fire up a window which susbscribes to debug-message anywhere and displays any messages generated. So I can insert debug-messages into my code and then open the window if I want to see the messages. If I forget to tidy up the debug code then the live users don't see any messages, although I can still open the debug window to see what's going on.
( The webspeed version of this would just write the output to an OS file )
If your test database and production databases have different names, you could use this code:
IF DBNNAME = "TESTDB" THEN
DO:
<DEBUG CODE>
END.
Similar to my other answer about the assertions, you can setup an include that will be empty on production sites containing the debug flag. On development sites you just need to define the value so that your debugging code is included in your program.
By wrapping code in a preprocessor the compiler will omit the debug code altogether when you compile it onto a production site.
&if defined( debugalert ) <> 0 &then
&endif
You would then use the "&global-define debug" in versions of the code you want to contain the debug code. Not defining "debug" should cause the compiler to omit the code.
/* debug.i omit the following on production */
&GLOBAL-DEFINE DEBUGALERT
/* test.p */
{debug.i}
DEF VAR h_ct AS INT NO-UNDO
DO h_ct = 1 TO 10:
&IF DEFINED( DEBUGALERT ) <> 0 &THEN
MESSAGE "debug message" h_ct.
<debug code goes here>
&ENDIF
END.
A solution is based on the assumption that development enviroment has a unique propath entry that is not available in other enviroments and code is recompiled when moved over:
&IF DEFINED(DEBUGGING) = 0 &THEN
&IF PROPATH MATCHES '*development*' &THEN
&GLOBAL-DEFINE DEBUGGING TRUE
&ELSE
&GLOBAL-DEFINE DEBUGGING FALSE
&MESSAGE Remove debugging: search for DEBUG within the code.
&ENDIF
&ENDIF
&IF DEFINED(DEBUGGING_STARTED) = 0 &THEN
&GLOBAL-DEFINE DEBUGGING_STARTED TRUE
IF {&DEBUGGING} THEN
DO:
&ELSE
END.
&UNDEFINE DEBUGGING_STARTED
&ENDIF
Usage
Save file as "debug" (without extension) to a directory pointed at by propath, then:
{debug}
/* some debugging code here */
{debug/}

Resources