Mon Jun 01, 2020 11:37 pm
Login Register Lost Password? Contact Us


VS Code Hints and Questions

Topics around the use of the VS Code & Eclipse plugins

Thu Apr 16, 2020 2:28 pm Change Time Zone

Because I am somewhat greedy ... Let's start with the questions.

1. Is there a way just to submit a compile, such that it generates a wuid from VS code without running the code. I use this to test macros as syntax is not great at it. Shhh don't tell Richard I'm using macros. :-)

2. intellisense for ECL is much better in VS code than it was in the ide. However, am I missing a setting to capture local attribute definitions? From modules I can grab exported and shared attributes from a module but local or recently used attributes.
Code: Select all
  "editor.suggest.localityBonus": true,
  "editor.suggestSelection": "recentlyUsed",
  "editor.wordBasedSuggestions": true,
  "editor.parameterHints.enabled": true,


3. Has anyone found an extension that can format key-words and such automatically? IMPORT, EXPORT, END, TRANSFORM , FUNCTION etc.

4. "files.defaultLanguage": "ecl", does not change the default file type to .ecl when I go to save a new file. Is this a bug or am I missing something?

Tim Newport, Sr Data Eng. LexisNexis Risk
Last edited by newportm on Fri Apr 17, 2020 2:02 pm, edited 2 times in total.
newportm
 
Posts: 22
Joined: Tue Nov 15, 2016 2:48 pm

Thu Apr 16, 2020 2:28 pm Change Time Zone

I'm sure there are more but here are a few things I use in VS code to make my life a bit easier.
Warnings/Hints:
• Don’t try to name two folders the same under the same directory structure. So like I have an Prod folder and a Dev folder all with the same ECL repos but different environments. You can’t use both folders in the workspace. It will not run. So create a new workspace and place the workspace one level higher than the ECL Repo folder.

• You may need to add imports inside of your bwr and macro definitions to syntax check or run code. ECL_IDE did not force this. I had the Import before the macro and that does not work in VS code.

• As you see above you can do code compares in VS code. Live. A nice touch. Also it adds come merge choices to take current or take previous.

• Welcome Timeline View! You can now see the history of GIT changes for an attribute in the VS code IDE. From the Explorer Menu >> [Your Workspace Name] >> Select Attribute >> Right Click "Open Timeline" >> Look at commit history.

• Vs Code has source control built into the UI so that’s handy. .gitignore is important to have setup! so you don't end up adding logs and other settings to the ecl repo.

• In the code repo. I like to copy the file name and use in my code. This plugin will allow that.
https://marketplace.visualstudio.com/items?itemName=jack89ita.copy-filename

• In the explore you can start typing and do a repo search for the attribute names.

• Add a plugin to auto format your ecl to clean up extra white spaces at the end of each line. Remember to change your settings to format after save or set up a keyboard shortcut.
Code: Select all
  "editor.formatOnSave": true,

https://marketplace.visualstudio.com/items?itemName=eetami.whitespace-formatter

• Shift F1 will now open the online ECL reference. Remember to add hpccsystems to your trusted websites so it will auto open the link. This does not work 100%. IT will take you to the site but you may need to do a search. Try INDEX from VSCODE. Sad Day.

• Love control D to duplicate line. You will want this plugin as well.
https://marketplace.visualstudio.com/items?itemName=geeebe.duplicate

• When wanting to run multiple wuid at once you will have to stop the IDE from monitoring the last one you submitted. Unless you’re in a separate workspace. Stopping just stop monitoring, it does not affect your WU.

• The output tab is for if you have debug ecl turned on. Change the dropdown to "ECL" to see the correct log.

• Alt + arrow (left , right) key will toggle you back and forth between tab you just left in order visited

• If you set up the global settings first then they will import into your workspace. Keybinding is the keyboard shortcuts. I got used to Ctrl Q and Ctrl + Shift + Q for comments so I set them up in VS code to do the same thing.

• F12 will open the highlighted code but it replaces the tab if your in the same folder. I have not yet can’t figure out how to go back from an F12 if it changes the tab. So you have to reopen the file. Alt F12 just opens up a peek window the can be closed. Much better for quick glance at something.

• You can block highlight by holding down the middle mouse button.

• Change your Terminal to gitbash so you can use aliases. In settings:
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",

• Want to keep your regex up to par and your code pretty. This plugin allows you to line up selected text by any regex statement of highlighted text. There are some others out there that do automatic but those are more for java or python. Feel free to create one for ECL
https://marketplace.visualstudio.com/items?itemName=janjoerke.align-by-regex

Have a complicated string you use a lot or always forget the escape chars add this to your user or global settings and just type the word into the command prompt. Don’t forget to set up a key shortcut I like
Code: Select all
CTRL + =


Code: Select all
"align.by.regex.templates": {
    "comma": ",", //lines up all commas by occurrence
    "first comma": "^[^,]+", //align the first comma only
    "comma word": "(.*?),", //first char after first comma
    "last comma": "(,)[^,]*$",
    // assigment operator not after a function, macro, module, record, transform definition
    "assignment": ":=(?<!((FUNCTION|[Ff]unction|MACRO|[Mm]acro|[Mm]odule|MODULE|RECORD|[Rr]ecord|[Tt]ransfrom|TRANSFORM)(\\s*):=))",
    "comment": "^[^//]+", //first comment string
    "colon": "^([^:]|(::))+", //first solo colon not :: in our file names
  }
Last edited by newportm on Fri Apr 17, 2020 12:39 pm, edited 3 times in total.
newportm
 
Posts: 22
Joined: Tue Nov 15, 2016 2:48 pm


Return to VS Code and Eclipse IDE

Who is online

Users browsing this forum: No registered users and 1 guest