Skip to content

Commit

Permalink
CompletionContext should check the editor if we are in a workspace or…
Browse files Browse the repository at this point in the history
… not. fixes pharo-project#4686

(the setter of CompletionContext will be cleaned up more when we remove the old completion)
  • Loading branch information
MarcusDenker committed Sep 23, 2019
1 parent d6ae900 commit a8713fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/NECompletion/CompletionContext.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Class {
'completionToken',
'model',
'ast',
'node'
'node',
'isWorkspace'
],
#category : #'NECompletion-New'
}
Expand Down Expand Up @@ -57,9 +58,9 @@ CompletionContext >> narrowWith: aString [
{ #category : #parsing }
CompletionContext >> parseSource [

ast := theClass
ifNil: [ ( RBParser parseFaultyExpression: source ) doSemanticAnalysis ]
ifNotNil: [ ( RBParser parseFaultyMethod: source ) doSemanticAnalysisIn: theClass ].
ast := isWorkspace
ifTrue: [ ( RBParser parseFaultyExpression: source ) doSemanticAnalysis ]
ifFalse: [ ( RBParser parseFaultyMethod: source ) doSemanticAnalysisIn: theClass ].
TypingVisitor new visitNode: ast
]

Expand All @@ -72,6 +73,7 @@ CompletionContext >> receiverClass [

{ #category : #'initialize-release' }
CompletionContext >> setController: aECController class: aClass source: aString position: anInteger [
isWorkspace := aECController editor textArea editingMode isScripting.
theClass := aClass.
source := aString.
position := anInteger
Expand Down
6 changes: 6 additions & 0 deletions src/OpalCompiler-Core/RBProgramNode.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ RBProgramNode >> doSemanticAnalysis [

]

{ #category : #'*opalcompiler-core' }
RBProgramNode >> doSemanticAnalysisIn: aClass [
self methodNode ifNil: [ ^self ].
^ self methodNode doSemanticAnalysisIn: aClass
]

{ #category : #'*opalcompiler-core' }
RBProgramNode >> enclosingMethodOrBlockNode [
^ self methodOrBlockNode
Expand Down

0 comments on commit a8713fd

Please sign in to comment.