question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Line Numbers not rendering to gutter correctly.

See original GitHub issue

Using Browserify.

If I toggle the included css being pointed to the numbers display correctly.

snapshot

Like this: .CodeMirror-gutter-elt {left: -29px !important}

The line numbers display correctly, after I include the above line of css.

Possibly related areas of code: https://github.com/JedWatson/react-codemirror/blob/master/lib/Codemirror.js#L23 https://github.com/JedWatson/react-codemirror/blob/master/dist/react-codemirror.js#L677-L678 https://github.com/JedWatson/react-codemirror/blob/master/dist/react-codemirror.js#L1052-L1063

I was also having difficulties with getting extra themes to work as well, since the className was not being appended to the correct elements.

var Editor         = require('./codeeditorview/CodeMirror')
    editorConfig: {
        'mode': 'javascript',
        'theme': 'cm-s-monokai',
        'lineNumbers': true,
    },
<Editor config={ this.items.editorConfig }/>

./codeeditorview/CodeMirror’:

'use strict';
var Codemirror = require('react-codemirror');
var Editor = React.createClass({
    getInitialState: function() {
        return {
            code: 'function add(a, b) {\n' +
                  '  return a + b;\n' +
                  '}'
        };
    },
    updateCode: function(newCode) {
        console.log('From the editor',newCode)
        this.setState({
            code: newCode
        });
    },
    render: function() {
      var options = this.props.config
      return (
          <Codemirror value={this.state.code} onChange={this.updateCode} options={options} />
      )
    }
  });

// React.render(<App />, document.getElementById('app'));
module.exports = Editor

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:3
  • Comments:10

github_iconTop GitHub Comments

8reactions
Nicolewxyycommented, Apr 8, 2016

Use refresh or autorefresh , I require autorefresh.js and set option autoRefresh to true solved it. For more details

5reactions
caiskicommented, Mar 7, 2017

Did you guys really solve this problem ?

I used autoRefresh: true and import 'codemirror/addon/display/autorefresh'; , wrong rendering still remains.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio 2012 Line-Number/Outlining Gutter Missing
Bellow is a picture of my current install which is missing the gutter and inset in the green border is a correctly working...
Read more >
Corridor Gutter Pan Not Modeling Correctly - Autodesk Forums
Solved: I recently created a corridor with the Primary Road Full Section Assembly. I put in the cross slope of the gutter and...
Read more >
Gutter line height doesn't match the actual view ... - CodeMirror
Implementing CodeMirror 6 in react (next.js). Everything works but the initial load seems to render the gutter numbers incorrectly.
Read more >
Common Gutter Installation Mistakes - All Season Gutters
1. Wrong Gutter Placement ... The placement of your downspouts can significantly affect how well your system works, as can the number of...
Read more >
Highlight specific line numbers in the gutter
In short I'm looking to write a simple plugin showing some simple warnings through colours, not relying on the sign column feature. I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found