<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>nRF Connect for VS Code messes up environment variables</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/91938/nrf-connect-for-vs-code-messes-up-environment-variables</link><description>Hi, 
 I have an environment variable with newlines and that is messed up by the VS Code extension. It seems that the extension tries to parse and rewrite the whole environment for some unknown reason. I have the following variables defined among others</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 16 Sep 2022 15:05:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/91938/nrf-connect-for-vs-code-messes-up-environment-variables" /><item><title>RE: nRF Connect for VS Code messes up environment variables</title><link>https://devzone.nordicsemi.com/thread/386702?ContentTypeID=1</link><pubDate>Fri, 16 Sep 2022 15:05:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd68faf2-8f75-4ee3-87ed-faf5eb9c625d</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="JonasJ"]&lt;p&gt;At the end of that documentation I found this. Not sure that I understand this correctly. VS Code reads .profile but if I want to disable that feature I should set things i .profile?&lt;/p&gt;
&lt;p&gt;Is this paragraph really correct?&lt;/p&gt;[/quote]
&lt;p&gt;I understand the confusion here, I&amp;#39;ll try to explain a bit about the background of how it became this way.&lt;/p&gt;
&lt;p&gt;Former versions of NCS/zephyr stated that you&amp;nbsp;shall use environmental vars as a part of the getting started for the linux platform, similar to what is still documented for &amp;quot;west&amp;quot;:&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/zephyr/develop/getting_started/index.html#get-zephyr-and-install-python-dependencies"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/zephyr/develop/getting_started/index.html#get-zephyr-and-install-python-dependencies&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;But, it also stated that the toolchain and so forth should be placed in the local environment.&lt;/p&gt;
&lt;p&gt;We had to pick these up with VSCode, which meant that we needed to parse the local env setup to pick them out, which per the above has been .bashrc. So, to avoid that it parses more than it should, you can move it one step up, ie. in .profile.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect for VS Code messes up environment variables</title><link>https://devzone.nordicsemi.com/thread/386361?ContentTypeID=1</link><pubDate>Thu, 15 Sep 2022 11:14:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d98e0835-50f0-4b86-bb27-a2a3682a7560</guid><dc:creator>JonasJ</dc:creator><description>&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;These environment variables are set in system files so it&amp;#39;s not something I&amp;#39;d like to mess around in. But thanks for sharing that part of the documentation, didn&amp;#39;t know about that variable. Can be useful.&lt;/p&gt;
&lt;p&gt;I hope the VS Code team can figure out what is wrong. It doesn&amp;#39;t stop med from compiling but it generates annoying noise in the terminal when build.&lt;/p&gt;
&lt;p&gt;At the end of that documentation I found this. Not sure that I understand this correctly. VS Code reads .profile but if I want to disable that feature I should set things i .profile?&lt;/p&gt;
&lt;p&gt;Is this paragraph really correct?&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;VS Code picks up environment variables set in &lt;code&gt;.profile&lt;/code&gt;. To disable this option while still being compatible with the terminal, move the nRF Connect SDK-specific environment variables (such as &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/develop/toolchains/gnu_arm_embedded.html"&gt;&lt;code&gt;ZEPHYR_TOOLCHAIN_VARIANT&lt;/code&gt; or &lt;code&gt;GNUARMEMB_TOOLCHAIN_PATH&lt;/code&gt;&lt;/a&gt;) to &lt;code&gt;.profile&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect for VS Code messes up environment variables</title><link>https://devzone.nordicsemi.com/thread/386357?ContentTypeID=1</link><pubDate>Thu, 15 Sep 2022 11:07:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71b4be51-57c6-485d-934d-07a1240dc35b</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Yes, I can confirm that there can be issues with local environment on different linux distro&amp;#39;s, as we mainly target ubuntu.&lt;/p&gt;
&lt;p&gt;I have made the nrf VScode team aware of your issue, and it will be evaluated for future improvements.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As a workaround, can you try to check for $NRF_CONNECT_VSCODE to work around this issue?&lt;/p&gt;
&lt;p&gt;More details can be found here in our documentation:&amp;nbsp;&lt;a href="https://nrfconnect.github.io/vscode-nrf-connect/connect/west.html#controlling-the-west-environment"&gt;https://nrfconnect.github.io/vscode-nrf-connect/connect/west.html#controlling-the-west-environment&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect for VS Code messes up environment variables</title><link>https://devzone.nordicsemi.com/thread/386209?ContentTypeID=1</link><pubDate>Wed, 14 Sep 2022 13:46:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45e48d7b-0c89-430e-9491-c7e2de245fd7</guid><dc:creator>JonasJ</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can test this you self by sourcing the following file in a shell and launch vscode after that. You should see an error similar to my report.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;foo_bar() {
    echo &amp;quot;This is a function in bash&amp;quot;
}

export -f foo_bar
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m running Fedora 36 and it doesn&amp;#39;t matter which project I build.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect for VS Code messes up environment variables</title><link>https://devzone.nordicsemi.com/thread/386207?ContentTypeID=1</link><pubDate>Wed, 14 Sep 2022 13:35:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fcb3017a-2def-474b-af38-99883a5c6270</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am trying to recreate this on my end, but I&amp;#39;ll need some added info about your setup to be able to do this.&lt;/p&gt;
&lt;p&gt;Which distro are you using?&lt;/p&gt;
&lt;p&gt;Can you elaborate on how and where you place this particular env variable?&lt;/p&gt;
&lt;p&gt;Does this issue occur when&amp;nbsp;compiling&amp;nbsp;any example, or is it a specific one?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect for VS Code messes up environment variables</title><link>https://devzone.nordicsemi.com/thread/386185?ContentTypeID=1</link><pubDate>Wed, 14 Sep 2022 12:51:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b157d5d6-6b7c-40f4-9077-7a2cc642be06</guid><dc:creator>JonasJ</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;VS Code correctly inherits the environment variables, no issue there. If you try to build a project using nRF Connect SDK Extension I get the errors in my post.&lt;/p&gt;
&lt;p&gt;I assume this is because the nRF extension for VS Code reads the existing env variables but can&amp;#39;t handle those that have newline (\n) in them and thus creates a broken env when launching the terminal to run west build.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect for VS Code messes up environment variables</title><link>https://devzone.nordicsemi.com/thread/386181?ContentTypeID=1</link><pubDate>Wed, 14 Sep 2022 12:45:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1f1585a-8081-46be-907d-9b43753d3c0a</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you elaborate a bit on where these env vars are located and how you&amp;#39;re opening vscode?&lt;/p&gt;
&lt;p&gt;If you open vscode from the terminal where you have everything setup, it should also inherit your whole environment. Could you try this? ie. run this from terminal: code /path/to/ncs&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>