Skip to content
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

FIX 701 #750

Merged
merged 33 commits into from
Jan 15, 2019
Merged

FIX 701 #750

merged 33 commits into from
Jan 15, 2019

Conversation

protiumx
Copy link
Contributor

Short description of what this resolves: Fix #701

Fixes: #701

NOTE: This adds support for multi-line settings with code sync pragma. It only support one level of nested settings for now.
Usage of pragmas in nested settings:

  // @sync-ignore
  "setting.nested": {
    "key": "value"
  }

  // @sync os=linux
  "setting.nested2": [
     1,2,3
  ]

Blackcatz1911 and others added 30 commits September 18, 2018 02:08
…sync pragmas. Should it support multiple spaces? Replacing settings.json content before writing file. Should be better removing lines instead of add comments? Replacing settings.json before upload to remove @sync ignore pragms.
…n every orther. Remove whitespaces before upload. Alert user if OS value is not a valid OS.
… Only insert comments if it doesn't match with matchine os or host or env. Uncomment line before write if it matched.
…ted. Get OS from OsType enum. Remove os.hostName()
…commas are removed. Must check this. If not valid OS is detected inform user. Added function to remove comments from text.
Get the local content and extract the ignored lines before writing the new settings. Add the ignored lines at the beginning of the settings object.
Instead of replacing entires blocks, we will loop each line in the settings file. For each line we are checking if should be ignored or if comments must be toggled. There is a block of code that is repeated to ensure the readability of the code.
@shanalikhan shanalikhan added this to the v3.2.5 milestone Jan 14, 2019
@@ -13,33 +13,12 @@ describe("Process before upload", function() {
);
});

it("should remove @sync-ignore and @sync ignore lines", () => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may i know why these tests were removed.
also can you add test for multi settings

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was removed since the new approach doesn't need separated methods to accomplish the same and some methods were removed.
I added a new test for multi-line settings but I can't run the test because TSLint throws errors in "commons.ts" file. Check the latest commits.

@shanalikhan shanalikhan merged commit 77748bb into shanalikhan:v3.2.5 Jan 15, 2019
@protiumx
Copy link
Contributor Author

protiumx commented Jan 16, 2019 via email

@shanalikhan
Copy link
Owner

shanalikhan commented Jan 17, 2019

Thanks really nice!

Make sure you pull the latest code first before sending next PR, unlike this PR had alot of commits you look.

Bounty is available for issues here : bounty

I got familiar with all the code sync code base.

I would request you to look into this : #396 as its the one of the most important bug waiting for PR

shanalikhan pushed a commit that referenced this pull request Feb 15, 2019
* Addapt test to changes.

* Get tabs or spaces and line breaks for each ignored line.

* Remove unnecesary tests

* New Approach for parsing pragmas

Instead of replacing entires blocks, we will loop each line in the settings file. For each line we are checking if should be ignored or if comments must be toggled. There is a block of code that is repeated to ensure the readability of the code.

* Support for Brackets and unifying repeated code

* Test for multi-line settings supporting curly braces and brackets. Changing test text extension.

* Remove unused function. Add new lines after ignored settings block.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants