0
0
forked from blender/blender

open in vscode #1

Open
opened 2023-04-20 15:22:56 +02:00 by Ankit Meel · 1 comment
Owner

image

// ==UserScript==
// @name         Open file in VSCode
// @namespace    https://tampermonkey.net/
// @version      0.1
// @description  Adds vscode://file url to file urls on gitea
// @author       ankitm
// @match        https://projects.blender.org/*
// @icon         https://icons.duckduckgo.com/ip2/blender.org.ico
// @require      https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant        none
// ==/UserScript==

waitForKeyElements("[class^=\"diff-file-box diff-box\"]", addVscodeDeepLink , false);

function addVscodeDeepLink(filebox) {
    var fileurl = filebox.attr("data-new-filename");
    var line = filebox.find("[class^=\"lines-num lines-num-new\"]").first().attr("data-line-num");
    var vscodeurl = "vscode://file/Users/ankitkumar/blender-build/blender/" + fileurl + ":" + line;
    var vscodebutton = document.createElement("a");
    vscodebutton.href = vscodeurl;
    vscodebutton.innerText = "Open in VS Code";
    vscodebutton.style = "margin-right: 10px; color: #0366d6; font-size: 14px; font-weight: 600; text-decoration: none;";
    vscodebutton.onclick = function(e) {
            window.open(vscodeurl, '_blank').focus();
            e.preventDefault();
        };
    filebox[0].querySelector("[class^=\"diff-file-header-actions\"]").appendChild(vscodebutton);
}
![image](/attachments/75973976-bfc5-45df-8718-0737b94e667f) ``` // ==UserScript== // @name Open file in VSCode // @namespace https://tampermonkey.net/ // @version 0.1 // @description Adds vscode://file url to file urls on gitea // @author ankitm // @match https://projects.blender.org/* // @icon https://icons.duckduckgo.com/ip2/blender.org.ico // @require https://gist.github.com/raw/2625891/waitForKeyElements.js // @grant none // ==/UserScript== waitForKeyElements("[class^=\"diff-file-box diff-box\"]", addVscodeDeepLink , false); function addVscodeDeepLink(filebox) { var fileurl = filebox.attr("data-new-filename"); var line = filebox.find("[class^=\"lines-num lines-num-new\"]").first().attr("data-line-num"); var vscodeurl = "vscode://file/Users/ankitkumar/blender-build/blender/" + fileurl + ":" + line; var vscodebutton = document.createElement("a"); vscodebutton.href = vscodeurl; vscodebutton.innerText = "Open in VS Code"; vscodebutton.style = "margin-right: 10px; color: #0366d6; font-size: 14px; font-weight: 600; text-decoration: none;"; vscodebutton.onclick = function(e) { window.open(vscodeurl, '_blank').focus(); e.preventDefault(); }; filebox[0].querySelector("[class^=\"diff-file-header-actions\"]").appendChild(vscodebutton); } ```
Author
Owner
vptr:OpenSubdiv
alignment:std::__1::__function::__value_func
alignment:std::__1::function
# alignment:blender::deg::(anonymous namespace)
# alignment:blender::deg::DepsNodeFactoryImpl<blender::deg::OperationNode>::create_node
# alignment:blender::deg::DepsgraphNodeBuilder
# alignment:blender::deg::OperationNode
# alignment:blender::deg::Depsgraph::add_new_relation
alignment:*
enum:IDRecalcFlag
enum:graph_id_tag_update
vptr:ccl::ShaderManager
signed-integer-overflow:fluid.c
pointer-overflow:gl_index_buffer.hh
pointer-overflow:*
signed-integer-overflow:*
vptr:*
integer-divide-by-zero:*
float-divide-by-zero:*
``` vptr:OpenSubdiv alignment:std::__1::__function::__value_func alignment:std::__1::function # alignment:blender::deg::(anonymous namespace) # alignment:blender::deg::DepsNodeFactoryImpl<blender::deg::OperationNode>::create_node # alignment:blender::deg::DepsgraphNodeBuilder # alignment:blender::deg::OperationNode # alignment:blender::deg::Depsgraph::add_new_relation alignment:* enum:IDRecalcFlag enum:graph_id_tag_update vptr:ccl::ShaderManager signed-integer-overflow:fluid.c pointer-overflow:gl_index_buffer.hh pointer-overflow:* signed-integer-overflow:* vptr:* integer-divide-by-zero:* float-divide-by-zero:* ```
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: ankitm/blender#1
No description provided.