-
Notifications
You must be signed in to change notification settings - Fork 7
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
added setting to select indentation type #9
Conversation
Fixes #7 |
Thanks very much for doing this. I'll try to take a closer look shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for submitting this, it looks good to me.
Regarding tests, you can add the following to templates-spec.js
to check tabs and a variable number of spaces:
it("can create a component with tabbed indent", function () {
const text = componentTemplate(entities.adder, {indentType: "Tabs"})
expect(text).toEqual(loadFixture("component/adder_indent_tab.vhd"))
})
it("can create a component with indent of three spaces", function () {
const text = componentTemplate(entities.adder,
{indentType: "Spaces", indentSpaceCnt: 3})
expect(text).toEqual(loadFixture("component/adder_indent_3spaces.vhd"))
})
(repeating for the instance and signal templates)
Then create files in the fixture directories with the correct indentation style.
For example, fixture/component/adder_indent_3spaces.vhd
would be:
component add
generic (
WIDTH : integer := 3;
HEIGHT : integer := 2
);
port (
clk : in std_logic;
in : in std_logic_vector(WIDTH-1 downto 0);
output : out std_logic_vector(WIDTH-1 downto 0)
);
end component add;
Does that make sense?
See https://flight-manual.atom.io/hacking-atom/sections/package-word-count/#running-tests for how to run the test suite from within Atom, and let me know if you have any problems.
lib/config.js
Outdated
enum: ["Spaces", "Tabs"], | ||
order: 2 | ||
}, | ||
indentSpaceCnt: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: no need to abbreviate Count to Cnt.
Thanks for pointing me to the flight manual and providing the examples. I had some trouble on my Windows machine with git checking out files with CR+LF line endings. With the autocrlf feature disabled however, all tests complete successfully! |
Great stuff, thanks again! |
This adds indentation control settings (tabs or spaces) in the config menu.
I don't know how to update the tests though...
Cheers!