CSeitel / open-in-npp

VSC-extension: Open In Notepad++
MIT License
1 stars 1 forks source link

Path to where the VScode text file should be saved to then be opened by Notepad++ #4

Open samsenrohm opened 1 year ago

samsenrohm commented 1 year ago

Hello,

I have installed the most recent version of VS Code and the Open in Notepad++ extension.

The issue I am having is that I am working on a company laptop, and I have NO access to write files into the C:\ folder.

Whenever I to open a text file in Notepad++ a popup appears:

Create new file: Cannot create the file "C:\Interactive-1.interactive"

Open In Npp: Working Directory Specifies the path of the folder used as [working directory]

for both User and Workspace to:

C:\Project\data\

However it appears that the Extension does not use this to determine where the file should be saved before opening in NotePad++

Where do I set the value to specify the path to where the VScode text file should be saved to then be opened by Notepad++?

CSeitel commented 1 year ago

Hi, sounds maybe more like a NotePad++-setting, cf. https://npp-user-manual.org/docs/preferences/#default-directory (what is your setting there?), the extension would work like: Win-R (press Windows-Key and R) -> enter cmd.exe ->

cd C:\Project\data\ (the specified Working directory) "C:\Program Files\Notepad++\notepad++.exe" and then it is not clear how NotePad++ behaves (in terms of considering "C:\Project\data\" or not).

samsenrohm commented 1 year ago

VScodeOpenInNPPissue.pdf

The issue I am running into is described in the attached .pdf

My Default Folder in NotePad++ is set to C:\Repos

However VS Code continues to try to create the file as C:\Interactive-1.interactive before opening it in NotePad++

I am unclear about what setting in VS Code instructs it where (by default) to create files.

And I tried this, but it did not solve the issue: https://stackoverflow.com/questions/43305050/changing-the-default-path-of-visual-studio-codes-integrated-terminal

terminal.integrated.cwd -> C:\Repos

Any other suggestions?

samsenrohm commented 1 year ago

Also I found this but same-same... the file it generates is in C:\

VS Code tips — The terminal CWD setting https://www.youtube.com/watch?v=onMbYU-Vrk4

You suggested that is could be NotePad++, but it appears that VS Code is trying to save the file, and then 'informing' NPP where to open it from.

CSeitel commented 1 year ago

A VS Code text editor is not a file editor, i.e. it can just render text without assignment to a particular file. The file "C:\Interactive-1.interactive" does not exist on the file system but is passed to NotePad++ as parameter and NotePad++ tries to create it as empty file (which fails). Can you save the text editor "Interactive-1.interactive (output)" in VS Code? The "(output)" in the name is already an indicator that it is not a real file. The context menu "Open in NotePad++" would need to learn to distinguish between file editor and text editor.

samsenrohm commented 1 year ago

Hello Charles,

I reached out to Microsoft, and here is their response. They believe it is the onus of the Add-On to specify the location where the interactive-1.txt file needs to be written for NotePad++ to open. If I remove the Add-On a on the interactive window does not bring up a context menu to select a text editor (as it does when your add-in is installed). However File Save As does default to the same folder where the Python script is being executed from.

It's not clear why your add-on does not use the specified working directory of your application to write the file when it is being saved to load into NotePad++. It must be the add-on that initiates that process, as when the add-on is removed VS Code does not default to C:\ as the location where thae content of the interactive window is written.


Hello Enbridge team,

I investigated this issue . The “Open in Notepad++” is a option which is added to context menu as part of installation of the third party developed extension .

It is up to extension to decide how and where it decides to create the said file . This location could be derived in code of the extension from some value or could be based on some heuristics or may simply be a default value . Unfortunately , Microsoft doesn’t possess any knowledge of how this third-party extension is coded. The extension developers are in best position to determine what their extension does at code level and to handle this situation appropriately. If needed the extension developer can contact Microsoft on a separate ticket for assistance .

I see you have already reached out to extension developer on its GitHub repo Path to where the VScode text file should be saved to then be opened by Notepad++ · Issue #4 · CSeitel/open-in-npp (github.com) and request you to pursue this with the respective developer of this extension.

Please be advised , I need to adhere to following support guidelines w.r.t VSCode .

• Microsoft Support offers support to installation of Visual Studio Code and any functionalities which are present in its default state after it is downloaded and installed from https://code.visualstudio.com/ . • Any Microsoft published extensions present in the marketplace have support outlined in Support.MD file in the respective GitHub repository ( eg Microsoft published python extension has support policy listed here vscode-python/SUPPORT.md at main · microsoft/vscode-python (github.com) ) . These are generally supported by corresponding Microsoft product group directly on GitHub . • Similarly , any extensions which are developed or published by any third-party person/company , are supported by their respective developers , generally on GitHub repositories but there may be other mechanisms.

Please let me know if there are any concerns.

Regards, Shivam Mishra (Microsoft)

CSeitel commented 1 year ago

Regarding: It's not clear why your add-on does not use the specified working directory of your application to write the file when it is being saved to load into NotePad++. Yes, however, the extension was designed to display existing files only, writing and saving files, i.e. creating new files in order to load into NotePad++ was not on the agenda. So the response of Microsoft refers to the potential design of a feature not yet implemented.

CSeitel commented 3 months ago

With recent version 2.0 it is now possible to display "virtual documents" (i.e. the contents of editors not representing files on the filesystem), e.g. Menu -> File -> New text file -> Open In Notepad++ (Not sure whether your use case would require change mode or whether display is enough)