{"record":{"id":"c61d65322fd5f399","repo":"ajaxorg/ace","slug":"deprecated-use-session-addgutterdecoration","errorCode":null,"errorMessage":"deprecated use session.addGutterDecoration","messagePattern":"deprecated use session\\.addGutterDecoration","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/layer/gutter.js","lineNumber":60,"sourceCode":"\n    /**\n     * @param {EditSession} session\n     */\n    setSession(session) {\n        if (this.session)\n            this.session.off(\"change\", this.$updateAnnotations);\n        this.session = session;\n        if (session)\n            session.on(\"change\", this.$updateAnnotations);\n    }\n\n    /**\n     * @param {number} row\n     * @param {string} className\n     */\n    addGutterDecoration(row, className) {\n        if (window.console)\n            console.warn && console.warn(\"deprecated use session.addGutterDecoration\");\n        this.session.addGutterDecoration(row, className);\n    }\n\n    /**\n     * @param {number} row\n     * @param {string} className\n     */\n    removeGutterDecoration(row, className) {\n        if (window.console)\n            console.warn && console.warn(\"deprecated use session.removeGutterDecoration\");\n        this.session.removeGutterDecoration(row, className);\n    }\n\n    /**\n     * @param {any[]} annotations\n     */\n    setAnnotations(annotations) {\n        // iterate over sparse array","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/ajaxorg/ace/blob/2c1eddc392eb92cf222a4478f1893d2b2c354fb0/src/layer/gutter.js#L42-L78","documentation":"A deprecation warning emitted by GutterLayer.addGutterDecoration (also surfaced through Renderer.addGutterDecoration). Decoration bookkeeping moved to the session, so the layer method now just warns and forwards to session.addGutterDecoration.","triggerScenarios":"Calling editor.renderer.addGutterDecoration(row, className) — the renderer-level API — in code written against older Ace versions.","commonSituations":"Plugins that highlight lines in the gutter (breakpoints, lint markers) written for old Ace; copied StackOverflow snippets using renderer.addGutterDecoration.","solutions":["Call editor.session.addGutterDecoration(row, className) instead","Remove renderer.addGutterDecoration wrapper calls and route all gutter decoration through the session","Remember to clean up with session.removeGutterDecoration(row, className)","Warning is benign — the call still takes effect via delegation"],"exampleFix":"// before\neditor.renderer.addGutterDecoration(4, 'error_gutter');\n// after\neditor.session.addGutterDecoration(4, 'error_gutter');","handlingStrategy":"validation","validationCode":"if (typeof editor.session.addGutterDecoration !== 'function') throw new Error('session gutter API unavailable; upgrade ace');\neditor.session.addGutterDecoration(row, className);","typeGuard":null,"tryCatchPattern":"try {\n  editor.session.addGutterDecoration(row, className);\n} catch (e) {\n  console.error('gutter decoration failed', e);\n}","preventionTips":["Always decorate gutters via session.addGutterDecoration/removeGutterDecoration, never the renderer","Grep for 'renderer.addGutterDecoration' and migrate call sites","Pair every decoration with a remove call to avoid leaks","Watch CI console output for deprecation warnings to catch regressions"],"tags":["deprecation","gutter","console-warning"],"backgroundTag":"deprecated-api-migration","analyzedSha":"2c1eddc392eb92cf222a4478f1893d2b2c354fb0","analyzedAt":"2026-08-30T00:39:52.222Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}