Giter Club home page Giter Club logo

csdecompile's Introduction

csdecompile

C# Code navigation for Neovim that decompiles through references using Roslyn and IlSpy Telescope.

  • GotoDefinition
  • FindUsages
  • FindImplementations
  • ListTypeMembers
  • SearchForType
  • SearchForMembers
  • GetAssemblies
  • DecompileAssembly

Navigating from solction source code to decompiled code WindowsTerminal_baEts9VkFL

Navigating directly through solution assemblies WindowsTerminal_fGBOmBoDf3

Installation Steps

  1. Add plugin ex. Plug 'e82eric/csdecompile'
  2. Build .net navigation back end by running build.ps1

Starting the back end.

  • StartDecompiler
    • This will start the decompiler using the solution file found in the current directory. If multiple solution files are found a dialog to choose the correct solution will be shown
  • StartNoSolution
    • This will start the decompiler with no solution and no assemblies. Usually you would run AddExternalAssemblyDirectory after to load a set of dlls to navigate through SearchForType or SearchForMembers

Configuration:

This is what I am currently using to configure the plugin

local function decompiler_status()
  return require('csdecompile').GetSolutionLoadingStatus()
end

local function decompiler_operation_status()
  return require('csdecompile').GetCurrentOperationMessage()
end

require('lualine').setup {
  options = {
    refresh = {
      statusline = 1000,
    }, theme = 'gruvbox_dark'
  },
  sections = {
    lualine_a = {'mode'},
    lualine_b = {'branch', 'diff', 'diagnostics'},
    lualine_c = {'filename'},
    lualine_x = { { decompiler_status, color = require('csdecompile').GetSolutionLoadingColor }, { decompiler_operation_status, color = require('csdecompile').GetOperationStatusColor }, 'encoding', 'fileformat', 'filetype'},
    lualine_y = {'progress'},
    lualine_z = {'location'}
  },
  inactive_sections = {
    lualine_a = {},
    lualine_b = {},
    lualine_c = {'filename'},
    lualine_x = {'location'},
    lualine_y = {},
    lualine_z = {}
  },
  tabline = {},
  winbar = {},
  inactive_winbar = {},
  extensions = {}
}

require('csdecompile').Setup({ logLevel = 'debug' })
require('csdecompile.stacktrace').setup()

These are the mappings that I am currently using in my cs.lua

vim.keymap.set("n", "<leader>gd", function()
  require('csdecompile').StartDecompileGotoDefinition()
end,
{ buffer=true })

vim.keymap.set("n", "<leader>fu", function()
  require('csdecompile').StartFindUsages()
end,
{ buffer=true })

vim.keymap.set("n", "<leader>fi", function()
  require('csdecompile').StartFindImplementations()
end,
{ buffer=true })

vim.keymap.set("n", "<leader>tm", function()
  require('csdecompile').StartGetTypeMembers()
end,
{ buffer=true })

vim.keymap.set("n", "<leader><leader>", function()
  require('csdecompile').StartGetSymbolName()
end,
{ buffer=true }}

Experimental Nuget Support

I find this useful when working in a c# microservices environment where the services are deployed via nuget packages. When navigating code and I hit a service boundary it is really helpful to add the package for that service to the workspace and start navigating through its decompiled source alongside the original service. Or it is ocasionally helpful to download a package from nuget.org and navigate through it to get a understanding of its internals.

  • AddNugetSource
  • SearchNuget
  • SearchNugetAndDecompile
    • using the provided search string this will display a list of packages found using configured nuget feed and load the containing dlls into the decompiler workspace
  • SearchNugetAndDecompileWithDependencies
  • SearchNugetFromLocation
  • ClearNugetDirectory

WindowsTerminal_Un7TD4y2hy

Stack Trace Helpers

  • ParseStackTrace
    • ParseStackTrace will format and syntax highlight a visually selected stack trace
  • FindMethodByFilePath
    • Does filepath navigation to the path under the cursor
  • FindMethodByStackFrame
    • Navigate to the location under the cursor (assuming that the project or dll is loaded into the workspace)

csdecompile's People

Contributors

e82eric avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.