microsoft / vscode-extension-samples
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 601 units with 7,336 lines of code in units (71.3% of code).
    • 3 very long units (619 lines of code)
    • 13 long units (891 lines of code)
    • 64 medium size units (1,927 lines of code)
    • 122 small units (1,755 lines of code)
    • 399 very small units (2,144 lines of code)
8% | 12% | 26% | 23% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts8% | 12% | 25% | 23% | 29%
js0% | 14% | 44% | 23% | 17%
tsx0% | 0% | 0% | 100% | 0%
rs0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
webview-codicons-sample95% | 0% | 0% | 3% | 1%
terminal-sample80% | 0% | 0% | 16% | 3%
configuration-sample100% | 0% | 0% | 0% | 0%
lsp-embedded-request-forwarding0% | 41% | 31% | 18% | 7%
lsp-embedded-language-service0% | 31% | 32% | 13% | 23%
quickinput-sample0% | 40% | 16% | 28% | 14%
comment-sample0% | 91% | 0% | 0% | 8%
test-provider-sample0% | 38% | 16% | 25% | 19%
custom-editor-sample0% | 9% | 40% | 15% | 34%
task-provider-sample0% | 30% | 11% | 13% | 44%
vim-sample0% | 5% | 13% | 31% | 48%
source-control-sample0% | 9% | 35% | 19% | 35%
fsprovider-sample0% | 41% | 16% | 8% | 32%
tree-view-sample0% | 0% | 21% | 32% | 45%
webview-view-sample0% | 0% | 71% | 8% | 19%
webview-sample0% | 0% | 48% | 28% | 22%
lsp-log-streaming-sample0% | 0% | 72% | 12% | 15%
lsp-sample0% | 0% | 77% | 16% | 6%
decorator-sample0% | 0% | 83% | 16% | 0%
call-hierarchy-sample0% | 0% | 62% | 0% | 37%
inline-completions0% | 0% | 87% | 0% | 12%
lsp-multi-server-sample0% | 0% | 46% | 44% | 10%
fsconsumer-sample0% | 0% | 77% | 22% | 0%
extension-terminal-sample0% | 0% | 68% | 32% | 0%
virtual-document-sample0% | 0% | 100% | 0% | 0%
authenticationprovider-sample0% | 0% | 31% | 52% | 16%
notebook-renderer-sample0% | 0% | 64% | 35% | 0%
progress-sample0% | 0% | 100% | 0% | 0%
semantic-tokens-sample0% | 0% | 47% | 20% | 32%
lsp-user-input-sample0% | 0% | 56% | 0% | 43%
contentprovider-sample0% | 0% | 0% | 50% | 49%
code-actions-sample0% | 0% | 0% | 55% | 44%
lsp-web-extension-sample0% | 0% | 0% | 73% | 26%
codelens-sample0% | 0% | 0% | 78% | 21%
completions-sample0% | 0% | 0% | 100% | 0%
nodefs-provider-sample0% | 0% | 0% | 21% | 78%
i18n-sample0% | 0% | 0% | 50% | 49%
diagnostic-related-information-sample0% | 0% | 0% | 81% | 18%
basic-multi-root-sample0% | 0% | 0% | 100% | 0%
getting-started-sample0% | 0% | 0% | 100% | 0%
product-icon-theme-sample0% | 0% | 0% | 100% | 0%
notebook-renderer-react-sample0% | 0% | 0% | 100% | 0%
document-editing-sample0% | 0% | 0% | 100% | 0%
statusbar-sample0% | 0% | 0% | 44% | 55%
github-authentication-sample0% | 0% | 0% | 0% | 100%
webpack-sample0% | 0% | 0% | 0% | 100%
uri-handler-sample0% | 0% | 0% | 0% | 100%
welcome-view-content-sample0% | 0% | 0% | 0% | 100%
helloworld-minimal-sample0% | 0% | 0% | 0% | 100%
helloworld-web-sample0% | 0% | 0% | 0% | 100%
helloworld-sample0% | 0% | 0% | 0% | 100%
proposed-api-sample0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
private static _getHtmlForWebview()
in webview-codicons-sample/src/extension.ts
348 1 2
export function activate()
in terminal-sample/src/extension.ts
155 18 1
export function activate()
in configuration-sample/src/extension.ts
116 27 1
export function activate()
in comment-sample/src/extension.ts
89 11 1
export function getCSSVirtualContent()
in lsp-embedded-request-forwarding/client/src/embeddedSupport.ts
89 19 2
export function getDocumentRegions()
in lsp-embedded-request-forwarding/client/src/embeddedSupport.ts
87 18 2
export async function activate()
in test-provider-sample/src/extension.ts
80 16 1
export function getLanguageModes()
in lsp-embedded-language-service/server/src/languageModes.ts
68 8 0
export function getDocumentRegions()
in lsp-embedded-language-service/server/src/embeddedSupport.ts
65 16 2
async function pickFile()
in quickinput-sample/src/quickOpen.ts
64 13 0
_initElements()
in custom-editor-sample/media/pawDraw.js
61 11 1
async function getRakeTasks()
in task-provider-sample/src/rakeTaskProvider.ts
61 18 0
private _findMapping()
in vim-sample/src/controller.ts
59 10 3
async showInputBox()
in quickinput-sample/src/multiStepInput.ts
58 10 8
export function activate()
in fsprovider-sample/src/extension.ts
55 5 1
export async function activate()
in source-control-sample/src/extension.ts
55 9 1
export function getLanguageModelCache()
in lsp-embedded-language-service/server/src/languageModelCache.ts
50 12 3
async function selectWorkspaceFolder()
in source-control-sample/src/extension.ts
49 20 2
function didOpenTextDocument()
in lsp-multi-server-sample/client/src/extension.ts
46 8 1
export function activate()
in fsconsumer-sample/src/extension.ts
44 6 1