In order to comment out an entire block of code in the LookML editor, following these steps:
Your code should now be commented out with a #
symbol, like this:
# - dimension: id
# type: int
# primary_key: true
# sql: ${TABLE}.id
Read about all the keyboard shortcuts available in Looker here.
If you are commenting out lines that are entirely within a SQL code block, you will want to manually add SQL comment notation. Note that SQL comments must appear only in SQL blocks that are indented beyond the LookML parameter above it. This looks like:
Multi-line comments:
- view: user_order_facts
derived_table:
sql: |
/*
SELECT
users.id as user_id
, COUNT(*) as lifetime_orders
, MAX(orders.date) as most_recent_purchase_date
FROM orders
GROUP BY user.id
/*
Single line comments:
- view: user_order_facts
derived_table:
sql: |
SELECT
users.id as user_id
, COUNT(*) as lifetime_orders
-- , MAX(orders.date) as most_recent_purchase_date
FROM orders
GROUP BY user.id
how do you uncomment?
You just use exactly the same key combo to uncomment the code.
multi line comment syntax should terminate in */
How to set my own keyboard shortcut for comment?
I don't think there is a way to bind keys like this within Looker, but # is all you need to comment out a line, and you can comment out a block of code by simply highlighting and pressing ctrl + / in Windows (or command + / on a Mac).
You can see a comprehensive list of keyboard shortcuts here.