nexional / CompareBuff

Sublime Text package to compare two buffers using external Comparison Tool
GNU General Public License v3.0
1 stars 0 forks source link

Feature request: more flexible diff command #2

Open dangh opened 2 years ago

dangh commented 2 years ago

Hi, I would like to propose to change external_tool_path to something like:

{
  "diff_command": ["cmd", "arg1", "arg2", "$1", "$2", "$3"]
}

It yields two benefits:

We can extend the toolkit with multiple diff commands:

{
  "diff_commands": [
    {
      "name": "Diff with VS Code",
      "command": ["code", "--diff", "$1", "$2"]
    },
    {
      "name": "3-way Merge with VS Code",
      "command": ["code", "--diff", "$1", "$2", "$3"]
    }
  ]
}

I'm not sure if it's feasible as the command name is generate dynamically at run time.

nexional commented 2 years ago

Sending more than 2 buffers to tool is not inherently possible at the moment. I'll have to look into it. For now I released v0.2.14 which will allow custom arguments to external_tool_path (placeholders for 2 buffers {0}, {1}): e.g. "external_tool_path": [ "C:\Program Files\Beyond Compare 4\BCompare.exe", "--file1", "{0}", "--file2", "{1}" ], Try it out & let me know.

dangh commented 2 years ago

@nexional I got this error in the latest version

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 308, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.3/importlib/__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
reloading plugin Default.side_bar
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 1692, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "/Users/t/Library/Application Support/Sublime Text/Installed Packages/CompareBuff.sublime-package/compare_buff.py", line 247
SyntaxError: can use starred expression only as assignment target

Edit: Found it. we need .python-version file

nexional commented 2 years ago

yeah saw that, somehow ST is trying to compile using python 3.3. I downgraded the code now to work with 3.3. Try out v0.2.15.

we need .python-version file Didn't realize we could do that. I'll also add that file.

dangh commented 2 years ago

It's working now 🥳

Thank you @nexional